blob: ee8636392eea965201128523701bdf929efcbcef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
diff -uprb Thunar-1.4.0.orig/thunar/thunar-shortcuts-model.c Thunar-1.4.0/thunar/thunar-shortcuts-model.c
--- Thunar-1.4.0.orig/thunar/thunar-shortcuts-model.c 2012-11-03 07:42:39.000000000 +0200
+++ Thunar-1.4.0/thunar/thunar-shortcuts-model.c 2012-11-03 08:13:25.000000000 +0200
@@ -1221,11 +1221,25 @@ thunar_shortcuts_model_volume_added (GVo
GVolume *volume,
ThunarShortcutsModel *model)
{
+ GList *lp;
+ gint idx;
+
_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_VOLUME (volume));
_thunar_return_if_fail (THUNAR_IS_SHORTCUTS_MODEL (model));
+ /* check that the volume is not in the internal list already */
+ if (g_list_find (model->hidden_volumes, volume) != NULL)
+ return;
+
+ /* nor in the list of visible volumes */
+ for (idx = 0, lp = model->shortcuts; lp != NULL; ++idx, lp = lp->next)
+ {
+ if (THUNAR_SHORTCUT (lp->data)->volume == volume)
+ return;
+ }
+
/* place the volume on the hidden list */
model->hidden_volumes = g_list_prepend (model->hidden_volumes, g_object_ref (volume));
diff -uprb Thunar-1.4.0.orig/thunar/thunar-tree-model.c Thunar-1.4.0/thunar/thunar-tree-model.c
--- Thunar-1.4.0.orig/thunar/thunar-tree-model.c 2012-11-03 07:42:39.000000000 +0200
+++ Thunar-1.4.0/thunar/thunar-tree-model.c 2012-11-03 08:09:36.000000000 +0200
@@ -1127,11 +1127,26 @@ thunar_tree_model_volume_added (GVolumeM
GVolume *volume,
ThunarTreeModel *model)
{
+ ThunarTreeModelItem *item = NULL;
+ 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_VOLUME (volume));
_thunar_return_if_fail (THUNAR_IS_TREE_MODEL (model));
+ /* check that the volume is not in the internal list already */
+ if (g_list_find (model->hidden_volumes, volume) != NULL)
+ return;
+
+ /* nor in the list of visible volumes */
+ for (node = model->root->children; node != NULL; node = node->next)
+ {
+ item = THUNAR_TREE_MODEL_ITEM (node->data);
+ if (item->volume == volume)
+ return;
+ }
+
/* place the volume on the hidden list */
model->hidden_volumes = g_list_prepend (model->hidden_volumes, g_object_ref (volume));
|