diff options
author | Ondrej Holy <oholy@redhat.com> | 2015-06-24 13:58:57 +0200 |
---|---|---|
committer | Stefano Facchini <stefano.facchini@gmail.com> | 2015-06-24 15:25:50 +0200 |
commit | 8e696ac7fe54b109d2af630e090a882c18122907 (patch) | |
tree | 93433661c367660bc3f3224276ffeb7adb07c36a | |
parent | a28ca818f401e3efa369288e3032d896f9a18505 (diff) | |
download | baobab-8e696ac7fe54b109d2af630e090a882c18122907.tar.gz |
Fix context menu items sensitivity
Context menu items "Go to parent folder", "Zoom in", "Zoom out" stay
always active, even if they can not bring effect (e.g. already in
the top directory, maximal zoom). This patch set sensitivity of the
mentioned menu items accordingly.
https://bugzilla.gnome.org/show_bug.cgi?id=751436
-rw-r--r-- | src/baobab-chart.vala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/baobab-chart.vala b/src/baobab-chart.vala index d2d8d46..703a734 100644 --- a/src/baobab-chart.vala +++ b/src/baobab-chart.vala @@ -547,6 +547,13 @@ namespace Baobab { (get_toplevel () as Window).trash_file (highlighted_item.iter); } + protected bool can_move_up_root () { + Gtk.TreeIter iter, parent_iter; + + model.get_iter (out iter, root); + return model.iter_parent (out parent_iter, iter); + } + public void move_up_root () { Gtk.TreeIter iter, parent_iter; @@ -584,6 +591,14 @@ namespace Baobab { action = action_group.lookup_action ("trash-file") as SimpleAction; action.set_enabled (enable); + action = action_group.lookup_action ("move-up") as SimpleAction; + action.set_enabled (can_move_up_root ()); + + action = action_group.lookup_action ("zoom-in") as SimpleAction; + action.set_enabled (can_zoom_in ()); + action = action_group.lookup_action ("zoom-out") as SimpleAction; + action.set_enabled (can_zoom_out ()); + if (event != null) { context_menu.popup (null, null, null, event.button, event.time); } else { |