[baobab] Fix context menu items sensitivity
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] Fix context menu items sensitivity
- Date: Wed, 24 Jun 2015 13:33:51 +0000 (UTC)
commit 8e696ac7fe54b109d2af630e090a882c18122907
Author: Ondrej Holy <oholy redhat com>
Date: Wed Jun 24 13:58:57 2015 +0200
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
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 {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]