Merge lp:~jeremywootten/pantheon-files/connect-server-plugin-in-sidebar into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
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
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

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.

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) 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

review: Needs Fixing
1594. By Jeremy Wootten

change icon, change text, make sidebar content expand

Revision history for this message
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.ICON_NETWORK_SERVER should really have been used (defined in /src/View/Resources.vala) but I need the advice of a cmake expert how to make this visible to /plugins/network-places/plugin.vala

review: Needs Resubmitting
Revision history for this message
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://elementaryos.org/docs/human-interface-guidelines/using-ellipses

review: Needs Fixing
1595. By Jeremy Wootten

Fix label text, hide irrelevant context menu items, more generic plugin interface to sidebar, upgrade to valac 0.25.4

Revision history for this message
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2014-08-05 18:18:49 +0000
+++ CMakeLists.txt 2014-09-24 07:03:43 +0000
@@ -22,7 +22,7 @@
2222
23find_package (Vala REQUIRED)23find_package (Vala REQUIRED)
24include (ValaVersion)24include (ValaVersion)
25ensure_vala_version ("0.16.0" MINIMUM)25ensure_vala_version ("0.25.0" MINIMUM)
26include (ValaPrecompile)26include (ValaPrecompile)
2727
28IF (LIB_ONLY)28IF (LIB_ONLY)
2929
=== modified file 'libcore/AbstractSidebar.vala'
--- libcore/AbstractSidebar.vala 2014-07-12 23:39:32 +0000
+++ libcore/AbstractSidebar.vala 2014-09-24 07:03:43 +0000
@@ -18,6 +18,18 @@
18***/18***/
1919
20namespace Marlin {20namespace Marlin {
21
22 public delegate void PluginCallbackFunc (Gtk.Widget widget);
23 public enum PlaceType {
24 BUILT_IN,
25 MOUNTED_VOLUME,
26 BOOKMARK,
27 BOOKMARKS_CATEGORY,
28 PERSONAL_CATEGORY,
29 STORAGE_CATEGORY,
30 PLUGIN_ITEM
31 }
32
21 public abstract class AbstractSidebar : Gtk.ScrolledWindow {33 public abstract class AbstractSidebar : Gtk.ScrolledWindow {
22 public enum Column {34 public enum Column {
23 NAME,35 NAME,
@@ -37,10 +49,13 @@
37 SPINNER_PULSE,49 SPINNER_PULSE,
38 FREE_SPACE,50 FREE_SPACE,
39 DISK_SIZE,51 DISK_SIZE,
52 PLUGIN_CALLBACK,
40 COUNT53 COUNT
41 }54 }
4255
43 protected Gtk.TreeStore store;56 protected Gtk.TreeStore store;
57 protected Gtk.TreeRowReference network_category_reference;
58 protected Gtk.Box content_box;
4459
45 protected void init () {60 protected void init () {
46 store = new Gtk.TreeStore (((int)Column.COUNT),61 store = new Gtk.TreeStore (((int)Column.COUNT),
@@ -60,18 +75,46 @@
60 typeof (bool), /* Show spinner */75 typeof (bool), /* Show spinner */
61 typeof (uint), /* Spinner pulse */76 typeof (uint), /* Spinner pulse */
62 typeof (uint64), /* Free space */77 typeof (uint64), /* Free space */
63 typeof (uint64) /* For disks, total size */78 typeof (uint64), /* For disks, total size */
79 typeof (Marlin.PluginCallbackFunc)
64 );80 );
65 }81
6682 content_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
67 public void add_extra_item (string text) {83 this.add (content_box);
84 content_box.show_all ();
85 }
86
87 public void add_extra_network_item (string text, string tooltip, Icon? icon, Marlin.PluginCallbackFunc? cb) {
88 add_extra_item (network_category_reference, text, tooltip, icon, cb);
89 }
90
91 public void add_extra_item (Gtk.TreeRowReference category, string text, string tooltip, Icon? icon, Marlin.PluginCallbackFunc? cb) {
68 Gtk.TreeIter iter;92 Gtk.TreeIter iter;
69 store.append (out iter, null);93 store.get_iter (out iter, category.get_path ());
70 store.set (iter,94 iter = add_place (PlaceType.PLUGIN_ITEM,
71 Column.ICON, null,95 iter,
72 Column.NAME, text,96 text,
73 Column.URI, "test://",97 icon,
74 -1);98 null,
99 null,
100 null,
101 null,
102 0,
103 tooltip);
104 if (cb != null)
105 store.@set (iter, Column.PLUGIN_CALLBACK, cb);
106
75 }107 }
108
109 protected abstract Gtk.TreeIter add_place (Marlin.PlaceType place_type,
110 Gtk.TreeIter? parent,
111 string name,
112 Icon? icon,
113 string? uri,
114 Drive? drive,
115 Volume? volume,
116 Mount? mount,
117 uint index,
118 string tooltip) ;
76 }119 }
77}120}
78121
=== modified file 'libcore/Plugin.vala'
--- libcore/Plugin.vala 2013-07-21 04:44:33 +0000
+++ libcore/Plugin.vala 2014-09-24 07:03:43 +0000
@@ -2,7 +2,7 @@
2 public virtual void directory_loaded (void* data) { }2 public virtual void directory_loaded (void* data) { }
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) { }
4 public virtual void ui (Gtk.UIManager? widget) { }4 public virtual void ui (Gtk.UIManager? widget) { }
5 public virtual void update_sidebar (Gtk.Widget sidebar) { }5 public virtual void update_sidebar (Gtk.Widget widget) { }
6 public virtual void update_file_info (GOF.File file) { }6 public virtual void update_file_info (GOF.File file) { }
77
8 public Gtk.Widget window;8 public Gtk.Widget window;
99
=== modified file 'libcore/PluginManager.vala'
--- libcore/PluginManager.vala 2014-05-17 10:37:01 +0000
+++ libcore/PluginManager.vala 2014-09-24 07:03:43 +0000
@@ -216,9 +216,9 @@
216 plugin.interface_loaded (win);216 plugin.interface_loaded (win);
217 }217 }
218218
219 public void update_sidebar (Gtk.Widget win) {219 public void update_sidebar (Gtk.Widget widget) {
220 foreach (var plugin in plugin_hash.values)220 foreach (var plugin in plugin_hash.values)
221 plugin.update_sidebar (win);221 plugin.update_sidebar (widget);
222 }222 }
223223
224 public void update_file_info (GOF.File file) {224 public void update_file_info (GOF.File file) {
225225
=== modified file 'plugins/network-places/plugin.vala'
--- plugins/network-places/plugin.vala 2013-05-27 10:54:46 +0000
+++ plugins/network-places/plugin.vala 2014-09-24 07:03:43 +0000
@@ -42,6 +42,13 @@
42 infobar.show_all ();42 infobar.show_all ();
43 }43 }
44 }44 }
45
46 public override void update_sidebar (Gtk.Widget widget) {
47 var sidebar = widget as Marlin.AbstractSidebar;
48 sidebar.add_extra_network_item (_("Connect to Server…"), _("Connect to a network file server"),
49 new ThemedIcon.with_default_fallbacks ("network-server"),
50 marlin_connect_server_dialog_show);
51 }
45}52}
4653
47public Marlin.Plugins.Base module_init () {54public Marlin.Plugins.Base module_init () {
4855
=== modified file 'src/View/LocationBar.vala'
--- src/View/LocationBar.vala 2014-09-19 10:37:21 +0000
+++ src/View/LocationBar.vala 2014-09-24 07:03:43 +0000
@@ -354,7 +354,7 @@
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));
355 menu_item.always_show_image = true;355 menu_item.always_show_image = true;
356 menu_item.activate.connect (() => {356 menu_item.activate.connect (() => {
357 unowned AppInfo app = submenu_open_with.get_active ().get_data ("appinfo");357 AppInfo app = submenu_open_with.get_active ().get_data ("appinfo");
358 launch_uri_with_app (app, current_right_click_path);358 launch_uri_with_app (app, current_right_click_path);
359 });359 });
360 submenu_open_with.append (menu_item);360 submenu_open_with.append (menu_item);
@@ -374,7 +374,7 @@
374374
375 var response = dialog.run ();375 var response = dialog.run ();
376 if (response == Gtk.ResponseType.OK) {376 if (response == Gtk.ResponseType.OK) {
377 unowned AppInfo app = dialog.get_app_info ();377 AppInfo app = dialog.get_app_info ();
378 launch_uri_with_app (app, current_right_click_path);378 launch_uri_with_app (app, current_right_click_path);
379 }379 }
380380
381381
=== modified file 'src/View/Sidebar.vala'
--- src/View/Sidebar.vala 2014-08-09 23:33:45 +0000
+++ src/View/Sidebar.vala 2014-09-24 07:03:43 +0000
@@ -22,15 +22,6 @@
22namespace Marlin.Places {22namespace Marlin.Places {
23 public class Sidebar : Marlin.AbstractSidebar {23 public class Sidebar : Marlin.AbstractSidebar {
2424
25 enum PlaceType {
26 BUILT_IN,
27 MOUNTED_VOLUME,
28 BOOKMARK,
29 BOOKMARKS_CATEGORY,
30 PERSONAL_CATEGORY,
31 STORAGE_CATEGORY
32 }
33
34 enum ViewWindowOpenFlags {25 enum ViewWindowOpenFlags {
35 DEFAULT,26 DEFAULT,
36 NEW_TAB,27 NEW_TAB,
@@ -105,6 +96,7 @@
10596
106 Gtk.Menu popupmenu;97 Gtk.Menu popupmenu;
107 Gtk.MenuItem popupmenu_open_in_new_tab_item;98 Gtk.MenuItem popupmenu_open_in_new_tab_item;
99 Gtk.MenuItem popupmenu_open_in_new_window_item;
108 Gtk.MenuItem popupmenu_remove_item;100 Gtk.MenuItem popupmenu_remove_item;
109 Gtk.MenuItem popupmenu_rename_item;101 Gtk.MenuItem popupmenu_rename_item;
110 Gtk.MenuItem popupmenu_separator_item1;102 Gtk.MenuItem popupmenu_separator_item1;
@@ -115,7 +107,6 @@
115 Gtk.MenuItem popupmenu_rescan_item;107 Gtk.MenuItem popupmenu_rescan_item;
116 Gtk.MenuItem popupmenu_format_item;108 Gtk.MenuItem popupmenu_format_item;
117 Gtk.MenuItem popupmenu_empty_trash_item;109 Gtk.MenuItem popupmenu_empty_trash_item;
118 Gtk.MenuItem popupmenu_connect_server_item;
119 Gtk.MenuItem popupmenu_start_item;110 Gtk.MenuItem popupmenu_start_item;
120 Gtk.MenuItem popupmenu_stop_item;111 Gtk.MenuItem popupmenu_stop_item;
121112
@@ -139,7 +130,7 @@
139 construct_tree_view ();130 construct_tree_view ();
140 configure_tree_view ();131 configure_tree_view ();
141 connect_tree_view_signals ();132 connect_tree_view_signals ();
142 this.add (this.tree_view);133 this.content_box.pack_start (this.tree_view, true);
143134
144 this.bookmarks = Marlin.BookmarkList.get_instance ();135 this.bookmarks = Marlin.BookmarkList.get_instance ();
145 bookmarks.contents_changed.connect (update_places);136 bookmarks.contents_changed.connect (update_places);
@@ -301,16 +292,16 @@
301 eject_icon = new ThemedIcon.with_default_fallbacks ("media-eject-symbolic");292 eject_icon = new ThemedIcon.with_default_fallbacks ("media-eject-symbolic");
302 }293 }
303294
304 private Gtk.TreeIter add_place (PlaceType place_type,295 protected override Gtk.TreeIter add_place (Marlin.PlaceType place_type,
305 Gtk.TreeIter parent,296 Gtk.TreeIter? parent,
306 string name,297 string name,
307 Icon? icon,298 Icon? icon,
308 string? uri,299 string? uri,
309 Drive? drive,300 Drive? drive,
310 Volume? volume,301 Volume? volume,
311 Mount? mount,302 Mount? mount,
312 uint index,303 uint index,
313 string tooltip) {304 string tooltip) {
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);
315 eject_spinner_cell_renderer.icon_size = stock_size;306 eject_spinner_cell_renderer.icon_size = stock_size;
316307
@@ -324,7 +315,7 @@
324 bool show_eject, show_unmount;315 bool show_eject, show_unmount;
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);
326 if (show_unmount || show_eject)317 if (show_unmount || show_eject)
327 assert (place_type != PlaceType.BOOKMARK);318 assert (place_type != Marlin.PlaceType.BOOKMARK);
328319
329 bool show_eject_button = false;320 bool show_eject_button = false;
330 if (mount != null)321 if (mount != null)
@@ -356,7 +347,7 @@
356 Column.INDEX, index,347 Column.INDEX, index,
357 Column.EJECT, show_eject_button,348 Column.EJECT, show_eject_button,
358 Column.NO_EJECT, !show_eject_button,349 Column.NO_EJECT, !show_eject_button,
359 Column.BOOKMARK, place_type == PlaceType.BOOKMARK,350 Column.BOOKMARK, place_type == Marlin.PlaceType.BOOKMARK,
360 Column.TOOLTIP, tooltip,351 Column.TOOLTIP, tooltip,
361 Column.EJECT_ICON, eject,352 Column.EJECT_ICON, eject,
362 Column.SHOW_SPINNER, false,353 Column.SHOW_SPINNER, false,
@@ -386,14 +377,13 @@
386 last_selected_uri = null;377 last_selected_uri = null;
387378
388 store.clear ();379 store.clear ();
389 plugins.update_sidebar ((Gtk.Widget)this);
390380
391 /* ADD BOOKMARKS CATEGORY*/381 /* ADD BOOKMARKS CATEGORY*/
392 store.append (out iter, null);382 store.append (out iter, null);
393 store.@set (iter,383 store.@set (iter,
394 Column.ICON, null,384 Column.ICON, null,
395 Column.NAME, _("Personal"),385 Column.NAME, _("Personal"),
396 Column.ROW_TYPE, PlaceType.BOOKMARKS_CATEGORY,386 Column.ROW_TYPE, Marlin.PlaceType.BOOKMARKS_CATEGORY,
397 Column.EJECT, false,387 Column.EJECT, false,
398 Column.NO_EJECT, true,388 Column.NO_EJECT, true,
399 Column.BOOKMARK, false,389 Column.BOOKMARK, false,
@@ -407,7 +397,7 @@
407 mount_uri = "";397 mount_uri = "";
408 }398 }
409399
410 add_place (PlaceType.BUILT_IN,400 add_place (Marlin.PlaceType.BUILT_IN,
411 iter,401 iter,
412 _("Home"),402 _("Home"),
413 new ThemedIcon (Marlin.ICON_HOME),403 new ThemedIcon (Marlin.ICON_HOME),
@@ -434,7 +424,7 @@
434 }424 }
435425
436 /* Add trash */426 /* Add trash */
437 add_place (PlaceType.BUILT_IN,427 add_place (Marlin.PlaceType.BUILT_IN,
438 iter,428 iter,
439 _("Trash"),429 _("Trash"),
440 Marlin.TrashMonitor.get_icon (),430 Marlin.TrashMonitor.get_icon (),
@@ -450,14 +440,14 @@
450 store.@set (iter,440 store.@set (iter,
451 Column.ICON, null,441 Column.ICON, null,
452 Column.NAME, _("Devices"),442 Column.NAME, _("Devices"),
453 Column.ROW_TYPE, PlaceType.STORAGE_CATEGORY,443 Column.ROW_TYPE, Marlin.PlaceType.STORAGE_CATEGORY,
454 Column.EJECT, false,444 Column.EJECT, false,
455 Column.NO_EJECT, true,445 Column.NO_EJECT, true,
456 Column.BOOKMARK, false,446 Column.BOOKMARK, false,
457 Column.TOOLTIP, _("Your local partitions and devices"));447 Column.TOOLTIP, _("Your local partitions and devices"));
458448
459 /* Add Filesystem BUILTIN */449 /* Add Filesystem BUILTIN */
460 add_place (PlaceType.BUILT_IN,450 add_place (Marlin.PlaceType.BUILT_IN,
461 iter,451 iter,
462 _("File System"),452 _("File System"),
463 new ThemedIcon.with_default_fallbacks (Marlin.ICON_FILESYSTEM),453 new ThemedIcon.with_default_fallbacks (Marlin.ICON_FILESYSTEM),
@@ -487,7 +477,7 @@
487 * in the OS to save battery juice.477 * in the OS to save battery juice.
488 */478 */
489 var name = drive.get_name ();479 var name = drive.get_name ();
490 add_place (PlaceType.BUILT_IN,480 add_place (Marlin.PlaceType.BUILT_IN,
491 iter,481 iter,
492 name,482 name,
493 drive.get_icon (),483 drive.get_icon (),
@@ -508,7 +498,7 @@
508 var mount = volume.get_mount ();498 var mount = volume.get_mount ();
509 if (mount != null) {499 if (mount != null) {
510 var root = mount.get_default_location ();500 var root = mount.get_default_location ();
511 add_place (PlaceType.MOUNTED_VOLUME,501 add_place (Marlin.PlaceType.MOUNTED_VOLUME,
512 iter,502 iter,
513 mount.get_name (),503 mount.get_name (),
514 mount.get_icon (),504 mount.get_icon (),
@@ -521,7 +511,7 @@
521 } else {511 } else {
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 */
523 var name = volume.get_name ();513 var name = volume.get_name ();
524 add_place (PlaceType.MOUNTED_VOLUME,514 add_place (Marlin.PlaceType.MOUNTED_VOLUME,
525 iter,515 iter,
526 name,516 name,
527 volume.get_icon (),517 volume.get_icon (),
@@ -553,7 +543,7 @@
553 }543 }
554 }544 }
555545
556 add_place (PlaceType.MOUNTED_VOLUME,546 add_place (Marlin.PlaceType.MOUNTED_VOLUME,
557 iter,547 iter,
558 mount.get_name (),548 mount.get_name (),
559 mount.get_icon (),549 mount.get_icon (),
@@ -570,17 +560,19 @@
570 store.@set (iter,560 store.@set (iter,
571 Column.ICON, null,561 Column.ICON, null,
572 Column.NAME, _("Network"),562 Column.NAME, _("Network"),
573 Column.ROW_TYPE, PlaceType.STORAGE_CATEGORY,563 Column.ROW_TYPE, Marlin.PlaceType.STORAGE_CATEGORY,
574 Column.EJECT, false,564 Column.EJECT, false,
575 Column.NO_EJECT, true,565 Column.NO_EJECT, true,
576 Column.BOOKMARK, false,566 Column.BOOKMARK, false,
577 Column.TOOLTIP, _("Your network places"));567 Column.TOOLTIP, _("Your network places"));
578568
569 network_category_reference = new Gtk.TreeRowReference (store, store.get_path (iter));
570
579 /* Add network mounts */571 /* Add network mounts */
580 network_mounts.reverse ();572 network_mounts.reverse ();
581 foreach (Mount mount in network_mounts) {573 foreach (Mount mount in network_mounts) {
582 var root = mount.get_default_location ();574 var root = mount.get_default_location ();
583 add_place (PlaceType.BUILT_IN,575 add_place (Marlin.PlaceType.BUILT_IN,
584 iter,576 iter,
585 mount.get_name (),577 mount.get_name (),
586 mount.get_icon (),578 mount.get_icon (),
@@ -593,7 +585,7 @@
593 }585 }
594586
595 /* Add Entire Network BUILTIN */587 /* Add Entire Network BUILTIN */
596 add_place (PlaceType.BUILT_IN,588 add_place (Marlin.PlaceType.BUILT_IN,
597 iter,589 iter,
598 _("Entire Network"),590 _("Entire Network"),
599 new GLib.ThemedIcon (Marlin.ICON_NETWORK),591 new GLib.ThemedIcon (Marlin.ICON_NETWORK),
@@ -604,6 +596,8 @@
604 0,596 0,
605 _("Browse the contents of the network"));597 _("Browse the contents of the network"));
606598
599 plugins.update_sidebar ((Gtk.Widget)this);
600
607 expander_init_pref_state (tree_view);601 expander_init_pref_state (tree_view);
608602
609 /* select any previously selected place or any place matching slot location */603 /* select any previously selected place or any place matching slot location */
@@ -614,7 +608,7 @@
614 }608 }
615609
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) {
617 add_place ( PlaceType.BOOKMARK,611 add_place ( Marlin.PlaceType.BOOKMARK,
618 iter,612 iter,
619 bm.label.dup (),613 bm.label.dup (),
620 bm.get_icon (),614 bm.get_icon (),
@@ -635,7 +629,7 @@
635 if (mount != null) {629 if (mount != null) {
636 /* show mounted volume in sidebar */630 /* show mounted volume in sidebar */
637 var root = mount.get_default_location ();631 var root = mount.get_default_location ();
638 last_iter = add_place (PlaceType.MOUNTED_VOLUME,632 last_iter = add_place (Marlin.PlaceType.MOUNTED_VOLUME,
639 iter,633 iter,
640 mount.get_name (),634 mount.get_name (),
641 mount.get_icon (),635 mount.get_icon (),
@@ -661,7 +655,7 @@
661 * he just unmounted it.655 * he just unmounted it.
662 */656 */
663 var name = volume.get_name ();657 var name = volume.get_name ();
664 add_place (PlaceType.MOUNTED_VOLUME,658 add_place (Marlin.PlaceType.MOUNTED_VOLUME,
665 iter,659 iter,
666 name,660 name,
667 volume.get_icon (),661 volume.get_icon (),
@@ -673,7 +667,7 @@
673 (_("Mount and open %s")).printf (name));667 (_("Mount and open %s")).printf (name));
674 }668 }
675 }669 }
676 }670 }
677671
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) {
679 GLib.FileInfo info;673 GLib.FileInfo info;
@@ -843,14 +837,14 @@
843 private bool process_drop_between (Gtk.TreeIter iter,837 private bool process_drop_between (Gtk.TreeIter iter,
844 Gtk.TreeViewDropPosition drop_pos,838 Gtk.TreeViewDropPosition drop_pos,
845 uint info) {839 uint info) {
846 PlaceType type;840 Marlin.PlaceType type;
847 uint position;841 uint position;
848 store.@get (iter,842 store.@get (iter,
849 Column.ROW_TYPE, out type,843 Column.ROW_TYPE, out type,
850 Column.INDEX, out position);844 Column.INDEX, out position);
851845
852 if (type == PlaceType.BOOKMARK || type == PlaceType.BUILT_IN) {846 if (type == Marlin.PlaceType.BOOKMARK || type == Marlin.PlaceType.BUILT_IN) {
853 if (type == PlaceType.BOOKMARK && drop_pos == Gtk.TreeViewDropPosition.BEFORE)847 if (type == Marlin.PlaceType.BOOKMARK && drop_pos == Gtk.TreeViewDropPosition.BEFORE)
854 position--;848 position--;
855849
856 switch (info) {850 switch (info) {
@@ -1044,7 +1038,8 @@
1044 return;1038 return;
10451039
1046 string uri;1040 string uri;
1047 store.@get (iter, Column.URI, out uri);1041 Marlin.PluginCallbackFunc f;
1042 store.@get (iter, Column.URI, out uri, Column.PLUGIN_CALLBACK, out f);
10481043
1049 if (uri != null) {1044 if (uri != null) {
1050 var location = File.new_for_uri (uri);1045 var location = File.new_for_uri (uri);
@@ -1058,6 +1053,8 @@
1058 if (slot != null)1053 if (slot != null)
1059 GLib.Signal.emit_by_name (slot.ctab, "path-changed", location);1054 GLib.Signal.emit_by_name (slot.ctab, "path-changed", location);
1060 }1055 }
1056 } else if (f != null) {
1057 f (this);
1061 } else if (!ejecting_or_unmounting) {1058 } else if (!ejecting_or_unmounting) {
1062 Drive drive;1059 Drive drive;
1063 Volume volume;1060 Volume volume;
@@ -1199,6 +1196,7 @@
1199 popupmenu.append (item);1196 popupmenu.append (item);
12001197
1201 item = new Gtk.ImageMenuItem.with_mnemonic (_("Open in New _Window"));1198 item = new Gtk.ImageMenuItem.with_mnemonic (_("Open in New _Window"));
1199 popupmenu_open_in_new_window_item = item;
1202 item.activate.connect (open_shortcut_in_new_window_cb);1200 item.activate.connect (open_shortcut_in_new_window_cb);
1203 item.show ();1201 item.show ();
1204 popupmenu.append (item);1202 popupmenu.append (item);
@@ -1246,14 +1244,6 @@
1246 item.activate.connect (empty_trash_cb);1244 item.activate.connect (empty_trash_cb);
1247 item.show ();1245 item.show ();
1248 popupmenu.append (item);1246 popupmenu.append (item);
1249
1250 /* Connect to server menu item */
1251 item = new Gtk.ImageMenuItem.with_mnemonic (_("Connect to Server..."));
1252 popupmenu_connect_server_item = item;
1253 item.activate.connect (connect_server_cb);
1254 item.show ();
1255 popupmenu.append (item);
1256
1257 check_popup_sensitivity ();1247 check_popup_sensitivity ();
1258 }1248 }
12591249
@@ -1284,7 +1274,6 @@
1284 popupmenu_start_item = null;1274 popupmenu_start_item = null;
1285 popupmenu_stop_item = null;1275 popupmenu_stop_item = null;
1286 popupmenu_empty_trash_item = null;1276 popupmenu_empty_trash_item = null;
1287 popupmenu_connect_server_item = null;
1288 }1277 }
12891278
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 */
@@ -1388,26 +1377,26 @@
1388 Gtk.CellRenderer cell,1377 Gtk.CellRenderer cell,
1389 Gtk.TreeModel model,1378 Gtk.TreeModel model,
1390 Gtk.TreeIter iter) {1379 Gtk.TreeIter iter) {
1391 PlaceType type;1380 Marlin.PlaceType type;
1392 store.@get (iter, Column.ROW_TYPE, out type, -1);1381 store.@get (iter, Column.ROW_TYPE, out type, -1);
13931382
1394 if (type == PlaceType.PERSONAL_CATEGORY ||1383 if (type == Marlin.PlaceType.PERSONAL_CATEGORY ||
1395 type == PlaceType.STORAGE_CATEGORY ||1384 type == Marlin.PlaceType.STORAGE_CATEGORY ||
1396 type == PlaceType.BOOKMARKS_CATEGORY)1385 type == Marlin.PlaceType.BOOKMARKS_CATEGORY)
1397 expander_renderer.visible = true;1386 expander_renderer.visible = true;
1398 else1387 else
1399 expander_renderer.visible = false;1388 expander_renderer.visible = false;
1400 }1389 }
14011390
1402 private void expander_update_pref_state (PlaceType type, bool flag) {1391 private void expander_update_pref_state (Marlin.PlaceType type, bool flag) {
1403 switch (type) {1392 switch (type) {
1404 case PlaceType.PERSONAL_CATEGORY:1393 case Marlin.PlaceType.PERSONAL_CATEGORY:
1405 Preferences.settings.set_boolean ("sidebar-cat-network-expander", flag);1394 Preferences.settings.set_boolean ("sidebar-cat-network-expander", flag);
1406 break;1395 break;
1407 case PlaceType.STORAGE_CATEGORY:1396 case Marlin.PlaceType.STORAGE_CATEGORY:
1408 Preferences.settings.set_boolean ("sidebar-cat-devices-expander", flag);1397 Preferences.settings.set_boolean ("sidebar-cat-devices-expander", flag);
1409 break;1398 break;
1410 case PlaceType.BOOKMARKS_CATEGORY:1399 case Marlin.PlaceType.BOOKMARKS_CATEGORY:
1411 Preferences.settings.set_boolean ("sidebar-cat-personal-expander", flag);1400 Preferences.settings.set_boolean ("sidebar-cat-personal-expander", flag);
1412 break;1401 break;
1413 }1402 }
@@ -1438,13 +1427,13 @@
1438 Gtk.CellRenderer renderer,1427 Gtk.CellRenderer renderer,
1439 Gtk.TreeModel model,1428 Gtk.TreeModel model,
1440 Gtk.TreeIter iter) {1429 Gtk.TreeIter iter) {
1441 PlaceType type;1430 Marlin.PlaceType type;
1442 Gtk.CellRendererText crt = renderer as Gtk.CellRendererText;1431 Gtk.CellRendererText crt = renderer as Gtk.CellRendererText;
1443 model.@get (iter, Column.ROW_TYPE, out type, -1);1432 model.@get (iter, Column.ROW_TYPE, out type, -1);
14441433
1445 if (type == PlaceType.PERSONAL_CATEGORY ||1434 if (type == Marlin.PlaceType.PERSONAL_CATEGORY ||
1446 type == PlaceType.STORAGE_CATEGORY ||1435 type == Marlin.PlaceType.STORAGE_CATEGORY ||
1447 type == PlaceType.BOOKMARKS_CATEGORY) {1436 type == Marlin.PlaceType.BOOKMARKS_CATEGORY) {
14481437
1449 crt.weight = 900;1438 crt.weight = 900;
1450 crt.weight_set = true;1439 crt.weight_set = true;
@@ -1466,7 +1455,7 @@
1466 private void category_row_expanded_event_cb (Gtk.TreeView tree,1455 private void category_row_expanded_event_cb (Gtk.TreeView tree,
1467 Gtk.TreeIter iter,1456 Gtk.TreeIter iter,
1468 Gtk.TreePath path) {1457 Gtk.TreePath path) {
1469 PlaceType type;1458 Marlin.PlaceType type;
1470 store.@get (iter, Column.ROW_TYPE, out type);1459 store.@get (iter, Column.ROW_TYPE, out type);
1471 expander_update_pref_state (type, true);1460 expander_update_pref_state (type, true);
1472 }1461 }
@@ -1474,7 +1463,7 @@
1474 private void category_row_collapsed_event_cb (Gtk.TreeView tree,1463 private void category_row_collapsed_event_cb (Gtk.TreeView tree,
1475 Gtk.TreeIter iter,1464 Gtk.TreeIter iter,
1476 Gtk.TreePath path) {1465 Gtk.TreePath path) {
1477 PlaceType type;1466 Marlin.PlaceType type;
1478 store.@get (iter, Column.ROW_TYPE, out type);1467 store.@get (iter, Column.ROW_TYPE, out type);
1479 expander_update_pref_state (type, false);1468 expander_update_pref_state (type, false);
1480 }1469 }
@@ -1886,11 +1875,6 @@
1886 Marlin.FileOperations.empty_trash (window);1875 Marlin.FileOperations.empty_trash (window);
1887 }1876 }
18881877
1889 private void connect_server_cb (Gtk.MenuItem item) {
1890 var dialog = new Marlin.ConnectServer.Dialog (window);
1891 dialog.show ();
1892 }
1893
1894/* VOLUME MONITOR CALLBACK FUNCTIONS */1878/* VOLUME MONITOR CALLBACK FUNCTIONS */
18951879
1896 private void mount_added_callback (Mount mount) {1880 private void mount_added_callback (Mount mount) {
@@ -2007,7 +1991,7 @@
2007 if (!get_selected_iter (out iter))1991 if (!get_selected_iter (out iter))
2008 return;1992 return;
20091993
2010 PlaceType type;1994 Marlin.PlaceType type;
2011 Drive drive;1995 Drive drive;
2012 Volume volume;1996 Volume volume;
2013 Mount mount;1997 Mount mount;
@@ -2039,18 +2023,18 @@
2039 out show_stop);2023 out show_stop);
20402024
2041 bool show_empty_trash = (uri != null) && (uri == Marlin.TRASH_URI);2025 bool show_empty_trash = (uri != null) && (uri == Marlin.TRASH_URI);
2042 bool show_connect_server = (uri != null) && (uri == Marlin.NETWORK_URI);
2043 Eel.gtk_widget_set_shown (popupmenu_separator_item2,2026 Eel.gtk_widget_set_shown (popupmenu_separator_item2,
2044 show_eject || show_unmount ||2027 show_eject || show_unmount ||
2045 show_mount || show_empty_trash ||2028 show_mount || show_empty_trash);
2046 show_connect_server);
2047 Eel.gtk_widget_set_shown (popupmenu_mount_item, show_mount);2029 Eel.gtk_widget_set_shown (popupmenu_mount_item, show_mount);
2048 Eel.gtk_widget_set_shown (popupmenu_unmount_item, show_unmount);2030 Eel.gtk_widget_set_shown (popupmenu_unmount_item, show_unmount);
2049 Eel.gtk_widget_set_shown (popupmenu_eject_item, show_eject);2031 Eel.gtk_widget_set_shown (popupmenu_eject_item, show_eject);
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);
2051 popupmenu_empty_trash_item.set_sensitive (!(Marlin.TrashMonitor.is_empty ()));2033 popupmenu_empty_trash_item.set_sensitive (!(Marlin.TrashMonitor.is_empty ()));
20522034
2053 Eel.gtk_widget_set_shown (popupmenu_connect_server_item, show_connect_server);2035 bool is_plugin = (type == Marlin.PlaceType.PLUGIN_ITEM);
2036 Eel.gtk_widget_set_shown (popupmenu_open_in_new_tab_item, !is_plugin);
2037 Eel.gtk_widget_set_shown (popupmenu_open_in_new_window_item, !is_plugin);
2054 }2038 }
20552039
2056 /**2040 /**

Subscribers

People subscribed via source and target branches

to all changes: