From ce0d51696c154737e66f5c7c03184df9148347a9 Mon Sep 17 00:00:00 2001
From: Benedikt Meurer <benny@xfce.org>
Date: Fri, 24 Feb 2006 19:05:53 +0000
Subject: [PATCH] 2006-02-24	Benedikt Meurer <benny@xfce.org>

	* thunar-vfs/thunar-vfs-volume-hal.c(thunar_vfs_volume_hal_update): All
	  volumes provided by USB devices are now marked as removable.
	* thunar/thunar-shortcuts-model.c(thunar_shortcuts_model_iter_for_file):
	  Also check volumes here.




(Old svn revision: 20033)
---
 ChangeLog                          |  7 +++++++
 thunar-vfs/thunar-vfs-volume-hal.c | 14 ++++++--------
 thunar/thunar-shortcuts-model.c    | 31 +++++++++++++++++++++++-------
 3 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3ef0850f3..81967467a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-02-24	Benedikt Meurer <benny@xfce.org>
+
+	* thunar-vfs/thunar-vfs-volume-hal.c(thunar_vfs_volume_hal_update): All
+	  volumes provided by USB devices are now marked as removable.
+	* thunar/thunar-shortcuts-model.c(thunar_shortcuts_model_iter_for_file):
+	  Also check volumes here.
+
 2006-02-24	Benedikt Meurer <benny@xfce.org>
 
 	* thunar-uca/thunar-uca-chooser.c: Fix two typos that already survived
diff --git a/thunar-vfs/thunar-vfs-volume-hal.c b/thunar-vfs/thunar-vfs-volume-hal.c
index 789504b06..2047c1d37 100644
--- a/thunar-vfs/thunar-vfs-volume-hal.c
+++ b/thunar-vfs/thunar-vfs-volume-hal.c
@@ -627,20 +627,18 @@ thunar_vfs_volume_hal_update (ThunarVfsVolumeHal *volume_hal,
       volume_hal->kind = THUNAR_VFS_VOLUME_KIND_AUDIO_PLAYER;
       break;
 
-    case LIBHAL_DRIVE_TYPE_MEMORY_STICK:
-    case LIBHAL_DRIVE_TYPE_REMOVABLE_DISK:
+    default:
       /* check if the drive is connected to the USB bus */
       if (libhal_drive_get_bus (hd) == LIBHAL_DRIVE_BUS_USB)
         {
           /* we consider the drive to be an USB stick */
           volume_hal->kind = THUNAR_VFS_VOLUME_KIND_USBSTICK;
-          break;
         }
-      /* FALL-THROUGH */
-
-    default:
-      /* fallback to harddisk drive */
-      volume_hal->kind = THUNAR_VFS_VOLUME_KIND_HARDDISK;
+      else
+        {
+          /* fallback to harddisk drive */
+          volume_hal->kind = THUNAR_VFS_VOLUME_KIND_HARDDISK;
+        }
       break;
     }
 
diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c
index 2691df012..6535f8428 100644
--- a/thunar/thunar-shortcuts-model.c
+++ b/thunar/thunar-shortcuts-model.c
@@ -1249,19 +1249,36 @@ thunar_shortcuts_model_iter_for_file (ThunarShortcutsModel *model,
                                       ThunarFile           *file,
                                       GtkTreeIter          *iter)
 {
-  GList *lp;
+  ThunarVfsPath *mount_point;
+  GList         *lp;
   
   g_return_val_if_fail (THUNAR_IS_SHORTCUTS_MODEL (model), FALSE);
   g_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
   g_return_val_if_fail (iter != NULL, FALSE);
 
   for (lp = model->shortcuts; lp != NULL; lp = lp->next)
-    if (THUNAR_SHORTCUT (lp->data)->file == file)
-      {
-        iter->stamp = model->stamp;
-        iter->user_data = lp;
-        return TRUE;
-      }
+    {
+      /* check if we have a file that matches */
+      if (THUNAR_SHORTCUT (lp->data)->file == file)
+        {
+          iter->stamp = model->stamp;
+          iter->user_data = lp;
+          return TRUE;
+        }
+
+      /* but maybe we have a mounted(!) volume with a matching mount point */
+      if (THUNAR_SHORTCUT (lp->data)->volume != NULL && thunar_vfs_volume_is_mounted (THUNAR_SHORTCUT (lp->data)->volume))
+        {
+          /* check if we have a mount point for the volume */
+          mount_point = thunar_vfs_volume_get_mount_point (THUNAR_SHORTCUT (lp->data)->volume);
+          if (G_LIKELY (mount_point != NULL && thunar_vfs_path_equal (mount_point, thunar_file_get_path (file))))
+            {
+              iter->stamp = model->stamp;
+              iter->user_data = lp;
+              return TRUE;
+            }
+        }
+    }
 
   return FALSE;
 }
-- 
GitLab