[Xfce4-commits] [apps/mousepad] 02/04: Prevent a g_settings cycle.
noreply at xfce.org
noreply at xfce.org
Tue Aug 15 04:11:11 CEST 2017
This is an automated email from the git hooks/post-receive script.
m b r u s h p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository apps/mousepad.
commit 3c2bc00a684e45df4f5c56bf37d047a5f785cb8d
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date: Mon Mar 21 23:34:12 2016 +0000
Prevent a g_settings cycle.
When the selected menu item changes, only update the g_setting.
When the g_setting changes, only update the selected menu item.
This prevents g_setting changes from bouncing between windows
endlessly.
---
mousepad/mousepad-action-group.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/mousepad/mousepad-action-group.c b/mousepad/mousepad-action-group.c
index acea132..f9a7fa1 100644
--- a/mousepad/mousepad-action-group.c
+++ b/mousepad/mousepad-action-group.c
@@ -284,8 +284,6 @@ mousepad_action_group_set_active_style_scheme (MousepadActionGroup *self,
GtkSourceStyleScheme *scheme)
{
GtkAction *action;
- const gchar *scheme_name = NULL;
-
g_return_if_fail (MOUSEPAD_IS_ACTION_GROUP (self));
if (GTK_SOURCE_IS_STYLE_SCHEME (self->active_scheme))
@@ -303,14 +301,6 @@ mousepad_action_group_set_active_style_scheme (MousepadActionGroup *self,
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
self->locked = FALSE;
- /* update the setting when the active action is changed */
- if (scheme != NULL)
- scheme_name = gtk_source_style_scheme_get_id(scheme);
-
- self->locked = TRUE;
- MOUSEPAD_SETTING_SET_STRING (COLOR_SCHEME, scheme_name);
- self->locked = FALSE;
-
g_object_notify (G_OBJECT (self), "active-style-scheme");
}
@@ -477,6 +467,8 @@ static void
mousepad_action_group_style_scheme_action_activate (MousepadActionGroup *self,
MousepadStyleSchemeAction *action)
{
+ const gchar *scheme_name = NULL;
+
/* only update the active action if we're not already in the process of
* setting it and the sender action is actually active */
if (! self->locked &&
@@ -485,7 +477,14 @@ mousepad_action_group_style_scheme_action_activate (MousepadActionGroup *s
GtkSourceStyleScheme *scheme;
scheme = mousepad_style_scheme_action_get_style_scheme (action);
- mousepad_action_group_set_active_style_scheme (self, scheme);
+
+ /* update the setting when the active action is changed */
+ if (scheme != NULL)
+ scheme_name = gtk_source_style_scheme_get_id(scheme);
+
+ self->locked = TRUE;
+ MOUSEPAD_SETTING_SET_STRING (COLOR_SCHEME, scheme_name);
+ self->locked = FALSE;
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list