From: Philip Chimento Date: Mon, 28 Feb 2011 00:51:53 +0000 (+0100) Subject: Add a View/Toolbar setting X-Git-Tag: v0.9~132 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=1d00342f5da6d42a2600643a31c97fb821998d2d;p=projects%2Fchimara%2Fchimara.git Add a View/Toolbar setting A good setting to demonstrate one-way binding is the View/Toolbar setting. When the menu item is switched on or off, we want to update the setting, but not the other way around. This is so that when you have multiple windows, turning the toolbar off in one doesn't turn the toolbar off in the others, but when you open a new window, the toolbar is shown or hidden depending on the last choice you made. --- diff --git a/player/main.c b/player/main.c index 8d797c3..72cdcd9 100644 --- a/player/main.c +++ b/player/main.c @@ -118,7 +118,13 @@ create_window(void) aboutwindow = GTK_WIDGET(load_object("aboutwindow")); prefswindow = GTK_WIDGET(load_object("prefswindow")); GtkActionGroup *actiongroup = GTK_ACTION_GROUP(load_object("actiongroup")); + + /* Set the default value of the "View/Toolbar" menu item upon creation of a + new window to the "show-toolbar-default" setting, but bind the setting + one-way only - we don't want toolbars to disappear suddenly */ GtkToggleAction *toolbar_action = GTK_TOGGLE_ACTION(load_object("toolbar")); + gtk_toggle_action_set_active(toolbar_action, g_settings_get_boolean(state_settings, "show-toolbar-default")); + g_settings_bind(state_settings, "show-toolbar-default", toolbar_action, "active", G_SETTINGS_BIND_SET); const gchar **ptr; GtkRecentFilter *filter = gtk_recent_filter_new(); diff --git a/player/org.chimara-if.gschema.xml b/player/org.chimara-if.gschema.xml index 4e2fc56..301a9aa 100644 --- a/player/org.chimara-if.gschema.xml +++ b/player/org.chimara-if.gschema.xml @@ -31,5 +31,13 @@ + + true + Show toolbar by default + + Whether to show or hide the toolbar by default in new game windows. + + + \ No newline at end of file