Jasper Huijsmans wrote:
>>You're the boss, boss. But I'd argue that it ought to be there,
>>because not having it creates the aforementioned problem with the file
>>selector, and is inconsistent. Sure, it's Gtk pressing out hand on the
>>issue, and Firefox makes it worse by defaulting to saving downloads
>>there.
>>
>>It's consistent, and it cuts down on wasted bookmark space in the file
>>selector, where the space really matters. I felt Gtk+ should never
>>have included it in the first place, but there you go.
>>
>>If you still disagree, I'm done making my case ;-)
> 
> FWLIW, I agree with Erik. I'm fine with it either way, though, so maybe 
> I should have kept quite ... oops, too late ;)

Something like this?

> cheers,
>       Jasper

Benedikt
Index: thunar/thunar-shortcuts-model.c
===================================================================
--- thunar/thunar-shortcuts-model.c	(revision 22696)
+++ thunar/thunar-shortcuts-model.c	(working copy)
@@ -248,7 +248,7 @@
 {
   ThunarVfsVolume *volume;
   ThunarShortcut  *shortcut;
-  ThunarVfsPath   *system_path_list[3] = { thunar_vfs_path_get_for_home (), thunar_vfs_path_get_for_trash (), thunar_vfs_path_get_for_root () };
+  ThunarVfsPath   *system_path_list[4];
   ThunarVfsPath   *fhome;
   ThunarVfsPath   *fpath;
   GtkTreePath     *path;
@@ -264,6 +264,12 @@
   g_signal_connect (G_OBJECT (model->volume_manager), "volumes-added", G_CALLBACK (thunar_shortcuts_model_volumes_added), model);
   g_signal_connect (G_OBJECT (model->volume_manager), "volumes-removed", G_CALLBACK (thunar_shortcuts_model_volumes_removed), model);
 
+  /* determine the system-defined paths */
+  system_path_list[0] = thunar_vfs_path_get_for_home ();
+  system_path_list[1] = thunar_vfs_path_get_for_trash ();
+  system_path_list[2] = thunar_vfs_path_relative (system_path_list[0], "Desktop");
+  system_path_list[3] = thunar_vfs_path_get_for_root ();
+
   /* will be used to append the shortcuts to the list */
   path = gtk_tree_path_new_from_indices (0, -1);
 
Index: thunar/thunar-file.c
===================================================================
--- thunar/thunar-file.c	(revision 22696)
+++ thunar/thunar-file.c	(working copy)
@@ -1481,7 +1481,6 @@
 thunar_file_get_emblem_names (ThunarFile *file)
 {
   const ThunarVfsInfo *info = file->info;
-  const ThunarVfsPath *parent;
   const gchar         *emblem_string;
   gchar              **emblem_names;
   GList               *emblems = NULL;
@@ -1509,13 +1508,6 @@
         emblems = g_list_append (emblems, *emblem_names);
     }
 
-  if (G_UNLIKELY (strcmp (info->display_name, "Desktop") == 0))
-    {
-      parent = thunar_vfs_path_get_parent (info->path);
-      if (G_LIKELY (parent != NULL) && thunar_vfs_path_is_home (parent))
-        emblems = g_list_prepend (emblems, THUNAR_FILE_EMBLEM_NAME_DESKTOP);
-    }
-
   if ((info->flags & THUNAR_VFS_FILE_FLAGS_SYMLINK) != 0)
     emblems = g_list_prepend (emblems, THUNAR_FILE_EMBLEM_NAME_SYMBOLIC_LINK);
 
@@ -1623,6 +1615,13 @@
       return "gnome-fs-home";
     }
 
+  /* special icon for the desktop node */
+  if (G_UNLIKELY (thunar_file_is_desktop (file))
+      && gtk_icon_theme_has_icon (icon_theme, "gnome-fs-desktop"))
+   {
+     return "gnome-fs-desktop";
+   }
+
   /* try to be smart when determining icons for executable files
    * in that we use the name of the file as icon name (which will
    * work for quite a lot of binaries, e.g. 'Terminal', 'mousepad',
Index: thunar/thunar-file.h
===================================================================
--- thunar/thunar-file.h	(revision 22696)
+++ thunar/thunar-file.h	(working copy)
@@ -443,6 +443,18 @@
 #define thunar_file_is_home(file) (thunar_vfs_path_is_home (THUNAR_FILE ((file))->info->path))
 
 /**
+ * thunar_file_is_desktop:
+ * @file : a #ThunarFile.
+ *
+ * Checks whether @file refers to the users desktop directory.
+ *
+ * Return value: %TRUE if @file is the users desktop directory.
+ **/
+#define thunar_file_is_desktop(file) (!thunar_vfs_path_is_root (thunar_file_get_path (file)) \
+                                   && thunar_vfs_path_is_home (thunar_vfs_path_get_parent (thunar_file_get_path (file))) \
+                                   && strcmp (thunar_file_get_display_name (file), "Desktop") == 0)
+
+/**
  * thunar_file_is_regular:
  * @file : a #ThunarFile.
  *
Index: thunar/thunar-location-buttons.c
===================================================================
--- thunar/thunar-location-buttons.c	(revision 22696)
+++ thunar/thunar-location-buttons.c	(working copy)
@@ -24,6 +24,13 @@
 #include <config.h>
 #endif
 
+#ifdef HAVE_MEMORY_H
+#include <memory.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
 #include <thunar/thunar-application.h>
 #include <thunar/thunar-clipboard-manager.h>
 #include <thunar/thunar-create-dialog.h>
@@ -546,8 +553,8 @@
               gtk_container_add (GTK_CONTAINER (buttons), button);
               gtk_widget_show (button);
 
-              /* we use 'Home' as possible root, as well as real root nodes */
-              if (!thunar_file_is_home (file) && !thunar_file_is_root (file))
+              /* we use 'Home' and 'Desktop' as possible roots, as well as real root nodes */
+              if (!thunar_file_is_desktop (file) && !thunar_file_is_home (file) && !thunar_file_is_root (file))
                 file_parent = thunar_file_get_parent (file, NULL);
               else 
                 file_parent = NULL;
_______________________________________________
Thunar-dev mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/thunar-dev

Reply via email to