[gvfs] udisks2: fix symbolic icons for devices without an UDisksDrive



commit 56a11c77e5bbefcbb490e7e39a3f724f7f207509
Author: David Zeuthen <zeuthen gmail com>
Date:   Wed Nov 28 13:21:20 2012 -0500

    udisks2: fix symbolic icons for devices without an UDisksDrive
    
    We were returning folder-remote-symbolic which is incorrect since that
    should only be used for network filesystems.
    
    Signed-off-by: David Zeuthen <zeuthen gmail com>

 monitor/udisks2/gvfsudisks2mount.c  |    2 +-
 monitor/udisks2/gvfsudisks2utils.c  |   17 +++++++++++++++++
 monitor/udisks2/gvfsudisks2utils.h  |    1 +
 monitor/udisks2/gvfsudisks2volume.c |    4 +++-
 4 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/monitor/udisks2/gvfsudisks2mount.c b/monitor/udisks2/gvfsudisks2mount.c
index cb888c2..0889cc7 100644
--- a/monitor/udisks2/gvfsudisks2mount.c
+++ b/monitor/udisks2/gvfsudisks2mount.c
@@ -268,7 +268,7 @@ update_mount (GVfsUDisks2Mount *mount)
       else
         mount->name = g_strdup (mount->mount_entry_name);
 
-      mount->symbolic_icon = g_themed_icon_new ("folder-remote-symbolic");
+      mount->symbolic_icon = gvfs_udisks2_utils_symbolic_icon_from_fs_type (g_unix_mount_get_fs_type (mount->mount_entry));
     }
 
   /* compute whether something changed */
diff --git a/monitor/udisks2/gvfsudisks2utils.c b/monitor/udisks2/gvfsudisks2utils.c
index c969dab..9e35455 100644
--- a/monitor/udisks2/gvfsudisks2utils.c
+++ b/monitor/udisks2/gvfsudisks2utils.c
@@ -82,6 +82,23 @@ gvfs_udisks2_utils_icon_from_fs_type (const gchar *fs_type)
   return g_themed_icon_new_with_default_fallbacks (icon_name);
 }
 
+GIcon *
+gvfs_udisks2_utils_symbolic_icon_from_fs_type (const gchar *fs_type)
+{
+  const gchar *icon_name;
+  if (g_strcmp0 (fs_type, "nfs") == 0 ||
+      g_strcmp0 (fs_type, "nfs4") == 0 ||
+      g_strcmp0 (fs_type, "cifs") == 0)
+    {
+      icon_name = "folder-remote-symbolic";
+    }
+  else
+    {
+      icon_name = "drive-removable-media-symbolic";
+    }
+  return g_themed_icon_new_with_default_fallbacks (icon_name);
+}
+
 gchar *
 gvfs_udisks2_utils_lookup_fstab_options_value (const gchar *fstab_options,
                                                const gchar *key)
diff --git a/monitor/udisks2/gvfsudisks2utils.h b/monitor/udisks2/gvfsudisks2utils.h
index 50c9963..ac85a22 100644
--- a/monitor/udisks2/gvfsudisks2utils.h
+++ b/monitor/udisks2/gvfsudisks2utils.h
@@ -33,6 +33,7 @@ G_BEGIN_DECLS
 
 void   gvfs_udisks2_utils_udisks_error_to_gio_error (GError *error);
 GIcon *gvfs_udisks2_utils_icon_from_fs_type (const gchar *fs_type);
+GIcon *gvfs_udisks2_utils_symbolic_icon_from_fs_type (const gchar *fs_type);
 
 gchar *gvfs_udisks2_utils_lookup_fstab_options_value (const gchar *fstab_options,
                                                       const gchar *key);
diff --git a/monitor/udisks2/gvfsudisks2volume.c b/monitor/udisks2/gvfsudisks2volume.c
index 8502266..af62321 100644
--- a/monitor/udisks2/gvfsudisks2volume.c
+++ b/monitor/udisks2/gvfsudisks2volume.c
@@ -471,6 +471,8 @@ update_volume (GVfsUDisks2Volume *volume)
         volume->name = g_unix_mount_point_guess_name (volume->mount_point);
       if (volume->icon == NULL)
         volume->icon = gvfs_udisks2_utils_icon_from_fs_type (g_unix_mount_point_get_fs_type (volume->mount_point));
+      if (volume->symbolic_icon == NULL)
+        volume->symbolic_icon = gvfs_udisks2_utils_symbolic_icon_from_fs_type (g_unix_mount_point_get_fs_type (volume->mount_point));
     }
 
   if (volume->mount == NULL)
@@ -487,7 +489,7 @@ update_volume (GVfsUDisks2Volume *volume)
   if (volume->icon == NULL)
     volume->icon = g_themed_icon_new ("drive-removable-media");
   if (volume->symbolic_icon == NULL)
-    volume->symbolic_icon = g_themed_icon_new ("folder-remote-symbolic");
+    volume->symbolic_icon = g_themed_icon_new ("drive-removable-media-symbolic");
 
   /* ---------------------------------------------------------------------------------------------------- */
   /* compute whether something changed */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]