summaryrefslogtreecommitdiffstats
path: root/xfce/thunar/thunar-volman-handle-unmountable-volumes.patch
blob: d9b0dd6a70c800d4f96dc2c8fc2723ac8002aabb (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
diff -rNaud thunar-SVN29407-orig/thunar/thunar-shortcuts-view.c thunar-SVN29407/thunar/thunar-shortcuts-view.c
--- thunar-SVN29407-orig/thunar/thunar-shortcuts-view.c	2009-01-29 21:28:03.000000000 +0100
+++ thunar-SVN29407/thunar/thunar-shortcuts-view.c	2009-02-01 14:36:40.000000000 +0100
@@ -812,39 +812,46 @@
 
   /* prepare the popup menu */
   menu = gtk_menu_new ();
+  
+  /* We don't need these items for non mountable volumes */ 
+  if ((G_UNLIKELY (volume == NULL)) || (thunar_vfs_volume_is_mountable (volume)))
+    {
+	  /* append the "Open" menu action */
+	  item = gtk_image_menu_item_new_with_mnemonic (_("_Open"));
+	  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_open), view);
+	  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+	  gtk_widget_show (item);
 
-  /* append the "Open" menu action */
-  item = gtk_image_menu_item_new_with_mnemonic (_("_Open"));
-  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_open), view);
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-  gtk_widget_show (item);
+	  /* set the stock icon */
+	  image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
+	  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+	  gtk_widget_show (image);
 
-  /* set the stock icon */
-  image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-  gtk_widget_show (image);
+	  /* append the "Open in New Window" menu action */
+	  item = gtk_image_menu_item_new_with_mnemonic (_("Open in New Window"));
+	  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_open_in_new_window), view);
+	  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+	  gtk_widget_show (item);
 
-  /* append the "Open in New Window" menu action */
-  item = gtk_image_menu_item_new_with_mnemonic (_("Open in New Window"));
-  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_open_in_new_window), view);
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-  gtk_widget_show (item);
+	  /* append a menu separator */
+	  item = gtk_separator_menu_item_new ();
+	  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+	  gtk_widget_show (item);
+	}
 
-  /* append a menu separator */
-  item = gtk_separator_menu_item_new ();
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-  gtk_widget_show (item);
 
   /* check if we have a volume here */
   if (G_UNLIKELY (volume != NULL))
     {
       /* append the "Mount Volume" menu action */
-      item = gtk_image_menu_item_new_with_mnemonic (_("_Mount Volume"));
-      gtk_widget_set_sensitive (item, !thunar_vfs_volume_is_mounted (volume));
-      g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_mount), view);
-      gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-      gtk_widget_show (item);
-
+	  if (thunar_vfs_volume_is_mountable (volume))
+        {
+		  item = gtk_image_menu_item_new_with_mnemonic (_("_Mount Volume"));
+		  gtk_widget_set_sensitive (item, !thunar_vfs_volume_is_mounted (volume));
+		  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_mount), view);
+		  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+		  gtk_widget_show (item);
+		}
       /* check if the volume is ejectable */
       if (thunar_vfs_volume_is_ejectable (volume))
         {
@@ -856,12 +863,15 @@
         }
       else
         {
-          /* append the "Unmount Volume" menu item */
-          item = gtk_image_menu_item_new_with_mnemonic (_("_Unmount Volume"));
-          gtk_widget_set_sensitive (item, thunar_vfs_volume_is_mounted (volume));
-          g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_unmount), view);
-          gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-          gtk_widget_show (item);
+	  	  if (thunar_vfs_volume_is_mountable (volume))
+			{
+			  /* append the "Unmount Volume" menu item */
+			  item = gtk_image_menu_item_new_with_mnemonic (_("_Unmount Volume"));
+			  gtk_widget_set_sensitive (item, thunar_vfs_volume_is_mounted (volume));
+			  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_shortcuts_view_unmount), view);
+			  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+			  gtk_widget_show (item);
+			}
         }
 
       /* append a menu separator */
diff -rNaud thunar-SVN29407-orig/thunar/thunar-tree-view.c thunar-SVN29407/thunar/thunar-tree-view.c
--- thunar-SVN29407-orig/thunar/thunar-tree-view.c	2009-01-29 21:28:03.000000000 +0100
+++ thunar-SVN29407/thunar/thunar-tree-view.c	2009-02-01 14:36:17.000000000 +0100
@@ -1058,40 +1058,48 @@
 
   /* prepare the popup menu */
   menu = gtk_menu_new ();
+  
+  /* We don't need these items for non mountable volumes */ 
+  if ((G_UNLIKELY (volume == NULL)) || (thunar_vfs_volume_is_mountable (volume)))
+    {
 
-  /* append the "Open" menu action */
-  item = gtk_image_menu_item_new_with_mnemonic (_("_Open"));
-  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_open), view);
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-  gtk_widget_set_sensitive (item, (file != NULL || volume != NULL));
-  gtk_widget_show (item);
-
-  /* set the stock icon */
-  image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
-  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
-  gtk_widget_show (image);
+	  /* append the "Open" menu action */
+	  item = gtk_image_menu_item_new_with_mnemonic (_("_Open"));
+	  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_open), view);
+	  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+	  gtk_widget_set_sensitive (item, (file != NULL || volume != NULL));
+	  gtk_widget_show (item);
 
-  /* append the "Open in New Window" menu action */
-  item = gtk_image_menu_item_new_with_mnemonic (_("Open in New Window"));
-  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_open_in_new_window), view);
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-  gtk_widget_set_sensitive (item, (file != NULL || volume != NULL));
-  gtk_widget_show (item);
+	  /* set the stock icon */
+	  image = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
+	  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+	  gtk_widget_show (image);
 
-  /* append a separator item */
-  item = gtk_separator_menu_item_new ();
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-  gtk_widget_show (item);
+	  /* append the "Open in New Window" menu action */
+	  item = gtk_image_menu_item_new_with_mnemonic (_("Open in New Window"));
+	  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_open_in_new_window), view);
+	  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+	  gtk_widget_set_sensitive (item, (file != NULL || volume != NULL));
+	  gtk_widget_show (item);
 
+	  /* append a separator item */
+	  item = gtk_separator_menu_item_new ();
+	  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+	  gtk_widget_show (item);
+	}
+	
+  /* check if we have a volume here */	
   if (G_UNLIKELY (volume != NULL))
     {
       /* append the "Mount Volume" menu action */
-      item = gtk_image_menu_item_new_with_mnemonic (_("_Mount Volume"));
-      gtk_widget_set_sensitive (item, !thunar_vfs_volume_is_mounted (volume));
-      g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_mount), view);
-      gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-      gtk_widget_show (item);
-
+	  if (thunar_vfs_volume_is_mountable (volume))
+        {
+		  item = gtk_image_menu_item_new_with_mnemonic (_("_Mount Volume"));
+		  gtk_widget_set_sensitive (item, !thunar_vfs_volume_is_mounted (volume));
+		  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_mount), view);
+		  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+		  gtk_widget_show (item);
+		}
       /* check if the volume is ejectable */
       if (thunar_vfs_volume_is_ejectable (volume))
         {
@@ -1102,15 +1110,17 @@
           gtk_widget_show (item);
         }
       else
-        {
-          /* append the "Unmount Volume" menu item */
-          item = gtk_image_menu_item_new_with_mnemonic (_("_Unmount Volume"));
-          gtk_widget_set_sensitive (item, thunar_vfs_volume_is_mounted (volume));
-          g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_unmount), view);
-          gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-          gtk_widget_show (item);
-        }
-
+	    {
+	  	  if (thunar_vfs_volume_is_mountable (volume))
+			{
+			  /* append the "Unmount Volume" menu item */
+			  item = gtk_image_menu_item_new_with_mnemonic (_("_Unmount Volume"));
+			  gtk_widget_set_sensitive (item, thunar_vfs_volume_is_mounted (volume));
+			  g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_tree_view_action_unmount), view);
+			  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+			  gtk_widget_show (item);
+			}
+		}
       /* append a menu separator */
       item = gtk_separator_menu_item_new ();
       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
diff -rNaud thunar-SVN29407-orig/thunar-vfs/thunar-vfs-volume-hal.c thunar-SVN29407/thunar-vfs/thunar-vfs-volume-hal.c
--- thunar-SVN29407-orig/thunar-vfs/thunar-vfs-volume-hal.c	2009-01-29 21:28:09.000000000 +0100
+++ thunar-SVN29407/thunar-vfs/thunar-vfs-volume-hal.c	2009-02-01 14:37:05.000000000 +0100
@@ -1014,9 +1014,6 @@
 
   if (G_LIKELY (hv != NULL))
     {
-      /* check if we have a mountable file system here */
-      if (libhal_volume_get_fsusage (hv) == LIBHAL_VOLUME_USAGE_MOUNTABLE_FILESYSTEM)
-        {
           /* determine the UDI of the drive to which this volume belongs */
           drive_udi = libhal_volume_get_storage_device_udi (hv);
           if (G_LIKELY (drive_udi != NULL))
@@ -1051,7 +1048,6 @@
                   libhal_drive_free (hd);
                 }
             }
-        }
 
       /* release the HAL volume */
       libhal_volume_free (hv);