summaryrefslogtreecommitdiff
path: root/extra/thunar/thunar-1.4.0-dont-add-duplicates-of-devices.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extra/thunar/thunar-1.4.0-dont-add-duplicates-of-devices.patch')
-rw-r--r--extra/thunar/thunar-1.4.0-dont-add-duplicates-of-devices.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/extra/thunar/thunar-1.4.0-dont-add-duplicates-of-devices.patch b/extra/thunar/thunar-1.4.0-dont-add-duplicates-of-devices.patch
new file mode 100644
index 000000000..ee8636392
--- /dev/null
+++ b/extra/thunar/thunar-1.4.0-dont-add-duplicates-of-devices.patch
@@ -0,0 +1,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));
+