Merge lp:~jeremywootten/pantheon-files/connect-server-plugin-in-sidebar into lp:~elementary-apps/pantheon-files/trunk
- connect-server-plugin-in-sidebar
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 1604 | ||||
Proposed branch: | lp:~jeremywootten/pantheon-files/connect-server-plugin-in-sidebar | ||||
Merge into: | lp:~elementary-apps/pantheon-files/trunk | ||||
Diff against target: |
611 lines (+127/-93) 7 files modified
CMakeLists.txt (+1/-1) libcore/AbstractSidebar.vala (+53/-10) libcore/Plugin.vala (+1/-1) libcore/PluginManager.vala (+2/-2) plugins/network-places/plugin.vala (+7/-0) src/View/LocationBar.vala (+2/-2) src/View/Sidebar.vala (+61/-77) |
||||
To merge this branch: | bzr merge lp:~jeremywootten/pantheon-files/connect-server-plugin-in-sidebar | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cody Garver (community) | Needs Fixing | ||
Jeremy Wootten | Needs Resubmitting | ||
Danielle Foré | Needs Fixing | ||
xapantu | Pending | ||
Review via email: mp+233477@code.launchpad.net |
Commit message
Description of the change
Use network-places plugin to insert extra network category item "Connect server".
Adds infra-structure for adding plugin items with callbacks into the sidebar network category (and potentially other categories).
Removes the "Connect Server" item from the sidebar context menu.
- 1594. By Jeremy Wootten
-
change icon, change text, make sidebar content expand
Jeremy Wootten (jeremywootten) wrote : | # |
> "Connect server" should be "Connect to Server"
>
> I think a better icon might be "network-server" or "network-workgroup"
>
> Also Cody's screenshot shows that there has been some kind of theme issue
> introduced. The widget no longer expands to fill the height of the pane
OK, I have fixed these issues, using the "network-server" icon. Note that the "network-server" and "network-workgroup" icons appear the same as the one already used for "Entire Network" item (on my system).
Instead of the string "network-server", Marlin.
Cody Garver (codygarver) wrote : | # |
You did not entirely correct "Connect to Server"
I would not bother trying to access that icon variable
Dan, are you sure there should be no ellipsis in the string? There's no such exception stated in the HIG http://
- 1595. By Jeremy Wootten
-
Fix label text, hide irrelevant context menu items, more generic plugin interface to sidebar, upgrade to valac 0.25.4
Jeremy Wootten (jeremywootten) wrote : | # |
I have now used an ellipsis in the label text as the button leads to a dialog and there is no other indication.
I have now upgraded to valac 0.25.4 so the branch lp:~jeremywootten/pantheon-files/upgrade_to_vala_0.25.4 should be merged before this one.
It is questionable whether the infobar is now needed in the network view since the same functionality is present in the sidebar.
Preview Diff
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2014-08-05 18:18:49 +0000 | |||
3 | +++ CMakeLists.txt 2014-09-24 07:03:43 +0000 | |||
4 | @@ -22,7 +22,7 @@ | |||
5 | 22 | 22 | ||
6 | 23 | find_package (Vala REQUIRED) | 23 | find_package (Vala REQUIRED) |
7 | 24 | include (ValaVersion) | 24 | include (ValaVersion) |
9 | 25 | ensure_vala_version ("0.16.0" MINIMUM) | 25 | ensure_vala_version ("0.25.0" MINIMUM) |
10 | 26 | include (ValaPrecompile) | 26 | include (ValaPrecompile) |
11 | 27 | 27 | ||
12 | 28 | IF (LIB_ONLY) | 28 | IF (LIB_ONLY) |
13 | 29 | 29 | ||
14 | === modified file 'libcore/AbstractSidebar.vala' | |||
15 | --- libcore/AbstractSidebar.vala 2014-07-12 23:39:32 +0000 | |||
16 | +++ libcore/AbstractSidebar.vala 2014-09-24 07:03:43 +0000 | |||
17 | @@ -18,6 +18,18 @@ | |||
18 | 18 | ***/ | 18 | ***/ |
19 | 19 | 19 | ||
20 | 20 | namespace Marlin { | 20 | namespace Marlin { |
21 | 21 | |||
22 | 22 | public delegate void PluginCallbackFunc (Gtk.Widget widget); | ||
23 | 23 | public enum PlaceType { | ||
24 | 24 | BUILT_IN, | ||
25 | 25 | MOUNTED_VOLUME, | ||
26 | 26 | BOOKMARK, | ||
27 | 27 | BOOKMARKS_CATEGORY, | ||
28 | 28 | PERSONAL_CATEGORY, | ||
29 | 29 | STORAGE_CATEGORY, | ||
30 | 30 | PLUGIN_ITEM | ||
31 | 31 | } | ||
32 | 32 | |||
33 | 21 | public abstract class AbstractSidebar : Gtk.ScrolledWindow { | 33 | public abstract class AbstractSidebar : Gtk.ScrolledWindow { |
34 | 22 | public enum Column { | 34 | public enum Column { |
35 | 23 | NAME, | 35 | NAME, |
36 | @@ -37,10 +49,13 @@ | |||
37 | 37 | SPINNER_PULSE, | 49 | SPINNER_PULSE, |
38 | 38 | FREE_SPACE, | 50 | FREE_SPACE, |
39 | 39 | DISK_SIZE, | 51 | DISK_SIZE, |
40 | 52 | PLUGIN_CALLBACK, | ||
41 | 40 | COUNT | 53 | COUNT |
42 | 41 | } | 54 | } |
43 | 42 | 55 | ||
44 | 43 | protected Gtk.TreeStore store; | 56 | protected Gtk.TreeStore store; |
45 | 57 | protected Gtk.TreeRowReference network_category_reference; | ||
46 | 58 | protected Gtk.Box content_box; | ||
47 | 44 | 59 | ||
48 | 45 | protected void init () { | 60 | protected void init () { |
49 | 46 | store = new Gtk.TreeStore (((int)Column.COUNT), | 61 | store = new Gtk.TreeStore (((int)Column.COUNT), |
50 | @@ -60,18 +75,46 @@ | |||
51 | 60 | typeof (bool), /* Show spinner */ | 75 | typeof (bool), /* Show spinner */ |
52 | 61 | typeof (uint), /* Spinner pulse */ | 76 | typeof (uint), /* Spinner pulse */ |
53 | 62 | typeof (uint64), /* Free space */ | 77 | typeof (uint64), /* Free space */ |
55 | 63 | typeof (uint64) /* For disks, total size */ | 78 | typeof (uint64), /* For disks, total size */ |
56 | 79 | typeof (Marlin.PluginCallbackFunc) | ||
57 | 64 | ); | 80 | ); |
61 | 65 | } | 81 | |
62 | 66 | 82 | content_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); | |
63 | 67 | public void add_extra_item (string text) { | 83 | this.add (content_box); |
64 | 84 | content_box.show_all (); | ||
65 | 85 | } | ||
66 | 86 | |||
67 | 87 | public void add_extra_network_item (string text, string tooltip, Icon? icon, Marlin.PluginCallbackFunc? cb) { | ||
68 | 88 | add_extra_item (network_category_reference, text, tooltip, icon, cb); | ||
69 | 89 | } | ||
70 | 90 | |||
71 | 91 | public void add_extra_item (Gtk.TreeRowReference category, string text, string tooltip, Icon? icon, Marlin.PluginCallbackFunc? cb) { | ||
72 | 68 | Gtk.TreeIter iter; | 92 | Gtk.TreeIter iter; |
79 | 69 | store.append (out iter, null); | 93 | store.get_iter (out iter, category.get_path ()); |
80 | 70 | store.set (iter, | 94 | iter = add_place (PlaceType.PLUGIN_ITEM, |
81 | 71 | Column.ICON, null, | 95 | iter, |
82 | 72 | Column.NAME, text, | 96 | text, |
83 | 73 | Column.URI, "test://", | 97 | icon, |
84 | 74 | -1); | 98 | null, |
85 | 99 | null, | ||
86 | 100 | null, | ||
87 | 101 | null, | ||
88 | 102 | 0, | ||
89 | 103 | tooltip); | ||
90 | 104 | if (cb != null) | ||
91 | 105 | store.@set (iter, Column.PLUGIN_CALLBACK, cb); | ||
92 | 106 | |||
93 | 75 | } | 107 | } |
94 | 108 | |||
95 | 109 | protected abstract Gtk.TreeIter add_place (Marlin.PlaceType place_type, | ||
96 | 110 | Gtk.TreeIter? parent, | ||
97 | 111 | string name, | ||
98 | 112 | Icon? icon, | ||
99 | 113 | string? uri, | ||
100 | 114 | Drive? drive, | ||
101 | 115 | Volume? volume, | ||
102 | 116 | Mount? mount, | ||
103 | 117 | uint index, | ||
104 | 118 | string tooltip) ; | ||
105 | 76 | } | 119 | } |
106 | 77 | } | 120 | } |
107 | 78 | 121 | ||
108 | === modified file 'libcore/Plugin.vala' | |||
109 | --- libcore/Plugin.vala 2013-07-21 04:44:33 +0000 | |||
110 | +++ libcore/Plugin.vala 2014-09-24 07:03:43 +0000 | |||
111 | @@ -2,7 +2,7 @@ | |||
112 | 2 | public virtual void directory_loaded (void* data) { } | 2 | public virtual void directory_loaded (void* data) { } |
113 | 3 | public virtual void context_menu (Gtk.Widget? widget, List<GOF.File> files) { } | 3 | public virtual void context_menu (Gtk.Widget? widget, List<GOF.File> files) { } |
114 | 4 | public virtual void ui (Gtk.UIManager? widget) { } | 4 | public virtual void ui (Gtk.UIManager? widget) { } |
116 | 5 | public virtual void update_sidebar (Gtk.Widget sidebar) { } | 5 | public virtual void update_sidebar (Gtk.Widget widget) { } |
117 | 6 | public virtual void update_file_info (GOF.File file) { } | 6 | public virtual void update_file_info (GOF.File file) { } |
118 | 7 | 7 | ||
119 | 8 | public Gtk.Widget window; | 8 | public Gtk.Widget window; |
120 | 9 | 9 | ||
121 | === modified file 'libcore/PluginManager.vala' | |||
122 | --- libcore/PluginManager.vala 2014-05-17 10:37:01 +0000 | |||
123 | +++ libcore/PluginManager.vala 2014-09-24 07:03:43 +0000 | |||
124 | @@ -216,9 +216,9 @@ | |||
125 | 216 | plugin.interface_loaded (win); | 216 | plugin.interface_loaded (win); |
126 | 217 | } | 217 | } |
127 | 218 | 218 | ||
129 | 219 | public void update_sidebar (Gtk.Widget win) { | 219 | public void update_sidebar (Gtk.Widget widget) { |
130 | 220 | foreach (var plugin in plugin_hash.values) | 220 | foreach (var plugin in plugin_hash.values) |
132 | 221 | plugin.update_sidebar (win); | 221 | plugin.update_sidebar (widget); |
133 | 222 | } | 222 | } |
134 | 223 | 223 | ||
135 | 224 | public void update_file_info (GOF.File file) { | 224 | public void update_file_info (GOF.File file) { |
136 | 225 | 225 | ||
137 | === modified file 'plugins/network-places/plugin.vala' | |||
138 | --- plugins/network-places/plugin.vala 2013-05-27 10:54:46 +0000 | |||
139 | +++ plugins/network-places/plugin.vala 2014-09-24 07:03:43 +0000 | |||
140 | @@ -42,6 +42,13 @@ | |||
141 | 42 | infobar.show_all (); | 42 | infobar.show_all (); |
142 | 43 | } | 43 | } |
143 | 44 | } | 44 | } |
144 | 45 | |||
145 | 46 | public override void update_sidebar (Gtk.Widget widget) { | ||
146 | 47 | var sidebar = widget as Marlin.AbstractSidebar; | ||
147 | 48 | sidebar.add_extra_network_item (_("Connect to Server…"), _("Connect to a network file server"), | ||
148 | 49 | new ThemedIcon.with_default_fallbacks ("network-server"), | ||
149 | 50 | marlin_connect_server_dialog_show); | ||
150 | 51 | } | ||
151 | 45 | } | 52 | } |
152 | 46 | 53 | ||
153 | 47 | public Marlin.Plugins.Base module_init () { | 54 | public Marlin.Plugins.Base module_init () { |
154 | 48 | 55 | ||
155 | === modified file 'src/View/LocationBar.vala' | |||
156 | --- src/View/LocationBar.vala 2014-09-19 10:37:21 +0000 | |||
157 | +++ src/View/LocationBar.vala 2014-09-24 07:03:43 +0000 | |||
158 | @@ -354,7 +354,7 @@ | |||
159 | 354 | menu_item.set_image (new Gtk.Image.from_gicon (icon, Gtk.IconSize.MENU)); | 354 | menu_item.set_image (new Gtk.Image.from_gicon (icon, Gtk.IconSize.MENU)); |
160 | 355 | menu_item.always_show_image = true; | 355 | menu_item.always_show_image = true; |
161 | 356 | menu_item.activate.connect (() => { | 356 | menu_item.activate.connect (() => { |
163 | 357 | unowned AppInfo app = submenu_open_with.get_active ().get_data ("appinfo"); | 357 | AppInfo app = submenu_open_with.get_active ().get_data ("appinfo"); |
164 | 358 | launch_uri_with_app (app, current_right_click_path); | 358 | launch_uri_with_app (app, current_right_click_path); |
165 | 359 | }); | 359 | }); |
166 | 360 | submenu_open_with.append (menu_item); | 360 | submenu_open_with.append (menu_item); |
167 | @@ -374,7 +374,7 @@ | |||
168 | 374 | 374 | ||
169 | 375 | var response = dialog.run (); | 375 | var response = dialog.run (); |
170 | 376 | if (response == Gtk.ResponseType.OK) { | 376 | if (response == Gtk.ResponseType.OK) { |
172 | 377 | unowned AppInfo app = dialog.get_app_info (); | 377 | AppInfo app = dialog.get_app_info (); |
173 | 378 | launch_uri_with_app (app, current_right_click_path); | 378 | launch_uri_with_app (app, current_right_click_path); |
174 | 379 | } | 379 | } |
175 | 380 | 380 | ||
176 | 381 | 381 | ||
177 | === modified file 'src/View/Sidebar.vala' | |||
178 | --- src/View/Sidebar.vala 2014-08-09 23:33:45 +0000 | |||
179 | +++ src/View/Sidebar.vala 2014-09-24 07:03:43 +0000 | |||
180 | @@ -22,15 +22,6 @@ | |||
181 | 22 | namespace Marlin.Places { | 22 | namespace Marlin.Places { |
182 | 23 | public class Sidebar : Marlin.AbstractSidebar { | 23 | public class Sidebar : Marlin.AbstractSidebar { |
183 | 24 | 24 | ||
184 | 25 | enum PlaceType { | ||
185 | 26 | BUILT_IN, | ||
186 | 27 | MOUNTED_VOLUME, | ||
187 | 28 | BOOKMARK, | ||
188 | 29 | BOOKMARKS_CATEGORY, | ||
189 | 30 | PERSONAL_CATEGORY, | ||
190 | 31 | STORAGE_CATEGORY | ||
191 | 32 | } | ||
192 | 33 | |||
193 | 34 | enum ViewWindowOpenFlags { | 25 | enum ViewWindowOpenFlags { |
194 | 35 | DEFAULT, | 26 | DEFAULT, |
195 | 36 | NEW_TAB, | 27 | NEW_TAB, |
196 | @@ -105,6 +96,7 @@ | |||
197 | 105 | 96 | ||
198 | 106 | Gtk.Menu popupmenu; | 97 | Gtk.Menu popupmenu; |
199 | 107 | Gtk.MenuItem popupmenu_open_in_new_tab_item; | 98 | Gtk.MenuItem popupmenu_open_in_new_tab_item; |
200 | 99 | Gtk.MenuItem popupmenu_open_in_new_window_item; | ||
201 | 108 | Gtk.MenuItem popupmenu_remove_item; | 100 | Gtk.MenuItem popupmenu_remove_item; |
202 | 109 | Gtk.MenuItem popupmenu_rename_item; | 101 | Gtk.MenuItem popupmenu_rename_item; |
203 | 110 | Gtk.MenuItem popupmenu_separator_item1; | 102 | Gtk.MenuItem popupmenu_separator_item1; |
204 | @@ -115,7 +107,6 @@ | |||
205 | 115 | Gtk.MenuItem popupmenu_rescan_item; | 107 | Gtk.MenuItem popupmenu_rescan_item; |
206 | 116 | Gtk.MenuItem popupmenu_format_item; | 108 | Gtk.MenuItem popupmenu_format_item; |
207 | 117 | Gtk.MenuItem popupmenu_empty_trash_item; | 109 | Gtk.MenuItem popupmenu_empty_trash_item; |
208 | 118 | Gtk.MenuItem popupmenu_connect_server_item; | ||
209 | 119 | Gtk.MenuItem popupmenu_start_item; | 110 | Gtk.MenuItem popupmenu_start_item; |
210 | 120 | Gtk.MenuItem popupmenu_stop_item; | 111 | Gtk.MenuItem popupmenu_stop_item; |
211 | 121 | 112 | ||
212 | @@ -139,7 +130,7 @@ | |||
213 | 139 | construct_tree_view (); | 130 | construct_tree_view (); |
214 | 140 | configure_tree_view (); | 131 | configure_tree_view (); |
215 | 141 | connect_tree_view_signals (); | 132 | connect_tree_view_signals (); |
217 | 142 | this.add (this.tree_view); | 133 | this.content_box.pack_start (this.tree_view, true); |
218 | 143 | 134 | ||
219 | 144 | this.bookmarks = Marlin.BookmarkList.get_instance (); | 135 | this.bookmarks = Marlin.BookmarkList.get_instance (); |
220 | 145 | bookmarks.contents_changed.connect (update_places); | 136 | bookmarks.contents_changed.connect (update_places); |
221 | @@ -301,16 +292,16 @@ | |||
222 | 301 | eject_icon = new ThemedIcon.with_default_fallbacks ("media-eject-symbolic"); | 292 | eject_icon = new ThemedIcon.with_default_fallbacks ("media-eject-symbolic"); |
223 | 302 | } | 293 | } |
224 | 303 | 294 | ||
235 | 304 | private Gtk.TreeIter add_place (PlaceType place_type, | 295 | protected override Gtk.TreeIter add_place (Marlin.PlaceType place_type, |
236 | 305 | Gtk.TreeIter parent, | 296 | Gtk.TreeIter? parent, |
237 | 306 | string name, | 297 | string name, |
238 | 307 | Icon? icon, | 298 | Icon? icon, |
239 | 308 | string? uri, | 299 | string? uri, |
240 | 309 | Drive? drive, | 300 | Drive? drive, |
241 | 310 | Volume? volume, | 301 | Volume? volume, |
242 | 311 | Mount? mount, | 302 | Mount? mount, |
243 | 312 | uint index, | 303 | uint index, |
244 | 313 | string tooltip) { | 304 | string tooltip) { |
245 | 314 | Gtk.IconSize stock_size = Marlin.zoom_level_to_stock_icon_size (zoom_level); | 305 | Gtk.IconSize stock_size = Marlin.zoom_level_to_stock_icon_size (zoom_level); |
246 | 315 | eject_spinner_cell_renderer.icon_size = stock_size; | 306 | eject_spinner_cell_renderer.icon_size = stock_size; |
247 | 316 | 307 | ||
248 | @@ -324,7 +315,7 @@ | |||
249 | 324 | bool show_eject, show_unmount; | 315 | bool show_eject, show_unmount; |
250 | 325 | check_unmount_and_eject (mount, volume, drive, out show_unmount, out show_eject); | 316 | check_unmount_and_eject (mount, volume, drive, out show_unmount, out show_eject); |
251 | 326 | if (show_unmount || show_eject) | 317 | if (show_unmount || show_eject) |
253 | 327 | assert (place_type != PlaceType.BOOKMARK); | 318 | assert (place_type != Marlin.PlaceType.BOOKMARK); |
254 | 328 | 319 | ||
255 | 329 | bool show_eject_button = false; | 320 | bool show_eject_button = false; |
256 | 330 | if (mount != null) | 321 | if (mount != null) |
257 | @@ -356,7 +347,7 @@ | |||
258 | 356 | Column.INDEX, index, | 347 | Column.INDEX, index, |
259 | 357 | Column.EJECT, show_eject_button, | 348 | Column.EJECT, show_eject_button, |
260 | 358 | Column.NO_EJECT, !show_eject_button, | 349 | Column.NO_EJECT, !show_eject_button, |
262 | 359 | Column.BOOKMARK, place_type == PlaceType.BOOKMARK, | 350 | Column.BOOKMARK, place_type == Marlin.PlaceType.BOOKMARK, |
263 | 360 | Column.TOOLTIP, tooltip, | 351 | Column.TOOLTIP, tooltip, |
264 | 361 | Column.EJECT_ICON, eject, | 352 | Column.EJECT_ICON, eject, |
265 | 362 | Column.SHOW_SPINNER, false, | 353 | Column.SHOW_SPINNER, false, |
266 | @@ -386,14 +377,13 @@ | |||
267 | 386 | last_selected_uri = null; | 377 | last_selected_uri = null; |
268 | 387 | 378 | ||
269 | 388 | store.clear (); | 379 | store.clear (); |
270 | 389 | plugins.update_sidebar ((Gtk.Widget)this); | ||
271 | 390 | 380 | ||
272 | 391 | /* ADD BOOKMARKS CATEGORY*/ | 381 | /* ADD BOOKMARKS CATEGORY*/ |
273 | 392 | store.append (out iter, null); | 382 | store.append (out iter, null); |
274 | 393 | store.@set (iter, | 383 | store.@set (iter, |
275 | 394 | Column.ICON, null, | 384 | Column.ICON, null, |
276 | 395 | Column.NAME, _("Personal"), | 385 | Column.NAME, _("Personal"), |
278 | 396 | Column.ROW_TYPE, PlaceType.BOOKMARKS_CATEGORY, | 386 | Column.ROW_TYPE, Marlin.PlaceType.BOOKMARKS_CATEGORY, |
279 | 397 | Column.EJECT, false, | 387 | Column.EJECT, false, |
280 | 398 | Column.NO_EJECT, true, | 388 | Column.NO_EJECT, true, |
281 | 399 | Column.BOOKMARK, false, | 389 | Column.BOOKMARK, false, |
282 | @@ -407,7 +397,7 @@ | |||
283 | 407 | mount_uri = ""; | 397 | mount_uri = ""; |
284 | 408 | } | 398 | } |
285 | 409 | 399 | ||
287 | 410 | add_place (PlaceType.BUILT_IN, | 400 | add_place (Marlin.PlaceType.BUILT_IN, |
288 | 411 | iter, | 401 | iter, |
289 | 412 | _("Home"), | 402 | _("Home"), |
290 | 413 | new ThemedIcon (Marlin.ICON_HOME), | 403 | new ThemedIcon (Marlin.ICON_HOME), |
291 | @@ -434,7 +424,7 @@ | |||
292 | 434 | } | 424 | } |
293 | 435 | 425 | ||
294 | 436 | /* Add trash */ | 426 | /* Add trash */ |
296 | 437 | add_place (PlaceType.BUILT_IN, | 427 | add_place (Marlin.PlaceType.BUILT_IN, |
297 | 438 | iter, | 428 | iter, |
298 | 439 | _("Trash"), | 429 | _("Trash"), |
299 | 440 | Marlin.TrashMonitor.get_icon (), | 430 | Marlin.TrashMonitor.get_icon (), |
300 | @@ -450,14 +440,14 @@ | |||
301 | 450 | store.@set (iter, | 440 | store.@set (iter, |
302 | 451 | Column.ICON, null, | 441 | Column.ICON, null, |
303 | 452 | Column.NAME, _("Devices"), | 442 | Column.NAME, _("Devices"), |
305 | 453 | Column.ROW_TYPE, PlaceType.STORAGE_CATEGORY, | 443 | Column.ROW_TYPE, Marlin.PlaceType.STORAGE_CATEGORY, |
306 | 454 | Column.EJECT, false, | 444 | Column.EJECT, false, |
307 | 455 | Column.NO_EJECT, true, | 445 | Column.NO_EJECT, true, |
308 | 456 | Column.BOOKMARK, false, | 446 | Column.BOOKMARK, false, |
309 | 457 | Column.TOOLTIP, _("Your local partitions and devices")); | 447 | Column.TOOLTIP, _("Your local partitions and devices")); |
310 | 458 | 448 | ||
311 | 459 | /* Add Filesystem BUILTIN */ | 449 | /* Add Filesystem BUILTIN */ |
313 | 460 | add_place (PlaceType.BUILT_IN, | 450 | add_place (Marlin.PlaceType.BUILT_IN, |
314 | 461 | iter, | 451 | iter, |
315 | 462 | _("File System"), | 452 | _("File System"), |
316 | 463 | new ThemedIcon.with_default_fallbacks (Marlin.ICON_FILESYSTEM), | 453 | new ThemedIcon.with_default_fallbacks (Marlin.ICON_FILESYSTEM), |
317 | @@ -487,7 +477,7 @@ | |||
318 | 487 | * in the OS to save battery juice. | 477 | * in the OS to save battery juice. |
319 | 488 | */ | 478 | */ |
320 | 489 | var name = drive.get_name (); | 479 | var name = drive.get_name (); |
322 | 490 | add_place (PlaceType.BUILT_IN, | 480 | add_place (Marlin.PlaceType.BUILT_IN, |
323 | 491 | iter, | 481 | iter, |
324 | 492 | name, | 482 | name, |
325 | 493 | drive.get_icon (), | 483 | drive.get_icon (), |
326 | @@ -508,7 +498,7 @@ | |||
327 | 508 | var mount = volume.get_mount (); | 498 | var mount = volume.get_mount (); |
328 | 509 | if (mount != null) { | 499 | if (mount != null) { |
329 | 510 | var root = mount.get_default_location (); | 500 | var root = mount.get_default_location (); |
331 | 511 | add_place (PlaceType.MOUNTED_VOLUME, | 501 | add_place (Marlin.PlaceType.MOUNTED_VOLUME, |
332 | 512 | iter, | 502 | iter, |
333 | 513 | mount.get_name (), | 503 | mount.get_name (), |
334 | 514 | mount.get_icon (), | 504 | mount.get_icon (), |
335 | @@ -521,7 +511,7 @@ | |||
336 | 521 | } else { | 511 | } else { |
337 | 522 | /* see comment above in why we add an icon for an unmounted mountable volume */ | 512 | /* see comment above in why we add an icon for an unmounted mountable volume */ |
338 | 523 | var name = volume.get_name (); | 513 | var name = volume.get_name (); |
340 | 524 | add_place (PlaceType.MOUNTED_VOLUME, | 514 | add_place (Marlin.PlaceType.MOUNTED_VOLUME, |
341 | 525 | iter, | 515 | iter, |
342 | 526 | name, | 516 | name, |
343 | 527 | volume.get_icon (), | 517 | volume.get_icon (), |
344 | @@ -553,7 +543,7 @@ | |||
345 | 553 | } | 543 | } |
346 | 554 | } | 544 | } |
347 | 555 | 545 | ||
349 | 556 | add_place (PlaceType.MOUNTED_VOLUME, | 546 | add_place (Marlin.PlaceType.MOUNTED_VOLUME, |
350 | 557 | iter, | 547 | iter, |
351 | 558 | mount.get_name (), | 548 | mount.get_name (), |
352 | 559 | mount.get_icon (), | 549 | mount.get_icon (), |
353 | @@ -570,17 +560,19 @@ | |||
354 | 570 | store.@set (iter, | 560 | store.@set (iter, |
355 | 571 | Column.ICON, null, | 561 | Column.ICON, null, |
356 | 572 | Column.NAME, _("Network"), | 562 | Column.NAME, _("Network"), |
358 | 573 | Column.ROW_TYPE, PlaceType.STORAGE_CATEGORY, | 563 | Column.ROW_TYPE, Marlin.PlaceType.STORAGE_CATEGORY, |
359 | 574 | Column.EJECT, false, | 564 | Column.EJECT, false, |
360 | 575 | Column.NO_EJECT, true, | 565 | Column.NO_EJECT, true, |
361 | 576 | Column.BOOKMARK, false, | 566 | Column.BOOKMARK, false, |
362 | 577 | Column.TOOLTIP, _("Your network places")); | 567 | Column.TOOLTIP, _("Your network places")); |
363 | 578 | 568 | ||
364 | 569 | network_category_reference = new Gtk.TreeRowReference (store, store.get_path (iter)); | ||
365 | 570 | |||
366 | 579 | /* Add network mounts */ | 571 | /* Add network mounts */ |
367 | 580 | network_mounts.reverse (); | 572 | network_mounts.reverse (); |
368 | 581 | foreach (Mount mount in network_mounts) { | 573 | foreach (Mount mount in network_mounts) { |
369 | 582 | var root = mount.get_default_location (); | 574 | var root = mount.get_default_location (); |
371 | 583 | add_place (PlaceType.BUILT_IN, | 575 | add_place (Marlin.PlaceType.BUILT_IN, |
372 | 584 | iter, | 576 | iter, |
373 | 585 | mount.get_name (), | 577 | mount.get_name (), |
374 | 586 | mount.get_icon (), | 578 | mount.get_icon (), |
375 | @@ -593,7 +585,7 @@ | |||
376 | 593 | } | 585 | } |
377 | 594 | 586 | ||
378 | 595 | /* Add Entire Network BUILTIN */ | 587 | /* Add Entire Network BUILTIN */ |
380 | 596 | add_place (PlaceType.BUILT_IN, | 588 | add_place (Marlin.PlaceType.BUILT_IN, |
381 | 597 | iter, | 589 | iter, |
382 | 598 | _("Entire Network"), | 590 | _("Entire Network"), |
383 | 599 | new GLib.ThemedIcon (Marlin.ICON_NETWORK), | 591 | new GLib.ThemedIcon (Marlin.ICON_NETWORK), |
384 | @@ -604,6 +596,8 @@ | |||
385 | 604 | 0, | 596 | 0, |
386 | 605 | _("Browse the contents of the network")); | 597 | _("Browse the contents of the network")); |
387 | 606 | 598 | ||
388 | 599 | plugins.update_sidebar ((Gtk.Widget)this); | ||
389 | 600 | |||
390 | 607 | expander_init_pref_state (tree_view); | 601 | expander_init_pref_state (tree_view); |
391 | 608 | 602 | ||
392 | 609 | /* select any previously selected place or any place matching slot location */ | 603 | /* select any previously selected place or any place matching slot location */ |
393 | @@ -614,7 +608,7 @@ | |||
394 | 614 | } | 608 | } |
395 | 615 | 609 | ||
396 | 616 | private void add_bookmark (Gtk.TreeIter iter, Marlin.Bookmark bm, uint index) { | 610 | private void add_bookmark (Gtk.TreeIter iter, Marlin.Bookmark bm, uint index) { |
398 | 617 | add_place ( PlaceType.BOOKMARK, | 611 | add_place ( Marlin.PlaceType.BOOKMARK, |
399 | 618 | iter, | 612 | iter, |
400 | 619 | bm.label.dup (), | 613 | bm.label.dup (), |
401 | 620 | bm.get_icon (), | 614 | bm.get_icon (), |
402 | @@ -635,7 +629,7 @@ | |||
403 | 635 | if (mount != null) { | 629 | if (mount != null) { |
404 | 636 | /* show mounted volume in sidebar */ | 630 | /* show mounted volume in sidebar */ |
405 | 637 | var root = mount.get_default_location (); | 631 | var root = mount.get_default_location (); |
407 | 638 | last_iter = add_place (PlaceType.MOUNTED_VOLUME, | 632 | last_iter = add_place (Marlin.PlaceType.MOUNTED_VOLUME, |
408 | 639 | iter, | 633 | iter, |
409 | 640 | mount.get_name (), | 634 | mount.get_name (), |
410 | 641 | mount.get_icon (), | 635 | mount.get_icon (), |
411 | @@ -661,7 +655,7 @@ | |||
412 | 661 | * he just unmounted it. | 655 | * he just unmounted it. |
413 | 662 | */ | 656 | */ |
414 | 663 | var name = volume.get_name (); | 657 | var name = volume.get_name (); |
416 | 664 | add_place (PlaceType.MOUNTED_VOLUME, | 658 | add_place (Marlin.PlaceType.MOUNTED_VOLUME, |
417 | 665 | iter, | 659 | iter, |
418 | 666 | name, | 660 | name, |
419 | 667 | volume.get_icon (), | 661 | volume.get_icon (), |
420 | @@ -673,7 +667,7 @@ | |||
421 | 673 | (_("Mount and open %s")).printf (name)); | 667 | (_("Mount and open %s")).printf (name)); |
422 | 674 | } | 668 | } |
423 | 675 | } | 669 | } |
425 | 676 | } | 670 | } |
426 | 677 | 671 | ||
427 | 678 | private void get_filesystem_space (GLib.File root, out uint64 fs_capacity, out uint64 fs_free) { | 672 | private void get_filesystem_space (GLib.File root, out uint64 fs_capacity, out uint64 fs_free) { |
428 | 679 | GLib.FileInfo info; | 673 | GLib.FileInfo info; |
429 | @@ -843,14 +837,14 @@ | |||
430 | 843 | private bool process_drop_between (Gtk.TreeIter iter, | 837 | private bool process_drop_between (Gtk.TreeIter iter, |
431 | 844 | Gtk.TreeViewDropPosition drop_pos, | 838 | Gtk.TreeViewDropPosition drop_pos, |
432 | 845 | uint info) { | 839 | uint info) { |
434 | 846 | PlaceType type; | 840 | Marlin.PlaceType type; |
435 | 847 | uint position; | 841 | uint position; |
436 | 848 | store.@get (iter, | 842 | store.@get (iter, |
437 | 849 | Column.ROW_TYPE, out type, | 843 | Column.ROW_TYPE, out type, |
438 | 850 | Column.INDEX, out position); | 844 | Column.INDEX, out position); |
439 | 851 | 845 | ||
442 | 852 | if (type == PlaceType.BOOKMARK || type == PlaceType.BUILT_IN) { | 846 | if (type == Marlin.PlaceType.BOOKMARK || type == Marlin.PlaceType.BUILT_IN) { |
443 | 853 | if (type == PlaceType.BOOKMARK && drop_pos == Gtk.TreeViewDropPosition.BEFORE) | 847 | if (type == Marlin.PlaceType.BOOKMARK && drop_pos == Gtk.TreeViewDropPosition.BEFORE) |
444 | 854 | position--; | 848 | position--; |
445 | 855 | 849 | ||
446 | 856 | switch (info) { | 850 | switch (info) { |
447 | @@ -1044,7 +1038,8 @@ | |||
448 | 1044 | return; | 1038 | return; |
449 | 1045 | 1039 | ||
450 | 1046 | string uri; | 1040 | string uri; |
452 | 1047 | store.@get (iter, Column.URI, out uri); | 1041 | Marlin.PluginCallbackFunc f; |
453 | 1042 | store.@get (iter, Column.URI, out uri, Column.PLUGIN_CALLBACK, out f); | ||
454 | 1048 | 1043 | ||
455 | 1049 | if (uri != null) { | 1044 | if (uri != null) { |
456 | 1050 | var location = File.new_for_uri (uri); | 1045 | var location = File.new_for_uri (uri); |
457 | @@ -1058,6 +1053,8 @@ | |||
458 | 1058 | if (slot != null) | 1053 | if (slot != null) |
459 | 1059 | GLib.Signal.emit_by_name (slot.ctab, "path-changed", location); | 1054 | GLib.Signal.emit_by_name (slot.ctab, "path-changed", location); |
460 | 1060 | } | 1055 | } |
461 | 1056 | } else if (f != null) { | ||
462 | 1057 | f (this); | ||
463 | 1061 | } else if (!ejecting_or_unmounting) { | 1058 | } else if (!ejecting_or_unmounting) { |
464 | 1062 | Drive drive; | 1059 | Drive drive; |
465 | 1063 | Volume volume; | 1060 | Volume volume; |
466 | @@ -1199,6 +1196,7 @@ | |||
467 | 1199 | popupmenu.append (item); | 1196 | popupmenu.append (item); |
468 | 1200 | 1197 | ||
469 | 1201 | item = new Gtk.ImageMenuItem.with_mnemonic (_("Open in New _Window")); | 1198 | item = new Gtk.ImageMenuItem.with_mnemonic (_("Open in New _Window")); |
470 | 1199 | popupmenu_open_in_new_window_item = item; | ||
471 | 1202 | item.activate.connect (open_shortcut_in_new_window_cb); | 1200 | item.activate.connect (open_shortcut_in_new_window_cb); |
472 | 1203 | item.show (); | 1201 | item.show (); |
473 | 1204 | popupmenu.append (item); | 1202 | popupmenu.append (item); |
474 | @@ -1246,14 +1244,6 @@ | |||
475 | 1246 | item.activate.connect (empty_trash_cb); | 1244 | item.activate.connect (empty_trash_cb); |
476 | 1247 | item.show (); | 1245 | item.show (); |
477 | 1248 | popupmenu.append (item); | 1246 | popupmenu.append (item); |
478 | 1249 | |||
479 | 1250 | /* Connect to server menu item */ | ||
480 | 1251 | item = new Gtk.ImageMenuItem.with_mnemonic (_("Connect to Server...")); | ||
481 | 1252 | popupmenu_connect_server_item = item; | ||
482 | 1253 | item.activate.connect (connect_server_cb); | ||
483 | 1254 | item.show (); | ||
484 | 1255 | popupmenu.append (item); | ||
485 | 1256 | |||
486 | 1257 | check_popup_sensitivity (); | 1247 | check_popup_sensitivity (); |
487 | 1258 | } | 1248 | } |
488 | 1259 | 1249 | ||
489 | @@ -1284,7 +1274,6 @@ | |||
490 | 1284 | popupmenu_start_item = null; | 1274 | popupmenu_start_item = null; |
491 | 1285 | popupmenu_stop_item = null; | 1275 | popupmenu_stop_item = null; |
492 | 1286 | popupmenu_empty_trash_item = null; | 1276 | popupmenu_empty_trash_item = null; |
493 | 1287 | popupmenu_connect_server_item = null; | ||
494 | 1288 | } | 1277 | } |
495 | 1289 | 1278 | ||
496 | 1290 | /* Callback used for the GtkWidget::popup-menu signal of the shortcuts list */ | 1279 | /* Callback used for the GtkWidget::popup-menu signal of the shortcuts list */ |
497 | @@ -1388,26 +1377,26 @@ | |||
498 | 1388 | Gtk.CellRenderer cell, | 1377 | Gtk.CellRenderer cell, |
499 | 1389 | Gtk.TreeModel model, | 1378 | Gtk.TreeModel model, |
500 | 1390 | Gtk.TreeIter iter) { | 1379 | Gtk.TreeIter iter) { |
502 | 1391 | PlaceType type; | 1380 | Marlin.PlaceType type; |
503 | 1392 | store.@get (iter, Column.ROW_TYPE, out type, -1); | 1381 | store.@get (iter, Column.ROW_TYPE, out type, -1); |
504 | 1393 | 1382 | ||
508 | 1394 | if (type == PlaceType.PERSONAL_CATEGORY || | 1383 | if (type == Marlin.PlaceType.PERSONAL_CATEGORY || |
509 | 1395 | type == PlaceType.STORAGE_CATEGORY || | 1384 | type == Marlin.PlaceType.STORAGE_CATEGORY || |
510 | 1396 | type == PlaceType.BOOKMARKS_CATEGORY) | 1385 | type == Marlin.PlaceType.BOOKMARKS_CATEGORY) |
511 | 1397 | expander_renderer.visible = true; | 1386 | expander_renderer.visible = true; |
512 | 1398 | else | 1387 | else |
513 | 1399 | expander_renderer.visible = false; | 1388 | expander_renderer.visible = false; |
514 | 1400 | } | 1389 | } |
515 | 1401 | 1390 | ||
517 | 1402 | private void expander_update_pref_state (PlaceType type, bool flag) { | 1391 | private void expander_update_pref_state (Marlin.PlaceType type, bool flag) { |
518 | 1403 | switch (type) { | 1392 | switch (type) { |
520 | 1404 | case PlaceType.PERSONAL_CATEGORY: | 1393 | case Marlin.PlaceType.PERSONAL_CATEGORY: |
521 | 1405 | Preferences.settings.set_boolean ("sidebar-cat-network-expander", flag); | 1394 | Preferences.settings.set_boolean ("sidebar-cat-network-expander", flag); |
522 | 1406 | break; | 1395 | break; |
524 | 1407 | case PlaceType.STORAGE_CATEGORY: | 1396 | case Marlin.PlaceType.STORAGE_CATEGORY: |
525 | 1408 | Preferences.settings.set_boolean ("sidebar-cat-devices-expander", flag); | 1397 | Preferences.settings.set_boolean ("sidebar-cat-devices-expander", flag); |
526 | 1409 | break; | 1398 | break; |
528 | 1410 | case PlaceType.BOOKMARKS_CATEGORY: | 1399 | case Marlin.PlaceType.BOOKMARKS_CATEGORY: |
529 | 1411 | Preferences.settings.set_boolean ("sidebar-cat-personal-expander", flag); | 1400 | Preferences.settings.set_boolean ("sidebar-cat-personal-expander", flag); |
530 | 1412 | break; | 1401 | break; |
531 | 1413 | } | 1402 | } |
532 | @@ -1438,13 +1427,13 @@ | |||
533 | 1438 | Gtk.CellRenderer renderer, | 1427 | Gtk.CellRenderer renderer, |
534 | 1439 | Gtk.TreeModel model, | 1428 | Gtk.TreeModel model, |
535 | 1440 | Gtk.TreeIter iter) { | 1429 | Gtk.TreeIter iter) { |
537 | 1441 | PlaceType type; | 1430 | Marlin.PlaceType type; |
538 | 1442 | Gtk.CellRendererText crt = renderer as Gtk.CellRendererText; | 1431 | Gtk.CellRendererText crt = renderer as Gtk.CellRendererText; |
539 | 1443 | model.@get (iter, Column.ROW_TYPE, out type, -1); | 1432 | model.@get (iter, Column.ROW_TYPE, out type, -1); |
540 | 1444 | 1433 | ||
544 | 1445 | if (type == PlaceType.PERSONAL_CATEGORY || | 1434 | if (type == Marlin.PlaceType.PERSONAL_CATEGORY || |
545 | 1446 | type == PlaceType.STORAGE_CATEGORY || | 1435 | type == Marlin.PlaceType.STORAGE_CATEGORY || |
546 | 1447 | type == PlaceType.BOOKMARKS_CATEGORY) { | 1436 | type == Marlin.PlaceType.BOOKMARKS_CATEGORY) { |
547 | 1448 | 1437 | ||
548 | 1449 | crt.weight = 900; | 1438 | crt.weight = 900; |
549 | 1450 | crt.weight_set = true; | 1439 | crt.weight_set = true; |
550 | @@ -1466,7 +1455,7 @@ | |||
551 | 1466 | private void category_row_expanded_event_cb (Gtk.TreeView tree, | 1455 | private void category_row_expanded_event_cb (Gtk.TreeView tree, |
552 | 1467 | Gtk.TreeIter iter, | 1456 | Gtk.TreeIter iter, |
553 | 1468 | Gtk.TreePath path) { | 1457 | Gtk.TreePath path) { |
555 | 1469 | PlaceType type; | 1458 | Marlin.PlaceType type; |
556 | 1470 | store.@get (iter, Column.ROW_TYPE, out type); | 1459 | store.@get (iter, Column.ROW_TYPE, out type); |
557 | 1471 | expander_update_pref_state (type, true); | 1460 | expander_update_pref_state (type, true); |
558 | 1472 | } | 1461 | } |
559 | @@ -1474,7 +1463,7 @@ | |||
560 | 1474 | private void category_row_collapsed_event_cb (Gtk.TreeView tree, | 1463 | private void category_row_collapsed_event_cb (Gtk.TreeView tree, |
561 | 1475 | Gtk.TreeIter iter, | 1464 | Gtk.TreeIter iter, |
562 | 1476 | Gtk.TreePath path) { | 1465 | Gtk.TreePath path) { |
564 | 1477 | PlaceType type; | 1466 | Marlin.PlaceType type; |
565 | 1478 | store.@get (iter, Column.ROW_TYPE, out type); | 1467 | store.@get (iter, Column.ROW_TYPE, out type); |
566 | 1479 | expander_update_pref_state (type, false); | 1468 | expander_update_pref_state (type, false); |
567 | 1480 | } | 1469 | } |
568 | @@ -1886,11 +1875,6 @@ | |||
569 | 1886 | Marlin.FileOperations.empty_trash (window); | 1875 | Marlin.FileOperations.empty_trash (window); |
570 | 1887 | } | 1876 | } |
571 | 1888 | 1877 | ||
572 | 1889 | private void connect_server_cb (Gtk.MenuItem item) { | ||
573 | 1890 | var dialog = new Marlin.ConnectServer.Dialog (window); | ||
574 | 1891 | dialog.show (); | ||
575 | 1892 | } | ||
576 | 1893 | |||
577 | 1894 | /* VOLUME MONITOR CALLBACK FUNCTIONS */ | 1878 | /* VOLUME MONITOR CALLBACK FUNCTIONS */ |
578 | 1895 | 1879 | ||
579 | 1896 | private void mount_added_callback (Mount mount) { | 1880 | private void mount_added_callback (Mount mount) { |
580 | @@ -2007,7 +1991,7 @@ | |||
581 | 2007 | if (!get_selected_iter (out iter)) | 1991 | if (!get_selected_iter (out iter)) |
582 | 2008 | return; | 1992 | return; |
583 | 2009 | 1993 | ||
585 | 2010 | PlaceType type; | 1994 | Marlin.PlaceType type; |
586 | 2011 | Drive drive; | 1995 | Drive drive; |
587 | 2012 | Volume volume; | 1996 | Volume volume; |
588 | 2013 | Mount mount; | 1997 | Mount mount; |
589 | @@ -2039,18 +2023,18 @@ | |||
590 | 2039 | out show_stop); | 2023 | out show_stop); |
591 | 2040 | 2024 | ||
592 | 2041 | bool show_empty_trash = (uri != null) && (uri == Marlin.TRASH_URI); | 2025 | bool show_empty_trash = (uri != null) && (uri == Marlin.TRASH_URI); |
593 | 2042 | bool show_connect_server = (uri != null) && (uri == Marlin.NETWORK_URI); | ||
594 | 2043 | Eel.gtk_widget_set_shown (popupmenu_separator_item2, | 2026 | Eel.gtk_widget_set_shown (popupmenu_separator_item2, |
595 | 2044 | show_eject || show_unmount || | 2027 | show_eject || show_unmount || |
598 | 2045 | show_mount || show_empty_trash || | 2028 | show_mount || show_empty_trash); |
597 | 2046 | show_connect_server); | ||
599 | 2047 | Eel.gtk_widget_set_shown (popupmenu_mount_item, show_mount); | 2029 | Eel.gtk_widget_set_shown (popupmenu_mount_item, show_mount); |
600 | 2048 | Eel.gtk_widget_set_shown (popupmenu_unmount_item, show_unmount); | 2030 | Eel.gtk_widget_set_shown (popupmenu_unmount_item, show_unmount); |
601 | 2049 | Eel.gtk_widget_set_shown (popupmenu_eject_item, show_eject); | 2031 | Eel.gtk_widget_set_shown (popupmenu_eject_item, show_eject); |
602 | 2050 | Eel.gtk_widget_set_shown (popupmenu_empty_trash_item, show_empty_trash); | 2032 | Eel.gtk_widget_set_shown (popupmenu_empty_trash_item, show_empty_trash); |
603 | 2051 | popupmenu_empty_trash_item.set_sensitive (!(Marlin.TrashMonitor.is_empty ())); | 2033 | popupmenu_empty_trash_item.set_sensitive (!(Marlin.TrashMonitor.is_empty ())); |
604 | 2052 | 2034 | ||
606 | 2053 | Eel.gtk_widget_set_shown (popupmenu_connect_server_item, show_connect_server); | 2035 | bool is_plugin = (type == Marlin.PlaceType.PLUGIN_ITEM); |
607 | 2036 | Eel.gtk_widget_set_shown (popupmenu_open_in_new_tab_item, !is_plugin); | ||
608 | 2037 | Eel.gtk_widget_set_shown (popupmenu_open_in_new_window_item, !is_plugin); | ||
609 | 2054 | } | 2038 | } |
610 | 2055 | 2039 | ||
611 | 2056 | /** | 2040 | /** |
"Connect server" should be "Connect to Server"
I think a better icon might be "network-server" or "network-workgroup"
Also Cody's screenshot shows that there has been some kind of theme issue introduced. The widget no longer expands to fill the height of the pane