[gnumeric] CheckBox: make "active" writable; Button: fix internal value.



commit 1f22617c3e0e6822224915b916ec74e7df1e912f
Author: Morten Welinder <terra gnome org>
Date:   Fri Feb 20 20:50:58 2015 -0500

    CheckBox: make "active" writable; Button: fix internal value.

 ChangeLog                     |    5 ++++
 samples/object-tests.gnumeric |  Bin 4966 -> 4967 bytes
 src/sheet-object-widget.c     |   45 +++++++++++++++++++++--------------------
 3 files changed, 28 insertions(+), 22 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1a45e4d..24b26aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-20  Morten Welinder  <terra gnome org>
+
+       * src/sheet-object-widget.c: Make checkbox' "active" writable.
+       (cb_button_released): Set value to FALSE here(!)
+
 2015-02-18  Morten Welinder  <terra gnome org>
 
        * src/commands.c (cmd_search_replace_do_cell): Don't report and
diff --git a/samples/object-tests.gnumeric b/samples/object-tests.gnumeric
index 4b92bf3..c9d95b4 100644
Binary files a/samples/object-tests.gnumeric and b/samples/object-tests.gnumeric differ
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index 4f0a1c4..f084caa 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -934,7 +934,7 @@ cb_button_released (GtkToggleButton *button, SheetWidgetButton *swb)
 {
        GnmCellRef ref;
 
-       swb->value = TRUE;
+       swb->value = FALSE;
 
        if (so_get_ref (SHEET_OBJECT (swb), &ref, TRUE) != NULL) {
                cmd_so_set_value (widget_wbc (GTK_WIDGET (button)),
@@ -2252,6 +2252,25 @@ enum {
 };
 
 static void
+sheet_widget_checkbox_set_active (SheetWidgetCheckbox *swc)
+{
+       GList *ptr;
+
+       swc->being_updated = TRUE;
+
+       for (ptr = swc->sow.so.realized_list; ptr != NULL ; ptr = ptr->next) {
+               SheetObjectView *view = ptr->data;
+               GocWidget *item = get_goc_widget (view);
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->widget),
+                                             swc->value);
+       }
+
+       g_object_notify (G_OBJECT (swc), "active");
+
+       swc->being_updated = FALSE;
+}
+
+static void
 sheet_widget_checkbox_get_property (GObject *obj, guint param_id,
                                    GValue *value, GParamSpec *pspec)
 {
@@ -2281,7 +2300,8 @@ sheet_widget_checkbox_set_property (GObject *obj, guint param_id,
 
        switch (param_id) {
        case SOC_PROP_ACTIVE:
-               g_assert_not_reached ();
+               swc->value = g_value_get_boolean (value);
+               sheet_widget_checkbox_set_active (swc);
                break;
        case SOC_PROP_TEXT:
                sheet_widget_checkbox_set_label (SHEET_OBJECT (swc),
@@ -2300,25 +2320,6 @@ sheet_widget_checkbox_set_property (GObject *obj, guint param_id,
 }
 
 static void
-sheet_widget_checkbox_set_active (SheetWidgetCheckbox *swc)
-{
-       GList *ptr;
-
-       swc->being_updated = TRUE;
-
-       for (ptr = swc->sow.so.realized_list; ptr != NULL ; ptr = ptr->next) {
-               SheetObjectView *view = ptr->data;
-               GocWidget *item = get_goc_widget (view);
-               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item->widget),
-                                             swc->value);
-       }
-
-       g_object_notify (G_OBJECT (swc), "active");
-
-       swc->being_updated = FALSE;
-}
-
-static void
 checkbox_eval (GnmDependent *dep)
 {
        GnmValue *v;
@@ -2752,7 +2753,7 @@ SOW_MAKE_TYPE (checkbox, Checkbox,
                               (object_class, SOC_PROP_ACTIVE,
                                g_param_spec_boolean ("active", NULL, NULL,
                                                      FALSE,
-                                                     GSF_PARAM_STATIC | G_PARAM_READABLE));
+                                                     GSF_PARAM_STATIC | G_PARAM_READWRITE));
                       g_object_class_install_property
                               (object_class, SOC_PROP_TEXT,
                                g_param_spec_string ("text", NULL, NULL, NULL,


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