Bug 537546 – 'desktop' shortcut in file chooser looks like a generic
authorMatthias Clasen <matthiasc@src.gnome.org>
Tue, 10 Jun 2008 16:56:25 +0000 (16:56 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 10 Jun 2008 16:56:25 +0000 (16:56 +0000)
        folder

        * glocalfileinfo.c (_g_local_file_info_get): Return user-desktop
        as icon for the desktop directory, also make user-home and
        user-desktop the preferred icons.

svn path=/trunk/; revision=6992

gio/ChangeLog
gio/glocalfileinfo.c

index 68ab141c3eb63e7a4d418bb5147b8b3afbef8a76..7c806c60b61f8ae75f982ab75e1f9d6bf2bdbd79 100644 (file)
@@ -1,3 +1,12 @@
+2008-06-10  Matthias Clasen <mclasen@redhat.com>
+
+       Bug 537546 – 'desktop' shortcut in file chooser looks like a generic
+       folder
+       
+       * glocalfileinfo.c (_g_local_file_info_get): Return user-desktop
+       as icon for the desktop directory, also make user-home and
+       user-desktop the preferred icons.
+
 2008-06-10  Matthias Clasen <mclasen@redhat.com>
 
        * gio.symbols:
index b691764a868f96c64153cd46707cce6e8193a0ac..fb94f81c4f186f4ecb50f5fe1a9dd417f2e2c847 100644 (file)
@@ -1570,19 +1570,24 @@ _g_local_file_info_get (const char             *basename,
                 {
                   if (G_IS_THEMED_ICON (icon))
                     {
-                      const char *type_icon;
+                      const char *preferred_icon = NULL;
+                      const char *type_icon = NULL;
 
-                      /* TODO: Special case desktop dir? That could be expensive with xdg dirs... */
                       if (strcmp (path, g_get_home_dir ()) == 0)
-                        type_icon = "user-home";
-                      else if (S_ISDIR (statbuf.st_mode)) 
+                        preferred_icon = "user-home";
+                      else if (strcmp (path, g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) == 0) 
+                        preferred_icon = "user-desktop";
+                      if (S_ISDIR (statbuf.st_mode)) 
                         type_icon = "folder";
                       else if (statbuf.st_mode & S_IXUSR)
                         type_icon = "application-x-executable";
                       else
                         type_icon = "text-x-generic";
 
-                      g_themed_icon_append_name (G_THEMED_ICON (icon), type_icon);
+                      if (preferred_icon)
+                        g_themed_icon_prepend_name (G_THEMED_ICON (icon), preferred_icon);
+                      if (type_icon) 
+                        g_themed_icon_append_name (G_THEMED_ICON (icon), type_icon);
                     }
 
                   g_file_info_set_icon (info, icon);