[gvfs] udisks2: add support for mount option x-gvfs-symbolic-icon



commit bb4e7ed0236855d2ced7cfd4445877822da8fe7b
Author: David Zeuthen <zeuthen gmail com>
Date:   Wed Dec 5 18:51:37 2012 -0500

    udisks2: add support for mount option x-gvfs-symbolic-icon
    
    ... and also the new Block:HintSymbolicIcon icon just added to udisks
    master.
    
    Signed-off-by: David Zeuthen <zeuthen gmail com>

 monitor/udisks2/gvfsudisks2volume.c |   19 ++++++++++++++++++-
 monitor/udisks2/what-is-shown.txt   |   18 +++++++++++-------
 2 files changed, 29 insertions(+), 8 deletions(-)
---
diff --git a/monitor/udisks2/gvfsudisks2volume.c b/monitor/udisks2/gvfsudisks2volume.c
index 7bb816c..0266b5c 100644
--- a/monitor/udisks2/gvfsudisks2volume.c
+++ b/monitor/udisks2/gvfsudisks2volume.c
@@ -165,6 +165,7 @@ apply_options_from_fstab (GVfsUDisks2Volume *volume,
 {
   gchar *name;
   gchar *icon_name;
+  gchar *symbolic_icon_name;
 
   name = gvfs_udisks2_utils_lookup_fstab_options_value (fstab_options, "x-gvfs-name=");
   if (name != NULL)
@@ -180,6 +181,14 @@ apply_options_from_fstab (GVfsUDisks2Volume *volume,
       volume->icon = g_themed_icon_new_with_default_fallbacks (icon_name);
       g_free (icon_name);
     }
+
+  symbolic_icon_name = gvfs_udisks2_utils_lookup_fstab_options_value (fstab_options, "x-gvfs-symbolic-icon=");
+  if (symbolic_icon_name != NULL)
+    {
+      g_clear_object (&volume->symbolic_icon);
+      volume->symbolic_icon = g_themed_icon_new_with_default_fallbacks (symbolic_icon_name);
+      g_free (symbolic_icon_name);
+    }
 }
 
 
@@ -446,8 +455,16 @@ update_volume (GVfsUDisks2Volume *volume)
           g_clear_object (&volume->icon);
           volume->icon = g_themed_icon_new_with_default_fallbacks (hint);
         }
+#if UDISKS_CHECK_VERSION(2,0,90)
+      hint = udisks_block_get_hint_symbolic_icon_name (volume->block);
+      if (hint != NULL && strlen (hint) > 0)
+        {
+          g_clear_object (&volume->symbolic_icon);
+          volume->symbolic_icon = g_themed_icon_new_with_default_fallbacks (hint);
+        }
+#endif
 
-      /* Use x-gvfs-name=The%20Name and x-gvfs-icon=foo-name, if available */
+      /* Use x-gvfs-name=The%20Name, x-gvfs-icon=foo-name, x-gvfs-icon=foo-name-symbolic, if available */
       g_variant_iter_init (&iter, udisks_block_get_configuration (block));
       while (g_variant_iter_next (&iter, "(&s a{sv})", &configuration_type, &configuration_value))
         {
diff --git a/monitor/udisks2/what-is-shown.txt b/monitor/udisks2/what-is-shown.txt
index 8d0b0fe..27d170b 100644
--- a/monitor/udisks2/what-is-shown.txt
+++ b/monitor/udisks2/what-is-shown.txt
@@ -26,12 +26,13 @@ in its directory starts with a dot ("."), the device is not shown
 either. This policy may be overriden by use of the options x-gvfs-show
 and x-gvfs-hide.
 
-The name and icon to use for a device is chosen according to certain
-heuristics - for example, if a device has a filesystem label, it is
-used - if not, some other characteristic is used. The options
-x-gvfs-name=<value> and x-gvfs-icon=<value> can be used to override
-this policy with <value> being an URL-encoded string. For icons, the
-Icon Naming Specification is used.
+The name, icon and symbolic icon to use for a device is chosen
+according to certain heuristics - for example, if a device has a
+filesystem label, it is used - if not, some other characteristic is
+used. The options x-gvfs-name=<value>, x-gvfs-icon=<value> and
+x-gvfs-symbolic-icon=<value> can be used to override this policy with
+<value> being an URL-encoded string. For icons, the Icon Naming
+Specification is used.
 
 Users are advised to use (stable) symlinks in the /dev/disk/ hierarchy
 for /etc/fstab entries instead of the kernel names sda, sdb and so
@@ -55,6 +56,9 @@ EXAMPLES
 # forcibly show device in user interface and with name "My Movies"
 /dev/disk/by-uuid/4CAE8E5B5AF47502   /Movies  auto   defaults,x-gvfs-show,x-gvfs-name=My%20Movies  0 0
 
+# the same, but also with custom icons
+/dev/disk/by-uuid/4CAE8E5B5AF47502   /Movies  auto   defaults,x-gvfs-show,x-gvfs-name=My%20Movies,x-gvfs-icon=folder-videos,x-gvfs-symbolic-icon=folder-videos-symbolic  0 0
+
 # forcibly show NFS mount in user interface
 10.200.0.210:/tank/media  /mnt/Filer  nfs4  default,users,noauto,x-gvfs-show  0 0
 
@@ -76,7 +80,7 @@ SUBSYSTEMS=="usb", ENV{ID_VENDOR}=="*Kingston*", ENV{ID_MODEL}=="*DataTraveler*"
 ENV{ID_SERIAL}=="WDC_WD1002FAEX-00Y9A0_WD-WCAW30039835", ENV{UDISKS_AUTO}="1", ENV{UDISKS_SYSTEM}="0"
 
 # Specify name and icon name for a specific device.
-ENV{ID_MEDIA_PLAYER}=="apple-ipod", ENV{UDISKS_NAME}="David's iPod", ENV{UDISKS_ICON_NAME}="multimedia-player-ipod"
+ENV{ID_MEDIA_PLAYER}=="apple-ipod", ENV{UDISKS_NAME}="David's iPod", ENV{UDISKS_ICON_NAME}="multimedia-player-ipod", ENV{UDISKS_SYMBOLIC_ICON_NAME}="multimedia-player-ipod-symbolic"
 
 # Make sure this specific hard disk does not appear in the user interface
 ENV{ID_SERIAL}=="HITACHI_HTS723232A7A364_E3834563KRG2HN", ENV{UDISKS_IGNORE}="1"



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