summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2015-06-24 13:58:57 +0200
committerStefano Facchini <stefano.facchini@gmail.com>2015-06-24 15:25:50 +0200
commit8e696ac7fe54b109d2af630e090a882c18122907 (patch)
tree93433661c367660bc3f3224276ffeb7adb07c36a
parenta28ca818f401e3efa369288e3032d896f9a18505 (diff)
downloadbaobab-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.vala15
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 {