Whitespace cleanups.
[platform/upstream/glib.git] / gio / glocalfile.c
index 2b4b35e..64ea94c 100644 (file)
@@ -94,7 +94,7 @@
 
 #include "gioalias.h"
 
-static void g_local_file_file_iface_init (GFileIface       *iface);
+static void g_local_file_file_iface_init (GFileIface *iface);
 
 static GFileAttributeInfoList *local_writable_attributes = NULL;
 static GFileAttributeInfoList *local_writable_namespaces = NULL;
@@ -111,7 +111,7 @@ G_DEFINE_TYPE_WITH_CODE (GLocalFile, g_local_file, G_TYPE_OBJECT,
                         G_IMPLEMENT_INTERFACE (G_TYPE_FILE,
                                                g_local_file_file_iface_init))
 
-static char * find_mountpoint_for (const char *file, dev_t dev);
+static char *find_mountpoint_for (const char *file, dev_t dev);
 
 static void
 g_local_file_finalize (GObject *object)
@@ -355,7 +355,7 @@ name_is_valid_for_display (const char *string,
 
   while ((c = *string++) != 0)
     {
-      if (g_ascii_iscntrl(c))
+      if (g_ascii_iscntrl (c))
        return FALSE;
     }
 
@@ -684,7 +684,7 @@ static gboolean
 device_equal (gconstpointer v1,
               gconstpointer v2)
 {
-  return *(dev_t *)v1 == * (dev_t *)v2;
+  return *(dev_t *)v1 == *(dev_t *)v2;
 }
 
 static guint
@@ -936,7 +936,7 @@ g_local_file_set_display_name (GFile         *file,
       return NULL;
     }
   
-  new_file = g_file_get_child_for_display_name  (parent, display_name, error);
+  new_file = g_file_get_child_for_display_name (parent, display_name, error);
   g_object_unref (parent);
   
   if (new_file == NULL)
@@ -1025,13 +1025,13 @@ g_local_file_query_writable_namespaces (GFile         *file,
 }
 
 static gboolean
-g_local_file_set_attribute (GFile                      *file,
-                           const char                 *attribute,
-                           GFileAttributeType          type,
-                           gpointer                    value_p,
-                           GFileQueryInfoFlags         flags,
-                           GCancellable               *cancellable,
-                           GError                    **error)
+g_local_file_set_attribute (GFile                *file,
+                           const char           *attribute,
+                           GFileAttributeType    type,
+                           gpointer              value_p,
+                           GFileQueryInfoFlags   flags,
+                           GCancellable         *cancellable,
+                           GError              **error)
 {
   GLocalFile *local = G_LOCAL_FILE (file);
 
@@ -1053,7 +1053,7 @@ g_local_file_set_attributes_from_info (GFile                *file,
 {
   GLocalFile *local = G_LOCAL_FILE (file);
   int res, chained_res;
-  GFileIfacedefault_iface;
+  GFileIface *default_iface;
 
   res = _g_local_file_info_set_attributes (local->filename,
                                           info, flags, 
@@ -1753,13 +1753,24 @@ g_local_file_move (GFile                  *source,
                   gpointer                progress_callback_data,
                   GError                **error)
 {
-  GLocalFile *local_source = G_LOCAL_FILE (source);
+  GLocalFile *local_source;
   GLocalFile *local_destination = G_LOCAL_FILE (destination);
   struct stat statbuf;
   gboolean destination_exist, source_is_dir;
   char *backup_name;
   int res;
-
+  off_t source_size;
+  
+  if (!G_IS_LOCAL_FILE (source) ||
+      !G_IS_LOCAL_FILE (destination))
+    {
+      /* Fall back to default move */
+      g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "Move not supported");
+      return FALSE;
+    }
+  
+  local_source = G_LOCAL_FILE (source);
+  
   res = g_lstat (local_source->filename, &statbuf);
   if (res == -1)
     {
@@ -1771,6 +1782,8 @@ g_local_file_move (GFile                  *source,
     }
   else
     source_is_dir = S_ISDIR (statbuf.st_mode);
+
+  source_size = statbuf.st_size;
   
   destination_exist = FALSE;
   res = g_lstat (local_destination->filename, &statbuf);
@@ -1853,8 +1866,12 @@ g_local_file_move (GFile                  *source,
                     _("Error moving file: %s"),
                     g_strerror (errsv));
       return FALSE;
-
     }
+
+  /* Make sure we send full copied size */
+  if (progress_callback)
+    progress_callback (source_size, source_size, progress_callback_data);
+  
   return TRUE;
 }