[Xfce4-commits] r30346 - in thunar/branches/migration-to-gio: . thunar thunarx

Jannis Pohlmann jannis at xfce.org
Sat Jul 18 18:55:47 CEST 2009


Author: jannis
Date: 2009-07-18 16:55:47 +0000 (Sat, 18 Jul 2009)
New Revision: 30346

Modified:
   thunar/branches/migration-to-gio/ChangeLog
   thunar/branches/migration-to-gio/thunar/thunar-file.c
   thunar/branches/migration-to-gio/thunar/thunar-file.h
   thunar/branches/migration-to-gio/thunarx/thunarx-file-info.h
Log:
	* thunar/thunar-file.{c,h}: Introduce new function
	  thunar_file_same_filesystem() which uses
	  G_FILE_ATTRIBUTE_ID_FILESYSTEM to check whether two files reside on
	  the same device/filesystem. Use this to fix the copy/move decision
	  in thunar_file_accepts_drop().
	* thunarx/thunarx-file-info.h: Add the "id" namespace to
	  THUNARX_FILE_INFO_NAMESPACE.

Modified: thunar/branches/migration-to-gio/ChangeLog
===================================================================
--- thunar/branches/migration-to-gio/ChangeLog	2009-07-18 15:30:19 UTC (rev 30345)
+++ thunar/branches/migration-to-gio/ChangeLog	2009-07-18 16:55:47 UTC (rev 30346)
@@ -1,5 +1,15 @@
 2009-07-18	Jannis Pohlmann <jannis at xfce.org>
 
+	* thunar/thunar-file.{c,h}: Introduce new function
+	  thunar_file_same_filesystem() which uses
+	  G_FILE_ATTRIBUTE_ID_FILESYSTEM to check whether two files reside on
+	  the same device/filesystem. Use this to fix the copy/move decision
+	  in thunar_file_accepts_drop().
+	* thunarx/thunarx-file-info.h: Add the "id" namespace to
+	  THUNARX_FILE_INFO_NAMESPACE.
+
+2009-07-18	Jannis Pohlmann <jannis at xfce.org>
+
 	* thunar/thunar-launcher.c: Make executing files work again. Note that
 	  this only works for one selected file right now. Poking/launching 
 	  multiple files/directories still have to be worked on anyway.

Modified: thunar/branches/migration-to-gio/thunar/thunar-file.c
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-file.c	2009-07-18 15:30:19 UTC (rev 30345)
+++ thunar/branches/migration-to-gio/thunar/thunar-file.c	2009-07-18 16:55:47 UTC (rev 30346)
@@ -329,10 +329,6 @@
   if (file->filesystem_info != NULL)
     g_object_unref (file->filesystem_info);
 
-  /* release the mount */
-  if (file->mount != NULL)
-    g_object_unref (file->mount);
-
   /* free the custom icon name */
   g_free (file->custom_icon_name);
   
@@ -661,7 +657,6 @@
       file = g_object_new (THUNAR_TYPE_FILE, NULL);
       file->gfile = g_object_ref (gfile);
       file->info = NULL;
-      file->mount = NULL;
       file->filesystem_info = NULL;
       file->custom_icon_name = NULL;
       file->display_name = NULL;
@@ -767,13 +762,6 @@
       file->filesystem_info = NULL;
     }
 
-  /* release the current mount */
-  if (file->mount != NULL)
-    {
-      g_object_unref (file->mount);
-      file->mount = NULL;
-    }
-
   /* free the custom icon name */
   g_free (file->custom_icon_name);
 
@@ -817,9 +805,6 @@
                                                         cancellable,
                                                         NULL);
 
-  /* try to detect the corresponding mount */
-  file->mount = g_file_find_enclosing_mount (file->gfile, cancellable, NULL);
-
   /* determine the basename */
   file->basename = g_file_get_basename (file->gfile);
   _thunar_assert (file->basename != NULL);
@@ -1431,7 +1416,7 @@
                * are on the same disk, and the source file is owned by the current user.
                */
               if (ofile == NULL 
-                  || (!g_mount_is_same_drive (ofile->mount, file->mount))
+                  || !thunar_file_same_filesystem (file, ofile)
                   || (ofile->info != NULL 
                       && g_file_info_get_attribute_uint32 (ofile->info, 
                                                            G_FILE_ATTRIBUTE_UNIX_UID) != effective_user_id))
@@ -3139,6 +3124,33 @@
 
 
 
+gboolean
+thunar_file_same_filesystem (const ThunarFile *file_a,
+                             const ThunarFile *file_b)
+{
+  const gchar *filesystem_id_a;
+  const gchar *filesystem_id_b;
+
+  _thunar_return_val_if_fail (THUNAR_IS_FILE (file_a), FALSE);
+  _thunar_return_val_if_fail (THUNAR_IS_FILE (file_b), FALSE);
+
+  /* return false if we have no information about one of the files */
+  if (file_a->info == NULL || file_b->info == NULL)
+    return FALSE;
+
+  /* determine the filesystem IDs */
+  filesystem_id_a = g_file_info_get_attribute_string (file_a->info, 
+                                                      G_FILE_ATTRIBUTE_ID_FILESYSTEM);
+
+  filesystem_id_b = g_file_info_get_attribute_string (file_b->info, 
+                                                      G_FILE_ATTRIBUTE_ID_FILESYSTEM);
+
+  /* compare the filesystem IDs */
+  return exo_str_is_equal (filesystem_id_a, filesystem_id_b);
+}
+
+
+
 /**
  * thunar_file_cache_lookup:
  * @file : a #GFile.

Modified: thunar/branches/migration-to-gio/thunar/thunar-file.h
===================================================================
--- thunar/branches/migration-to-gio/thunar/thunar-file.h	2009-07-18 15:30:19 UTC (rev 30345)
+++ thunar/branches/migration-to-gio/thunar/thunar-file.h	2009-07-18 16:55:47 UTC (rev 30346)
@@ -115,7 +115,6 @@
   GFileMonitor  *monitor;
   GFileInfo     *info;
   GFileInfo     *filesystem_info;
-  GMount        *mount;
   GFile         *gfile;
   gchar         *custom_icon_name;
   gchar         *display_name;
@@ -249,6 +248,9 @@
                                                     const ThunarFile       *file_b,
                                                     gboolean                case_sensitive);
 
+gboolean          thunar_file_same_filesystem      (const ThunarFile       *file_a,
+                                                    const ThunarFile       *file_b);
+
 ThunarFile       *thunar_file_cache_lookup         (const GFile            *file);
 
 

Modified: thunar/branches/migration-to-gio/thunarx/thunarx-file-info.h
===================================================================
--- thunar/branches/migration-to-gio/thunarx/thunarx-file-info.h	2009-07-18 15:30:19 UTC (rev 30345)
+++ thunar/branches/migration-to-gio/thunarx/thunarx-file-info.h	2009-07-18 16:55:47 UTC (rev 30346)
@@ -38,6 +38,7 @@
  **/
 #define THUNARX_FILE_INFO_NAMESPACE \
   "access::*," \
+  "id::*," \
   "mountable::*," \
   "preview::*," \
   "standard::*," \




More information about the Xfce4-commits mailing list