[glade] Fix bug 692972 - Make spin buttons commit values synchronously
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] Fix bug 692972 - Make spin buttons commit values synchronously
- Date: Sun, 19 May 2013 10:32:09 +0000 (UTC)
commit 84990bcaec39109be3c53b1a13ba31ca5d865970
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun May 19 19:26:57 2013 +0900
Fix bug 692972 - Make spin buttons commit values synchronously
Two things done to fix this:
o gtk_spin_button_set_numeric() used to force numeric input
o Connect to the GtkEditable::changed signal and force the
value update with gtk_spin_button_update(), causing the
value-changed signal to be emitted synchronously and
the new property value committed.
gladeui/glade-editor-property.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 863ce7f..e7c5d2c 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -801,6 +801,13 @@ glade_eprop_numeric_changed (GtkWidget *spin, GladeEditorProperty *eprop)
g_value_unset (&val);
}
+static void
+glade_eprop_numeric_force_update (GtkSpinButton *spin,
+ GladeEditorProperty *eprop)
+{
+ gtk_spin_button_update (spin);
+}
+
static GtkWidget *
glade_eprop_numeric_create_input (GladeEditorProperty *eprop)
{
@@ -818,12 +825,17 @@ glade_eprop_numeric_create_input (GladeEditorProperty *eprop)
gtk_widget_set_halign (eprop_numeric->spin, GTK_ALIGN_FILL);
gtk_widget_set_valign (eprop_numeric->spin, GTK_ALIGN_CENTER);
+ gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (eprop_numeric->spin), TRUE);
+
gtk_widget_show (eprop_numeric->spin);
/* Limit the size of the spin if max allowed value is too big */
if (gtk_adjustment_get_upper (adjustment) > 9999999999999999.0)
gtk_entry_set_width_chars (GTK_ENTRY (eprop_numeric->spin), 16);
+ g_signal_connect (G_OBJECT (eprop_numeric->spin), "changed",
+ G_CALLBACK (glade_eprop_numeric_force_update), eprop);
+
g_signal_connect (G_OBJECT (eprop_numeric->spin), "value_changed",
G_CALLBACK (glade_eprop_numeric_changed), eprop);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]