[eog] Allow editing the toolbar only when it is visible



commit 107adb3c8accc3e1c0eb06e77717f012127ff464
Author: Felix Riemann <friemann gnome org>
Date:   Wed Apr 20 23:18:33 2011 +0200

    Allow editing the toolbar only when it is visible
    
    Disables the toolbar editor in the menu when the toolbar is toggled off.
    Fixes bug #648055.

 src/eog-window.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index d9d2c5a..a948786 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -3876,6 +3876,26 @@ set_action_properties (GtkActionGroup *window_group,
 
         action = gtk_action_group_get_action (image_group, "EditMoveToTrash");
         g_object_set (action, "short_label", C_("action (to trash)", "Trash"), NULL);
+
+	/* Only allow editing the toolbar if it is visible */
+	action = gtk_action_group_get_action (window_group, "ViewToolbar");
+	if (G_LIKELY (action != NULL)) {
+		GtkAction *tbedit_action;
+
+		tbedit_action = gtk_action_group_get_action (window_group,
+							     "EditToolbar");
+
+		if (G_LIKELY (tbedit_action != NULL)) {
+			// The binding should free itself when the actions do
+			g_object_bind_property (action, "active",
+						tbedit_action, "sensitive",
+						G_BINDING_SYNC_CREATE);
+		} else {
+			g_warn_if_reached ();
+		}
+	} else {
+		g_warn_if_reached ();
+	}
 }
 
 static gint



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]