[glade/composite-templates-new: 1/10] GladeEditorProperty: Manage construct-only property changes.
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/composite-templates-new: 1/10] GladeEditorProperty: Manage construct-only property changes.
- Date: Sat, 6 Apr 2013 14:17:17 +0000 (UTC)
commit c7c337a86aeeb688d1f9c78ec359b27f716baba3
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sat Apr 6 16:05:12 2013 +0900
GladeEditorProperty: Manage construct-only property changes.
This is tricky, we block the GladeProperty change signals
while committing an new property value. However when the
property is construct-only, the GladeWidget temporarily
exits the GladeProject while it reconstructs the instance.
With this patch we avoid unblocking the property change
signal after a commit, if the signal was disconnected
and reconnected as a consequence of applying the property value.
gladeui/glade-editor-property.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index ed72e11..03ac5f1 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -101,6 +101,7 @@ struct _GladeEditorPropertyPrivate
* or skip directly to GladeProperty interface.
* (used for query dialogs).
*/
+ guint changed_blocked : 1; /* Whether the GladeProperty changed signal is currently blocked
*/
};
G_DEFINE_TYPE (GladeEditorProperty, glade_editor_property, GTK_TYPE_HBOX);
@@ -139,10 +140,18 @@ glade_editor_property_commit_no_callback (GladeEditorProperty *eprop,
return;
g_signal_handler_block (G_OBJECT (eprop->priv->property), eprop->priv->changed_id);
+ eprop->priv->changed_blocked = TRUE;
+
eprop->priv->committing = TRUE;
glade_editor_property_commit (eprop, value);
eprop->priv->committing = FALSE;
- g_signal_handler_unblock (G_OBJECT (eprop->priv->property), eprop->priv->changed_id);
+
+ /* When construct-only properties are set, we are disconnected and re-connected
+ * to the GladeWidget while it's rebuilding it's instance, in this case the
+ * signal handler is no longer blocked at this point.
+ */
+ if (eprop->priv->changed_blocked)
+ g_signal_handler_unblock (G_OBJECT (eprop->priv->property), eprop->priv->changed_id);
}
GtkWidget *
@@ -487,6 +496,7 @@ glade_editor_property_load_common (GladeEditorProperty *eprop,
eprop->priv->changed_id = 0;
eprop->priv->enabled_id = 0;
eprop->priv->state_id = 0;
+ eprop->priv->changed_blocked = FALSE;
/* Unref it here */
g_object_weak_unref (G_OBJECT (eprop->priv->property),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]