[Xfce4-commits] <thunar:master> Port the remains to ThunarDevice.

Nick Schermer noreply at xfce.org
Sat Oct 13 16:12:21 CEST 2012


Updating branch refs/heads/master
         to 06120820fe2e79cd909706cdda9536e1cddcdbde (commit)
       from 3dee1594752e97e7958abbfb029ce59ce026fe8f (commit)

commit 06120820fe2e79cd909706cdda9536e1cddcdbde
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Oct 7 02:07:50 2012 +0200

    Port the remains to ThunarDevice.

 thunar/thunar-browser.c        |  120 ++++++++++++++++--------------------
 thunar/thunar-browser.h        |   11 ++--
 thunar/thunar-device-monitor.c |   80 +++++++++++++++++++-----
 thunar/thunar-gio-extensions.c |  132 ----------------------------------------
 thunar/thunar-gio-extensions.h |    3 -
 thunar/thunar-launcher.c       |  126 +++++++++++++++++---------------------
 thunar/thunar-shortcuts-view.c |   57 +++++++++---------
 thunar/thunar-tree-model.c     |   33 ++++------
 thunar/thunar-window.c         |   33 +++++-----
 9 files changed, 237 insertions(+), 358 deletions(-)

diff --git a/thunar/thunar-browser.c b/thunar/thunar-browser.c
index cd0c29d..a608518 100644
--- a/thunar/thunar-browser.c
+++ b/thunar/thunar-browser.c
@@ -32,7 +32,7 @@
 
 
 typedef struct _PokeFileData   PokeFileData;
-typedef struct _PokeVolumeData PokeVolumeData;
+typedef struct _PokeDeviceData PokeDeviceData;
 
 
 
@@ -58,12 +58,12 @@ struct _PokeFileData
   gpointer                      user_data;
 };
 
-struct _PokeVolumeData
+struct _PokeDeviceData
 {
   ThunarBrowser              *browser;
-  GVolume                    *volume;
+  ThunarDevice               *device;
   ThunarFile                 *mount_point;
-  ThunarBrowserPokeVolumeFunc func;
+  ThunarBrowserPokeDeviceFunc func;
   gpointer                    user_data;
 };
 
@@ -150,20 +150,20 @@ thunar_browser_poke_file_data_free (PokeFileData *poke_data)
 
 
 
-static PokeVolumeData *
-thunar_browser_poke_volume_data_new (ThunarBrowser              *browser,
-                                     GVolume                    *volume,
-                                     ThunarBrowserPokeVolumeFunc func,
+static PokeDeviceData *
+thunar_browser_poke_device_data_new (ThunarBrowser              *browser,
+                                     ThunarDevice               *device,
+                                     ThunarBrowserPokeDeviceFunc func,
                                      gpointer                    user_data)
 {
-  PokeVolumeData *poke_data;
+  PokeDeviceData *poke_data;
 
   _thunar_return_val_if_fail (THUNAR_IS_BROWSER (browser), NULL);
-  _thunar_return_val_if_fail (G_IS_VOLUME (volume), NULL);
+  _thunar_return_val_if_fail (THUNAR_IS_DEVICE (device), NULL);
 
-  poke_data = g_slice_new0 (PokeVolumeData);
+  poke_data = g_slice_new0 (PokeDeviceData);
   poke_data->browser = g_object_ref (browser);
-  poke_data->volume = g_object_ref (volume);
+  poke_data->device = g_object_ref (device);
   poke_data->func = func;
   poke_data->user_data = user_data;
 
@@ -173,16 +173,16 @@ thunar_browser_poke_volume_data_new (ThunarBrowser              *browser,
 
 
 static void
-thunar_browser_poke_volume_data_free (PokeVolumeData *poke_data)
+thunar_browser_poke_device_data_free (PokeDeviceData *poke_data)
 {
   _thunar_return_if_fail (poke_data != NULL);
   _thunar_return_if_fail (THUNAR_IS_BROWSER (poke_data->browser));
-  _thunar_return_if_fail (G_IS_VOLUME (poke_data->volume));
+  _thunar_return_if_fail (THUNAR_IS_DEVICE (poke_data->device));
 
   g_object_unref (poke_data->browser);
-  g_object_unref (poke_data->volume);
+  g_object_unref (poke_data->device);
 
-  g_slice_free (PokeVolumeData, poke_data);
+  g_slice_free (PokeDeviceData, poke_data);
 }
 
 
@@ -549,137 +549,123 @@ thunar_browser_poke_file (ThunarBrowser            *browser,
 
 
 static void
-thunar_browser_poke_volume_file_finish (GFile      *location,
+thunar_browser_poke_device_file_finish (GFile      *location,
                                         ThunarFile *file,
                                         GError     *error,
                                         gpointer    user_data)
 {
-  PokeVolumeData *poke_data = user_data;
+  PokeDeviceData *poke_data = user_data;
 
   _thunar_return_if_fail (G_IS_FILE (location));
   _thunar_return_if_fail (user_data != NULL);
   _thunar_return_if_fail (THUNAR_IS_BROWSER (poke_data->browser));
-  _thunar_return_if_fail (G_IS_VOLUME (poke_data->volume));
+  _thunar_return_if_fail (THUNAR_IS_DEVICE (poke_data->device));
 
   if (poke_data->func != NULL)
     {
-      (poke_data->func) (poke_data->browser, poke_data->volume, file, error,
+      (poke_data->func) (poke_data->browser, poke_data->device, file, error,
                          poke_data->user_data);
     }
 
-  thunar_browser_poke_volume_data_free (poke_data);
+  thunar_browser_poke_device_data_free (poke_data);
 }
 
 
 
 static void
-thunar_browser_poke_volume_finish (GObject      *object,
-                                   GAsyncResult *result,
+thunar_browser_poke_device_finish (ThunarDevice *device,
+                                   const GError *error,
                                    gpointer      user_data)
 {
-  PokeVolumeData *poke_data = user_data;
-  GError         *error = NULL;
-  GMount         *mount;
+  PokeDeviceData *poke_data = user_data;
   GFile          *mount_point;
 
-  _thunar_return_if_fail (G_IS_VOLUME (object));
-  _thunar_return_if_fail (G_IS_ASYNC_RESULT (result));
+  _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
   _thunar_return_if_fail (user_data != NULL);
   _thunar_return_if_fail (THUNAR_IS_BROWSER (poke_data->browser));
-  _thunar_return_if_fail (G_IS_VOLUME (poke_data->volume));
-  _thunar_return_if_fail (G_VOLUME (object) == poke_data->volume);
-
-  if (!g_volume_mount_finish (G_VOLUME (object), result, &error))
-    {
-      if (error->domain == G_IO_ERROR)
-        {
-          if (error->code == G_IO_ERROR_ALREADY_MOUNTED)
-            g_clear_error (&error);
-        }
-    }
+  _thunar_return_if_fail (THUNAR_IS_DEVICE (poke_data->device));
+  _thunar_return_if_fail (device == poke_data->device);
 
   if (error == NULL)
     {
-      mount = g_volume_get_mount (poke_data->volume);
-      mount_point = g_mount_get_root (mount);
+      mount_point = thunar_device_get_root (device);
 
       /* resolve the ThunarFile for the mount point asynchronously
        * and defer cleaning up the poke data until that has finished */
       thunar_file_get_async (mount_point, NULL,
-                             thunar_browser_poke_volume_file_finish,
+                             thunar_browser_poke_device_file_finish,
                              poke_data);
 
       g_object_unref (mount_point);
-      g_object_unref (mount);
     }
   else
     {
       if (poke_data->func != NULL)
         {
-          (poke_data->func) (poke_data->browser, poke_data->volume, NULL, error,
+          (poke_data->func) (poke_data->browser, poke_data->device, NULL, (GError *) error,
                              poke_data->user_data);
         }
 
-      thunar_browser_poke_volume_data_free (poke_data);
+      thunar_browser_poke_device_data_free (poke_data);
     }
 }
 
 
 
 /**
- * thunar_browser_poke_volume:
+ * thunar_browser_poke_device:
  * @browser   : a #ThunarBrowser.
- * @volume    : a #GVolume.
+ * @device    : a #ThunarDevice.
  * @widget    : a #GtkWidget, a #GdkScreen or %NULL.
- * @func      : a #ThunarBrowserPokeVolumeFunc callback or %NULL.
+ * @func      : a #ThunarBrowserPokeDeviceFunc callback or %NULL.
  * @user_data : pointer to arbitrary user data or %NULL.
  *
- * This function checks if @volume is mounted or not. If it is, it loads
+ * This function checks if @device is mounted or not. If it is, it loads
  * a #ThunarFile for the mount root and calls @func. If it is not mounted,
- * it first mounts the volume asynchronously and calls @func with the
+ * it first mounts the device asynchronously and calls @func with the
  * #ThunarFile corresponding to the mount root when the mounting is finished.
  *
  * The #ThunarFile passed to @func will be %NULL if, and only if mounting
- * the @volume failed. The #GError passed to @func will be set if, and only if
+ * the @device failed. The #GError passed to @func will be set if, and only if
  * mounting failed.
  **/
 void
-thunar_browser_poke_volume (ThunarBrowser              *browser,
-                            GVolume                    *volume,
+thunar_browser_poke_device (ThunarBrowser              *browser,
+                            ThunarDevice               *device,
                             gpointer                    widget,
-                            ThunarBrowserPokeVolumeFunc func,
+                            ThunarBrowserPokeDeviceFunc func,
                             gpointer                    user_data)
 {
   GMountOperation *mount_operation;
-  PokeVolumeData  *poke_data;
-  GMount          *mount;
+  PokeDeviceData  *poke_data;
   GFile           *mount_point;
 
   _thunar_return_if_fail (THUNAR_IS_BROWSER (browser));
-  _thunar_return_if_fail (G_IS_VOLUME (volume));
+  _thunar_return_if_fail (THUNAR_DEVICE (device));
 
-  if (thunar_g_volume_is_mounted (volume))
+  if (thunar_device_is_mounted (device))
     {
-      mount = g_volume_get_mount (volume);
-      mount_point = g_mount_get_root (mount);
+      mount_point = thunar_device_get_root (device);
 
-      poke_data = thunar_browser_poke_volume_data_new (browser, volume, func, user_data);
+      poke_data = thunar_browser_poke_device_data_new (browser, device, func, user_data);
 
       thunar_file_get_async (mount_point, NULL,
-                             thunar_browser_poke_volume_file_finish,
+                             thunar_browser_poke_device_file_finish,
                              poke_data);
 
       g_object_unref (mount_point);
-      g_object_unref (mount);
     }
   else
     {
-      poke_data = thunar_browser_poke_volume_data_new (browser, volume, func, user_data);
+      poke_data = thunar_browser_poke_device_data_new (browser, device, func, user_data);
 
       mount_operation = thunar_browser_mount_operation_new (widget);
 
-      g_volume_mount (volume, G_MOUNT_MOUNT_NONE, mount_operation, NULL,
-                      thunar_browser_poke_volume_finish, poke_data);
+      thunar_device_mount (device,
+                           mount_operation,
+                           NULL,
+                           thunar_browser_poke_device_finish,
+                           poke_data);
 
       g_object_unref (mount_operation);
     }
@@ -730,7 +716,7 @@ thunar_browser_poke_location_file_finish (GFile      *location,
  * @browser   : a #ThunarBrowser.
  * @location  : a #GFile.
  * @widget    : a #GtkWidget, a #GdkScreen or %NULL.
- * @func      : a #ThunarBrowserPokeVolumeFunc callback or %NULL.
+ * @func      : a #ThunarBrowserPokeDeviceFunc callback or %NULL.
  * @user_data : pointer to arbitrary user data or %NULL.
  *
  * Pokes a #GFile to see what's behind it.
diff --git a/thunar/thunar-browser.h b/thunar/thunar-browser.h
index f0ebce9..78e8607 100644
--- a/thunar/thunar-browser.h
+++ b/thunar/thunar-browser.h
@@ -22,6 +22,7 @@
 #define __THUNAR_BROWSER_H__
 
 #include <thunar/thunar-file.h>
+#include <thunar/thunar-device.h>
 
 G_BEGIN_DECLS
 
@@ -39,8 +40,8 @@ typedef void (*ThunarBrowserPokeFileFunc)     (ThunarBrowser *browser,
                                                GError        *error,
                                                gpointer       user_data);
 
-typedef void (*ThunarBrowserPokeVolumeFunc)   (ThunarBrowser *browser,
-                                               GVolume       *volume,
+typedef void (*ThunarBrowserPokeDeviceFunc)   (ThunarBrowser *browser,
+                                               ThunarDevice  *volume,
                                                ThunarFile    *mount_point,
                                                GError        *error,
                                                gpointer       user_data);
@@ -68,10 +69,10 @@ void  thunar_browser_poke_file     (ThunarBrowser                 *browser,
                                     gpointer                       widget,
                                     ThunarBrowserPokeFileFunc      func,
                                     gpointer                       user_data);
-void  thunar_browser_poke_volume   (ThunarBrowser                 *browser,
-                                    GVolume                       *volume,
+void  thunar_browser_poke_device   (ThunarBrowser                 *browser,
+                                    ThunarDevice                  *device,
                                     gpointer                       widget,
-                                    ThunarBrowserPokeVolumeFunc    func,
+                                    ThunarBrowserPokeDeviceFunc    func,
                                     gpointer                       user_data);
 void  thunar_browser_poke_location (ThunarBrowser                 *browser,
                                     GFile                         *location,
diff --git a/thunar/thunar-device-monitor.c b/thunar/thunar-device-monitor.c
index c70ff7a..284c7f8 100644
--- a/thunar/thunar-device-monitor.c
+++ b/thunar/thunar-device-monitor.c
@@ -37,6 +37,7 @@ enum
   DEVICE_ADDED,
   DEVICE_REMOVED,
   DEVICE_CHANGED,
+  DEVICE_PRE_UNMOUNT,
   LAST_SIGNAL
 };
 
@@ -61,6 +62,9 @@ static void           thunar_device_monitor_mount_removed          (GVolumeMonit
 static void           thunar_device_monitor_mount_changed          (GVolumeMonitor         *volume_monitor,
                                                                     GMount                 *mount,
                                                                     ThunarDeviceMonitor    *monitor);
+static void           thunar_device_monitor_mount_pre_unmount      (GVolumeMonitor         *volume_monitor,
+                                                                    GMount                 *mount,
+                                                                    ThunarDeviceMonitor    *monitor);
 
 
 
@@ -69,12 +73,14 @@ struct _ThunarDeviceMonitorClass
   GObjectClass __parent__;
 
   /* signals */
-  void (*device_added)   (ThunarDeviceMonitor *monitor,
-                          ThunarDevice        *device);
-  void (*device_removed) (ThunarDeviceMonitor *monitor,
-                          ThunarDevice        *device);
-  void (*device_changed) (ThunarDeviceMonitor *monitor,
-                          ThunarDevice        *device);
+  void (*device_added)       (ThunarDeviceMonitor *monitor,
+                              ThunarDevice        *device);
+  void (*device_removed)     (ThunarDeviceMonitor *monitor,
+                              ThunarDevice        *device);
+  void (*device_changed)     (ThunarDeviceMonitor *monitor,
+                              ThunarDevice        *device);
+  void (*device_pre_unmount) (ThunarDeviceMonitor *monitor,
+                              ThunarDevice        *device);
 };
 
 struct _ThunarDeviceMonitor
@@ -89,11 +95,6 @@ struct _ThunarDeviceMonitor
   GList          *hidden_volumes;
 };
 
-struct _ThunarDevice
-{
-
-};
-
 
 
 static guint device_monitor_signals[LAST_SIGNAL];
@@ -118,8 +119,8 @@ thunar_device_monitor_class_init (ThunarDeviceMonitorClass *klass)
                     G_SIGNAL_RUN_LAST,
                     G_STRUCT_OFFSET (ThunarDeviceMonitorClass, device_added),
                     NULL, NULL,
-                    g_cclosure_marshal_VOID__POINTER,
-                    G_TYPE_NONE, 1, G_TYPE_POINTER);
+                    g_cclosure_marshal_VOID__OBJECT,
+                    G_TYPE_NONE, 1, G_TYPE_OBJECT);
 
   device_monitor_signals[DEVICE_REMOVED] =
       g_signal_new (I_("device-removed"),
@@ -127,8 +128,8 @@ thunar_device_monitor_class_init (ThunarDeviceMonitorClass *klass)
                     G_SIGNAL_RUN_LAST,
                     G_STRUCT_OFFSET (ThunarDeviceMonitorClass, device_removed),
                     NULL, NULL,
-                    g_cclosure_marshal_VOID__POINTER,
-                    G_TYPE_NONE, 1, G_TYPE_POINTER);
+                    g_cclosure_marshal_VOID__OBJECT,
+                    G_TYPE_NONE, 1, G_TYPE_OBJECT);
 
   device_monitor_signals[DEVICE_CHANGED] =
       g_signal_new (I_("device-changed"),
@@ -136,8 +137,17 @@ thunar_device_monitor_class_init (ThunarDeviceMonitorClass *klass)
                     G_SIGNAL_RUN_LAST,
                     G_STRUCT_OFFSET (ThunarDeviceMonitorClass, device_changed),
                     NULL, NULL,
-                    g_cclosure_marshal_VOID__POINTER,
-                    G_TYPE_NONE, 1, G_TYPE_POINTER);
+                    g_cclosure_marshal_VOID__OBJECT,
+                    G_TYPE_NONE, 1, G_TYPE_OBJECT);
+
+  device_monitor_signals[DEVICE_PRE_UNMOUNT] =
+      g_signal_new (I_("device-pre-unmount"),
+                    G_TYPE_FROM_CLASS (klass),
+                    G_SIGNAL_RUN_LAST,
+                    G_STRUCT_OFFSET (ThunarDeviceMonitorClass, device_pre_unmount),
+                    NULL, NULL,
+                    g_cclosure_marshal_VOID__OBJECT,
+                    G_TYPE_NONE, 1, G_TYPE_OBJECT);
 }
 
 
@@ -179,6 +189,7 @@ thunar_device_monitor_init (ThunarDeviceMonitor *monitor)
   g_signal_connect (monitor->volume_monitor, "mount-added", G_CALLBACK (thunar_device_monitor_mount_added), monitor);
   g_signal_connect (monitor->volume_monitor, "mount-removed", G_CALLBACK (thunar_device_monitor_mount_removed), monitor);
   g_signal_connect (monitor->volume_monitor, "mount-changed", G_CALLBACK (thunar_device_monitor_mount_changed), monitor);
+  g_signal_connect (monitor->volume_monitor, "mount-pre-unmount", G_CALLBACK (thunar_device_monitor_mount_pre_unmount), monitor);
 }
 
 
@@ -594,6 +605,41 @@ thunar_device_monitor_mount_changed (GVolumeMonitor      *volume_monitor,
 
 
 static void
+thunar_device_monitor_mount_pre_unmount (GVolumeMonitor      *volume_monitor,
+                                         GMount              *mount,
+                                         ThunarDeviceMonitor *monitor)
+{
+  ThunarDevice *device;
+  GVolume      *volume;
+
+  _thunar_return_if_fail (G_IS_VOLUME_MONITOR (volume_monitor));
+  _thunar_return_if_fail (THUNAR_IS_DEVICE_MONITOR (monitor));
+  _thunar_return_if_fail (monitor->volume_monitor == volume_monitor);
+  _thunar_return_if_fail (G_IS_MOUNT (mount));
+
+  /* check if we have a device for this mount */
+  device = g_hash_table_lookup (monitor->devices, mount);
+  if (device == NULL)
+    {
+      /* maybe a volume device? */
+      volume = g_mount_get_volume (mount);
+      if (volume != NULL)
+        {
+          device = g_hash_table_lookup (monitor->devices, volume);
+          g_object_unref (volume);
+        }
+    }
+
+  if (device != NULL)
+    {
+      /* notify */
+      g_signal_emit (G_OBJECT (monitor), device_monitor_signals[DEVICE_PRE_UNMOUNT], 0, device);
+    }
+}
+
+
+
+static void
 thunar_device_monitor_list_prepend (gpointer key,
                                     gpointer value,
                                     gpointer user_data)
diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c
index 1432fff..be4933e 100644
--- a/thunar/thunar-gio-extensions.c
+++ b/thunar/thunar-gio-extensions.c
@@ -417,138 +417,6 @@ thunar_g_file_list_free (GList *list)
 
 
 
-#ifdef HAVE_GIO_UNIX
-static gboolean
-thunar_g_mount_is_internal (GMount *mount)
-{
-  const gchar *point_mount_path;
-  gboolean     is_internal = FALSE;
-  GFile       *root;
-  GList       *lp;
-  GList       *mount_points;
-  gchar       *mount_path;
-
-  _thunar_return_val_if_fail (G_IS_MOUNT (mount), FALSE);
-
-  /* determine the mount path */
-  root = g_mount_get_root (mount);
-  mount_path = g_file_get_path (root);
-  g_object_unref (root);
-
-  /* assume non-internal if we cannot determine the path */
-  if (mount_path == NULL)
-    return FALSE;
-
-  if (g_unix_is_mount_path_system_internal (mount_path))
-    {
-      /* mark as internal */
-      is_internal = TRUE;
-    }
-  else
-    {
-      /* get a list of all mount points */
-      mount_points = g_unix_mount_points_get (NULL);
-
-      /* search for the mount point associated with the mount entry */
-      for (lp = mount_points; !is_internal && lp != NULL; lp = lp->next)
-        {
-          point_mount_path = g_unix_mount_point_get_mount_path (lp->data);
-
-          /* check if this is the mount point we are looking for */
-          if (g_strcmp0 (mount_path, point_mount_path) == 0)
-            {
-              /* mark as internal if the user cannot mount this device */
-              if (!g_unix_mount_point_is_user_mountable (lp->data))
-                is_internal = TRUE;
-            }
-              
-          /* free the mount point, we no longer need it */
-          g_unix_mount_point_free (lp->data);
-        }
-
-      /* free the mount point list */
-      g_list_free (mount_points);
-    }
-
-  g_free (mount_path);
-
-  return is_internal;
-}
-#endif
-
-
-
-gboolean
-thunar_g_volume_is_removable (GVolume *volume)
-{
-  gboolean         can_eject = FALSE;
-  gboolean         can_mount = FALSE;
-  gboolean         can_unmount = FALSE;
-  gboolean         is_removable = FALSE;
-  gboolean         is_internal = FALSE;
-  GDrive          *drive;
-  GMount          *mount;
-
-  _thunar_return_val_if_fail (G_IS_VOLUME (volume), FALSE);
-  
-  /* check if the volume can be ejected */
-  can_eject = g_volume_can_eject (volume);
-
-  /* determine the drive for the volume */
-  drive = g_volume_get_drive (volume);
-  if (drive != NULL)
-    {
-      /*check if the drive media can be removed */
-      is_removable = g_drive_is_media_removable (drive);
-
-      /* release the drive */
-      g_object_unref (drive);
-    }
-
-  /* determine the mount for the volume (if it is mounted at all) */
-  mount = g_volume_get_mount (volume);
-  if (mount != NULL)
-    {
-#ifdef HAVE_GIO_UNIX
-      is_internal = thunar_g_mount_is_internal (mount);
-#endif
-
-      /* check if the volume can be unmounted */
-      can_unmount = g_mount_can_unmount (mount);
-
-      /* release the mount */
-      g_object_unref (mount);
-    }
-
-  /* determine whether the device can be mounted */
-  can_mount = g_volume_can_mount (volume);
-
-  return (!is_internal) && (can_eject || can_unmount || is_removable || can_mount);
-}
-
-
-
-gboolean
-thunar_g_volume_is_mounted (GVolume *volume)
-{
-  gboolean is_mounted = FALSE;
-  GMount  *mount;
-
-  _thunar_return_val_if_fail (G_IS_VOLUME (volume), FALSE);
-
-  /* determine the mount for this volume (if it is mounted at all) */
-  mount = g_volume_get_mount (volume);
-  if (mount != NULL)
-    {
-      is_mounted = TRUE;
-      g_object_unref (mount);
-    }
-
-  return is_mounted;
-}
-
-
-
 gboolean
 thunar_g_app_info_launch (GAppInfo          *info,
                           GFile             *working_directory,
diff --git a/thunar/thunar-gio-extensions.h b/thunar/thunar-gio-extensions.h
index c6e8cf7..c912948 100644
--- a/thunar/thunar-gio-extensions.h
+++ b/thunar/thunar-gio-extensions.h
@@ -69,9 +69,6 @@ GList    *thunar_g_file_list_prepend                (GList             *list,
 GList    *thunar_g_file_list_copy                   (GList             *list);
 void      thunar_g_file_list_free                   (GList             *list);
 
-gboolean  thunar_g_volume_is_removable              (GVolume           *volume);
-gboolean  thunar_g_volume_is_mounted                (GVolume           *volume);
-
 gboolean  thunar_g_app_info_launch                  (GAppInfo          *info,
                                                      GFile             *working_directory,
                                                      GList             *path_list,
diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c
index 6bfe366..72cdf62 100644
--- a/thunar/thunar-launcher.c
+++ b/thunar/thunar-launcher.c
@@ -41,6 +41,7 @@
 #include <thunar/thunar-private.h>
 #include <thunar/thunar-sendto-model.h>
 #include <thunar/thunar-stock.h>
+#include <thunar/thunar-device-monitor.h>
 
 
 
@@ -100,7 +101,7 @@ static void                    thunar_launcher_action_open_in_new_window  (GtkAc
                                                                            ThunarLauncher           *launcher);
 static void                    thunar_launcher_action_sendto_desktop      (GtkAction                *action,
                                                                            ThunarLauncher           *launcher);
-static void                    thunar_launcher_action_sendto_volume       (GtkAction                *action,
+static void                    thunar_launcher_action_sendto_device       (GtkAction                *action,
                                                                            ThunarLauncher           *launcher);
 static void                    thunar_launcher_widget_destroyed           (ThunarLauncher           *launcher,
                                                                            GtkWidget                *widget);
@@ -144,7 +145,7 @@ struct _ThunarLauncher
 
   GtkWidget              *widget;
 
-  GVolumeMonitor         *volume_monitor;
+  ThunarDeviceMonitor    *device_monitor;
   ThunarSendtoModel      *sendto_model;
   gint                    sendto_idle_id;
 };
@@ -262,10 +263,10 @@ thunar_launcher_init (ThunarLauncher *launcher)
   /* setup the "Send To" support */
   launcher->sendto_model = thunar_sendto_model_get_default ();
 
-  /* the "Send To" menu also displays removable devices from the volume monitor */
-  launcher->volume_monitor = g_volume_monitor_get ();
-  g_signal_connect_swapped (launcher->volume_monitor, "volume-added", G_CALLBACK (thunar_launcher_update), launcher);
-  g_signal_connect_swapped (launcher->volume_monitor, "volume-removed", G_CALLBACK (thunar_launcher_update), launcher);
+  /* the "Send To" menu also displays removable devices from the device monitor */
+  launcher->device_monitor = thunar_device_monitor_get ();
+  g_signal_connect_swapped (launcher->device_monitor, "device-added", G_CALLBACK (thunar_launcher_update), launcher);
+  g_signal_connect_swapped (launcher->device_monitor, "device-removed", G_CALLBACK (thunar_launcher_update), launcher);
 }
 
 
@@ -305,9 +306,9 @@ thunar_launcher_finalize (GObject *object)
   /* release the reference on the action group */
   g_object_unref (launcher->action_group);
 
-  /* disconnect from the volume monitor used for the "Send To" menu */
-  g_signal_handlers_disconnect_by_func (launcher->volume_monitor, thunar_launcher_update, launcher);
-  g_object_unref (launcher->volume_monitor);
+  /* disconnect from the device monitor used for the "Send To" menu */
+  g_signal_handlers_disconnect_by_func (launcher->device_monitor, thunar_launcher_update, launcher);
+  g_object_unref (launcher->device_monitor);
 
   /* release the reference on the sendto model */
   g_object_unref (launcher->sendto_model);
@@ -1319,66 +1320,56 @@ thunar_launcher_poke_data_free (ThunarLauncherPokeData *data)
 
 
 static void
-thunar_launcher_sendto_volume (ThunarLauncher *launcher,
-                               GVolume        *volume,
+thunar_launcher_sendto_device (ThunarLauncher *launcher,
+                               ThunarDevice   *device,
                                GList          *files)
 {
   ThunarApplication *application;
-  GMount            *mount;
   GFile             *mount_point;
 
   _thunar_return_if_fail (THUNAR_IS_LAUNCHER (launcher));
-  _thunar_return_if_fail (G_IS_VOLUME (volume));
+  _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
 
-  if (!thunar_g_volume_is_mounted (volume))
+  if (!thunar_device_is_mounted (device))
     return;
   
-  mount = g_volume_get_mount (volume);
-  if (mount != NULL)
+  mount_point = thunar_device_get_root (device);
+  if (mount_point != NULL)
     {
-      mount_point = g_mount_get_root (mount);
-      
-      /* copy the files onto the specified volume */
+      /* copy the files onto the specified device */
       application = thunar_application_get ();
       thunar_application_copy_into (application, launcher->widget, files, mount_point, NULL);
       g_object_unref (application);
 
       g_object_unref (mount_point);
-      g_object_unref (mount);
     }
 }
 
 
 
 static void
-thunar_launcher_sendto_mount_finish (GObject      *object,
-                                     GAsyncResult *result,
+thunar_launcher_sendto_mount_finish (ThunarDevice *device,
+                                     const GError *error,
                                      gpointer      user_data)
 {
   ThunarLauncherMountData *data = user_data;
-  GVolume                 *volume = G_VOLUME (object);
-  GError                  *error = NULL;
-  gchar                   *volume_name;
+  gchar                   *device_name;
 
-  _thunar_return_if_fail (G_IS_VOLUME (object));
-  _thunar_return_if_fail (G_IS_ASYNC_RESULT (result));
+  _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
   _thunar_return_if_fail (user_data != NULL);
   _thunar_return_if_fail (THUNAR_IS_LAUNCHER (data->launcher));
 
-  if (!g_volume_mount_finish (volume, result, &error))
+  if (error != NULL)
     {
-      /* tell the user that we were unable to mount the volume, which is 
+      /* tell the user that we were unable to mount the device, which is 
        * required to send files to it */
-      volume_name = g_volume_get_name (volume);
-      thunar_dialogs_show_error (data->launcher->widget, error, _("Failed to mount \"%s\""), 
-                                 volume_name);
-      g_free (volume_name);
-
-      g_error_free (error);
+      device_name = thunar_device_get_name (device);
+      thunar_dialogs_show_error (data->launcher->widget, error, _("Failed to mount \"%s\""), device_name);
+      g_free (device_name);
     }
   else
     {
-      thunar_launcher_sendto_volume (data->launcher, volume, data->files);
+      thunar_launcher_sendto_device (data->launcher, device, data->files);
     }
 
   thunar_launcher_mount_data_free (data);
@@ -1387,13 +1378,13 @@ thunar_launcher_sendto_mount_finish (GObject      *object,
 
 
 static void
-thunar_launcher_action_sendto_volume (GtkAction      *action,
+thunar_launcher_action_sendto_device (GtkAction      *action,
                                       ThunarLauncher *launcher)
 {
   ThunarLauncherMountData *data;
   GMountOperation         *mount_operation;
   GtkWidget               *window;
-  GVolume                 *volume;
+  ThunarDevice            *device;
   GList                   *files;
 
   _thunar_return_if_fail (GTK_IS_ACTION (action));
@@ -1404,13 +1395,13 @@ thunar_launcher_action_sendto_volume (GtkAction      *action,
   if (G_UNLIKELY (files == NULL))
     return;
 
-  /* determine the volume to which to send */
-  volume = g_object_get_qdata (G_OBJECT (action), thunar_launcher_handler_quark);
-  if (G_UNLIKELY (volume == NULL))
+  /* determine the device to which to send */
+  device = g_object_get_qdata (G_OBJECT (action), thunar_launcher_handler_quark);
+  if (G_UNLIKELY (device == NULL))
     return;
 
-  /* make sure to mount the volume first, if it's not already mounted */
-  if (!thunar_g_volume_is_mounted (volume))
+  /* make sure to mount the device first, if it's not already mounted */
+  if (!thunar_device_is_mounted (device))
     {
       /* determine the toplevel window */
       window = gtk_widget_get_toplevel (launcher->widget);
@@ -1421,15 +1412,18 @@ thunar_launcher_action_sendto_volume (GtkAction      *action,
       /* allocate a GTK+ mount operation */
       mount_operation = gtk_mount_operation_new (GTK_WINDOW (window));
 
-      /* try to mount the volume and later start sending the files */
-      g_volume_mount (volume, G_MOUNT_MOUNT_NONE, mount_operation, NULL,
-                      thunar_launcher_sendto_mount_finish, data);
+      /* try to mount the device and later start sending the files */
+      thunar_device_mount (device,
+                           mount_operation,
+                           NULL,
+                           thunar_launcher_sendto_mount_finish,
+                           data);
 
       g_object_unref (mount_operation);
     }
   else
     {
-      thunar_launcher_sendto_volume (launcher, volume, files);
+      thunar_launcher_sendto_device (launcher, device, files);
     }
 
   /* cleanup */
@@ -1461,11 +1455,11 @@ thunar_launcher_sendto_idle (gpointer user_data)
   gboolean        linkable = TRUE;
   GIcon          *icon;
   GList          *handlers;
-  GList          *volumes;
+  GList          *devices;
   GList          *lp;
   gchar          *name;
   gchar          *tooltip;
-  gchar          *volume_name;
+  gchar          *device_name;
   gint            n_selected_files;
   gint            n = 0;
 
@@ -1509,31 +1503,23 @@ thunar_launcher_sendto_idle (gpointer user_data)
       if (G_UNLIKELY (launcher->ui_addons_merge_id == 0))
         launcher->ui_addons_merge_id = gtk_ui_manager_new_merge_id (launcher->ui_manager);
 
-      /* determine the currently active volumes */
-      volumes = g_volume_monitor_get_volumes (launcher->volume_monitor);
+      /* determine the currently active devices */
+      devices = thunar_device_monitor_get_devices (launcher->device_monitor);
 
       /* add removable (and writable) drives and media */
-      for (lp = volumes; lp != NULL; lp = lp->next, ++n)
+      for (lp = devices; lp != NULL; lp = lp->next, ++n)
         {
-          /* skip non-removable or disc media (CD-ROMs aren't writable by Thunar) */
-          /* TODO skip non-writable volumes like CD-ROMs here */
-          if (!thunar_g_volume_is_removable (lp->data))
-            {
-              g_object_unref (lp->data);
-              continue;
-            }
-
-          /* generate a unique name and tooltip for the volume */
-          volume_name = g_volume_get_name (lp->data);
+          /* generate a unique name and tooltip for the device */
+          device_name = thunar_device_get_name (lp->data);
           name = g_strdup_printf ("thunar-launcher-sendto%d-%p", n, launcher);
           tooltip = g_strdup_printf (ngettext ("Send the selected file to \"%s\"",
                                                "Send the selected files to \"%s\"",
-                                               n_selected_files), volume_name);
+                                               n_selected_files), device_name);
 
-          /* allocate a new action for the volume */
-          action = gtk_action_new (name, volume_name, tooltip, NULL);
+          /* allocate a new action for the device */
+          action = gtk_action_new (name, device_name, tooltip, NULL);
           g_object_set_qdata_full (G_OBJECT (action), thunar_launcher_handler_quark, lp->data, g_object_unref);
-          g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK (thunar_launcher_action_sendto_volume), launcher);
+          g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK (thunar_launcher_action_sendto_device), launcher);
           gtk_action_group_add_action (launcher->action_group, action);
           gtk_ui_manager_add_ui (launcher->ui_manager, launcher->ui_addons_merge_id,
                                  "/main-menu/file-menu/sendto-menu/placeholder-sendto-actions",
@@ -1543,7 +1529,7 @@ thunar_launcher_sendto_idle (gpointer user_data)
                                  name, name, GTK_UI_MANAGER_MENUITEM, FALSE);
           g_object_unref (action);
 
-          icon = g_volume_get_icon (lp->data);
+          icon = thunar_device_get_icon (lp->data);
           if (G_LIKELY (icon != NULL))
             {
               gtk_action_set_gicon (action, icon);
@@ -1553,11 +1539,11 @@ thunar_launcher_sendto_idle (gpointer user_data)
           /* cleanup */
           g_free (name);
           g_free (tooltip);
-          g_free (volume_name);
+          g_free (device_name);
         }
 
-      /* free the volumes list */
-      g_list_free (volumes);
+      /* free the devices list */
+      g_list_free (devices);
 
       /* determine the sendto handlers for the selected files */
       handlers = thunar_sendto_model_get_matching (launcher->sendto_model, launcher->selected_files);
diff --git a/thunar/thunar-shortcuts-view.c b/thunar/thunar-shortcuts-view.c
index 19d095b..3e3b985 100644
--- a/thunar/thunar-shortcuts-view.c
+++ b/thunar/thunar-shortcuts-view.c
@@ -1408,17 +1408,17 @@ thunar_shortcuts_view_poke_location_finish (ThunarBrowser *browser,
 
 
 static void
-thunar_shortcuts_view_poke_volume_finish (ThunarBrowser *browser,
-                                          GVolume       *volume,
+thunar_shortcuts_view_poke_device_finish (ThunarBrowser *browser,
+                                          ThunarDevice  *device,
                                           ThunarFile    *mount_point,
                                           GError        *error,
                                           gpointer       user_data)
 {
   gboolean new_window = GPOINTER_TO_UINT (user_data);
-  gchar   *volume_name;
+  gchar   *device_name;
 
   _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_VIEW (browser));
-  _thunar_return_if_fail (G_IS_VOLUME (volume));
+  _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
 
   if (error == NULL)
     {
@@ -1428,10 +1428,10 @@ thunar_shortcuts_view_poke_volume_finish (ThunarBrowser *browser,
     }
   else
     {
-      volume_name = g_volume_get_name (volume);
+      device_name = thunar_device_get_name (device);
       thunar_dialogs_show_error (GTK_WIDGET (browser), error,
-                                 _("Failed to mount \"%s\""), volume_name);
-      g_free (volume_name);
+                                 _("Failed to mount \"%s\""), device_name);
+      g_free (device_name);
     }
 }
 
@@ -1466,10 +1466,10 @@ thunar_shortcuts_view_open (ThunarShortcutsView *view,
                           THUNAR_SHORTCUTS_MODEL_COLUMN_LOCATION, &location,
                           -1);
 
-      if (G_LIKELY (FALSE && device != NULL))
-        {/* TODO */
-          thunar_browser_poke_volume (THUNAR_BROWSER (view), (GVolume *)device, view,
-                                      thunar_shortcuts_view_poke_volume_finish,
+      if (G_LIKELY (device != NULL))
+        {
+          thunar_browser_poke_device (THUNAR_BROWSER (view), device, view,
+                                      thunar_shortcuts_view_poke_device_finish,
                                       GUINT_TO_POINTER (new_window));
         }
       else if (file != NULL)
@@ -1563,7 +1563,7 @@ thunar_shortcuts_view_eject (ThunarShortcutsView *view)
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
   if (gtk_tree_selection_get_selected (selection, &model, &iter))
     {
-      /* determine the volume/mount for the shortcut at the given tree iterator */
+      /* determine the device/mount for the shortcut at the given tree iterator */
       gtk_tree_model_get (model, &iter, THUNAR_SHORTCUTS_MODEL_COLUMN_DEVICE, &device, -1);
       _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
 
@@ -1585,23 +1585,23 @@ thunar_shortcuts_view_eject (ThunarShortcutsView *view)
 
 
 static void
-thunar_shortcuts_view_poke_volume_mount_finish (ThunarBrowser *browser,
-                                                GVolume       *volume,
+thunar_shortcuts_view_poke_device_mount_finish (ThunarBrowser *browser,
+                                                ThunarDevice  *device,
                                                 ThunarFile    *mount_point,
                                                 GError        *error,
                                                 gpointer       ignored)
 {
-  gchar *volume_name;
+  gchar *device_name;
 
   _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_VIEW (browser));
-  _thunar_return_if_fail (G_IS_VOLUME (volume));
+  _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
 
   if (error != NULL)
     {
-      volume_name = g_volume_get_name (volume);
+      device_name = thunar_device_get_name (device);
       thunar_dialogs_show_error (GTK_WIDGET (browser), error,
-                                 _("Failed to mount \"%s\""), volume_name);
-      g_free (volume_name);
+                                 _("Failed to mount \"%s\""), device_name);
+      g_free (device_name);
     }
 }
 
@@ -1613,7 +1613,7 @@ thunar_shortcuts_view_mount (ThunarShortcutsView *view)
   GtkTreeSelection *selection;
   GtkTreeModel     *model;
   GtkTreeIter       iter;
-  GVolume          *volume;
+  ThunarDevice     *device;
 
   _thunar_return_if_fail (THUNAR_IS_SHORTCUTS_VIEW (view));
 
@@ -1627,17 +1627,16 @@ thunar_shortcuts_view_mount (ThunarShortcutsView *view)
   if (gtk_tree_selection_get_selected (selection, &model, &iter))
     {
       /* determine the file for the shortcut at the given tree iterator */
-      volume = NULL;
-      /*gtk_tree_model_get (model, &iter,
-                          THUNAR_SHORTCUTS_MODEL_COLUMN_VOLUME, &volume,
-                          -1);*/
+      gtk_tree_model_get (model, &iter,
+                          THUNAR_SHORTCUTS_MODEL_COLUMN_DEVICE, &device,
+                          -1);
 
-      if (G_LIKELY (volume != NULL))
+      if (G_LIKELY (device != NULL))
         {
-          thunar_browser_poke_volume (THUNAR_BROWSER (view), volume, view,
-                                      thunar_shortcuts_view_poke_volume_mount_finish,
+          thunar_browser_poke_device (THUNAR_BROWSER (view), device, view,
+                                      thunar_shortcuts_view_poke_device_mount_finish,
                                       NULL);
-          g_object_unref (volume);
+          g_object_unref (device);
         }
     }
 }
@@ -1685,7 +1684,7 @@ thunar_shortcuts_view_unmount (ThunarShortcutsView *view)
   selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
   if (gtk_tree_selection_get_selected (selection, &model, &iter))
     {
-      /* determine the volume/mount for the shortcut at the given tree iterator */
+      /* determine the device/mount for the shortcut at the given tree iterator */
       gtk_tree_model_get (model, &iter, THUNAR_SHORTCUTS_MODEL_COLUMN_DEVICE, &device, -1);
       _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
 
diff --git a/thunar/thunar-tree-model.c b/thunar/thunar-tree-model.c
index 4cbf0e5..4c5df5a 100644
--- a/thunar/thunar-tree-model.c
+++ b/thunar/thunar-tree-model.c
@@ -118,6 +118,9 @@ static void                 thunar_tree_model_file_changed            (ThunarFil
 static void                 thunar_tree_model_device_added            (ThunarDeviceMonitor    *device_monitor,
                                                                        ThunarDevice           *device,
                                                                        ThunarTreeModel        *model);
+static void                 thunar_tree_model_device_pre_unmount      (ThunarDeviceMonitor    *device_monitor,
+                                                                       ThunarDevice           *device,
+                                                                       ThunarTreeModel        *model);
 static void                 thunar_tree_model_device_removed          (ThunarDeviceMonitor    *device_monitor,
                                                                        ThunarDevice           *device,
                                                                        ThunarTreeModel        *model);
@@ -304,6 +307,7 @@ thunar_tree_model_init (ThunarTreeModel *model)
   /* connect to the volume monitor */
   model->device_monitor = thunar_device_monitor_get ();
   g_signal_connect (model->device_monitor, "device-added", G_CALLBACK (thunar_tree_model_device_added), model);
+  g_signal_connect (model->device_monitor, "device-pre-unmount", G_CALLBACK (thunar_tree_model_device_pre_unmount), model);
   g_signal_connect (model->device_monitor, "device-removed", G_CALLBACK (thunar_tree_model_device_removed), model);
   g_signal_connect (model->device_monitor, "device-changed", G_CALLBACK (thunar_tree_model_device_changed), model);
 
@@ -1017,33 +1021,24 @@ thunar_tree_model_device_changed (ThunarDeviceMonitor *device_monitor,
 }
 
 
-#if 0
+
 static void
-thunar_tree_model_mount_pre_unmount (GVolumeMonitor         *volume_monitor,
-                                     GMount                 *mount,
-                                     ThunarTreeModel        *model)
+thunar_tree_model_device_pre_unmount (ThunarDeviceMonitor *device_monitor,
+                                      ThunarDevice        *device,
+                                      ThunarTreeModel     *model)
 {
-  GVolume *volume;
-  GNode   *node;
+  GNode *node;
 
-  _thunar_return_if_fail (G_IS_VOLUME_MONITOR (volume_monitor));
-  _thunar_return_if_fail (model->volume_monitor == volume_monitor);
-  _thunar_return_if_fail (G_IS_MOUNT (mount));
+  _thunar_return_if_fail (THUNAR_IS_DEVICE_MONITOR (device_monitor));
+  _thunar_return_if_fail (model->device_monitor == device_monitor);
+  _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
   _thunar_return_if_fail (THUNAR_IS_TREE_MODEL (model));
 
-  /* determine the mount to which this mount belongs */
-  volume = g_mount_get_volume (mount);
-
-  if (volume == NULL)
-    return;
-
   /* lookup the node for the volume (if visible) */
   for (node = model->root->children; node != NULL; node = node->next)
-    if (THUNAR_TREE_MODEL_ITEM (node->data)->volume == volume)
+    if (THUNAR_TREE_MODEL_ITEM (node->data)->device == device)
       break;
 
-  g_object_unref (volume);
-
   /* check if we have a node */
   if (G_UNLIKELY (node == NULL))
     return;
@@ -1058,7 +1053,7 @@ thunar_tree_model_mount_pre_unmount (GVolumeMonitor         *volume_monitor,
   /* add the dummy node */
   thunar_tree_model_node_insert_dummy (node, model);
 }
-#endif
+
 
 
 static void
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index b4acb6c..53d2457 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -60,6 +60,7 @@
 #include <thunar/thunar-tree-pane.h>
 #include <thunar/thunar-window.h>
 #include <thunar/thunar-window-ui.h>
+#include <thunar/thunar-device-monitor.h>
 
 #include <glib.h>
 
@@ -207,8 +208,8 @@ static void     thunar_window_menu_item_deselected        (GtkWidget
 static void     thunar_window_notify_loading              (ThunarView             *view,
                                                            GParamSpec             *pspec,
                                                            ThunarWindow           *window);
-static void     thunar_window_mount_pre_unmount           (GVolumeMonitor         *volume_monitor,
-                                                           GMount                 *mount,
+static void     thunar_window_device_pre_unmount          (ThunarDeviceMonitor    *device_monitor,
+                                                           ThunarDevice           *device,
                                                            ThunarWindow           *window);
 static gboolean thunar_window_merge_idle                  (gpointer                user_data);
 static void     thunar_window_merge_idle_destroy          (gpointer                user_data);
@@ -254,8 +255,8 @@ struct _ThunarWindow
   GtkActionGroup         *action_group;
   GtkUIManager           *ui_manager;
 
-  /* to be able to change folder on "mount-pre-unmount" if required */
-  GVolumeMonitor         *volume_monitor;
+  /* to be able to change folder on "device-pre-unmount" if required */
+  ThunarDeviceMonitor    *device_monitor;
 
   /* closures for the menu_item_selected()/menu_item_deselected() callbacks */
   GClosure               *menu_item_selected_closure;
@@ -757,8 +758,8 @@ thunar_window_init (ThunarWindow *window)
   window->scroll_to_files = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, g_object_unref);
 
   /* connect to the volume monitor */
-  window->volume_monitor = g_volume_monitor_get ();
-  g_signal_connect (window->volume_monitor, "mount-pre-unmount", G_CALLBACK (thunar_window_mount_pre_unmount), window);
+  window->device_monitor = thunar_device_monitor_get ();
+  g_signal_connect (window->device_monitor, "device-pre-unmount", G_CALLBACK (thunar_window_device_pre_unmount), window);
 
   /* allocate a closure for the menu_item_selected() callback */
   window->menu_item_selected_closure = g_cclosure_new_object (G_CALLBACK (thunar_window_menu_item_selected), G_OBJECT (window));
@@ -1012,8 +1013,8 @@ thunar_window_finalize (GObject *object)
   g_closure_unref (window->menu_item_selected_closure);
 
   /* disconnect from the volume monitor */
-  g_signal_handlers_disconnect_matched (window->volume_monitor, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, window);
-  g_object_unref (window->volume_monitor);
+  g_signal_handlers_disconnect_matched (window->device_monitor, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, window);
+  g_object_unref (window->device_monitor);
 
   /* disconnect from the ui manager */
   g_signal_handlers_disconnect_matched (window->ui_manager, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, window);
@@ -2771,17 +2772,17 @@ thunar_window_notify_loading (ThunarView   *view,
 
 
 static void
-thunar_window_mount_pre_unmount (GVolumeMonitor *volume_monitor,
-                                 GMount         *mount,
-                                 ThunarWindow   *window)
+thunar_window_device_pre_unmount (ThunarDeviceMonitor *device_monitor,
+                                  ThunarDevice        *device,
+                                  ThunarWindow        *window)
 {
   ThunarFile *file;
   GtkAction  *action;
   GFile      *mount_point;
 
-  _thunar_return_if_fail (G_IS_VOLUME_MONITOR (volume_monitor));
-  _thunar_return_if_fail (window->volume_monitor == volume_monitor);
-  _thunar_return_if_fail (G_IS_MOUNT (mount));
+  _thunar_return_if_fail (THUNAR_IS_DEVICE_MONITOR (device_monitor));
+  _thunar_return_if_fail (window->device_monitor == device_monitor);
+  _thunar_return_if_fail (THUNAR_IS_DEVICE (device));
   _thunar_return_if_fail (THUNAR_IS_WINDOW (window));
 
   /* nothing to do if we don't have a current directory */
@@ -2789,10 +2790,10 @@ thunar_window_mount_pre_unmount (GVolumeMonitor *volume_monitor,
     return;
 
   /* try to get the ThunarFile for the mount point from the file cache */
-  mount_point = g_mount_get_root (mount);
+  mount_point = thunar_device_get_root (device);
   file = thunar_file_cache_lookup (mount_point);
   g_object_unref (mount_point);
-
+g_message ("%p file", file);
   if (G_UNLIKELY (file == NULL))
     return;
 


More information about the Xfce4-commits mailing list