summaryrefslogtreecommitdiff
path: root/thunar/thunar-tree-model.c
diff options
context:
space:
mode:
authorNick Schermer <nick@xfce.org>2012-10-07 02:07:50 +0200
committerNick Schermer <nick@xfce.org>2012-10-13 16:10:35 +0200
commit06120820fe2e79cd909706cdda9536e1cddcdbde (patch)
treedde6212eca46d40031e1c01fdbbcbe2c3bf2228c /thunar/thunar-tree-model.c
parent3dee1594752e97e7958abbfb029ce59ce026fe8f (diff)
downloadthunar-06120820fe2e79cd909706cdda9536e1cddcdbde.tar.gz
Port the remains to ThunarDevice.
Diffstat (limited to 'thunar/thunar-tree-model.c')
-rw-r--r--thunar/thunar-tree-model.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/thunar/thunar-tree-model.c b/thunar/thunar-tree-model.c
index 4cbf0e59..4c5df5a0 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