[gnumeric] sheet objects: add "active" property to check boxes and radio buttons.



commit d51d002370196f7d5521a85ea04b44679d1e5f8b
Author: Morten Welinder <terra gnome org>
Date:   Wed Oct 7 16:30:15 2009 -0400

    sheet objects: add "active" property to check boxes and radio buttons.

 ChangeLog                 |    3 +++
 src/sheet-object-widget.c |   28 ++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6786095..e60aab8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-10-07  Morten Welinder  <terra gnome org>
 
+	* src/sheet-object-widget.c (sheet_widget_checkbox_get_property,
+	sheet_widget_radio_button_get_property): Add "active" property.
+
 	* src/sheet-object-widget.h: Define the usual type macros.
 
 2009-10-07  Jean Brefort  <jean brefort normalesup org>
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index 42316b4..7311142 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -1731,6 +1731,7 @@ typedef SheetObjectWidgetClass SheetWidgetCheckboxClass;
 
 enum {
 	SOC_PROP_0 = 0,
+	SOC_PROP_ACTIVE,
 	SOC_PROP_TEXT,
 	SOC_PROP_MARKUP
 };
@@ -1742,6 +1743,9 @@ sheet_widget_checkbox_get_property (GObject *obj, guint param_id,
 	SheetWidgetCheckbox *swc = SHEET_WIDGET_CHECKBOX (obj);
 
 	switch (param_id) {
+	case SOC_PROP_ACTIVE:
+		g_value_set_boolean (value, swc->value);
+		break;
 	case SOC_PROP_TEXT:
 		g_value_set_string (value, swc->label);
 		break;
@@ -1761,6 +1765,9 @@ sheet_widget_checkbox_set_property (GObject *obj, guint param_id,
 	SheetWidgetCheckbox *swc = SHEET_WIDGET_CHECKBOX (obj);
 
 	switch (param_id) {
+	case SOC_PROP_ACTIVE:
+		g_assert_not_reached ();
+		break;
 	case SOC_PROP_TEXT:
 		sheet_widget_checkbox_set_label (SHEET_OBJECT (swc),
 						 g_value_get_string (value));
@@ -1791,6 +1798,8 @@ sheet_widget_checkbox_set_active (SheetWidgetCheckbox *swc)
 					      swc->value);
 	}
 
+	g_object_notify (G_OBJECT (swc), "active");
+
 	swc->being_updated = FALSE;
 }
 
@@ -2171,6 +2180,11 @@ SOW_MAKE_TYPE (checkbox, Checkbox,
 	       sheet_widget_checkbox_set_property,
 	       {
 		       g_object_class_install_property
+			       (object_class, SOC_PROP_ACTIVE,
+				g_param_spec_boolean ("active", NULL, NULL,
+						      FALSE,
+						      GSF_PARAM_STATIC | G_PARAM_READABLE));
+		       g_object_class_install_property
 			       (object_class, SOC_PROP_TEXT,
 				g_param_spec_string ("text", NULL, NULL, NULL,
 						     GSF_PARAM_STATIC | G_PARAM_READWRITE));
@@ -2224,6 +2238,7 @@ typedef SheetObjectWidgetClass SheetWidgetRadioButtonClass;
 
 enum {
 	SOR_PROP_0 = 0,
+	SOR_PROP_ACTIVE,
 	SOR_PROP_TEXT,
 	SOR_PROP_MARKUP
 };
@@ -2242,6 +2257,9 @@ sheet_widget_radio_button_get_property (GObject *obj, guint param_id,
 	SheetWidgetRadioButton *swrb = SHEET_WIDGET_RADIO_BUTTON (obj);
 
 	switch (param_id) {
+	case SOR_PROP_ACTIVE:
+		g_value_set_boolean (value, swrb->active);
+		break;
 	case SOR_PROP_TEXT:
 		g_value_set_string (value, swrb->label);
 		break;
@@ -2261,6 +2279,9 @@ sheet_widget_radio_button_set_property (GObject *obj, guint param_id,
 	SheetWidgetRadioButton *swrb = SHEET_WIDGET_RADIO_BUTTON (obj);
 
 	switch (param_id) {
+	case SOR_PROP_ACTIVE:
+		g_assert_not_reached ();
+		break;
 	case SOR_PROP_TEXT:
 		sheet_widget_radio_button_set_label (SHEET_OBJECT (swrb),
 						     g_value_get_string (value));
@@ -2305,6 +2326,8 @@ sheet_widget_radio_button_set_active (SheetWidgetRadioButton *swrb,
 					      active);
 	}
 
+	g_object_notify (G_OBJECT (swrb), "active");
+
 	swrb->being_updated = FALSE;
 }
 
@@ -2748,6 +2771,11 @@ SOW_MAKE_TYPE (radio_button, RadioButton,
   	       sheet_widget_radio_button_set_property,
 	       {
 		       g_object_class_install_property
+			       (object_class, SOR_PROP_ACTIVE,
+				g_param_spec_boolean ("active", NULL, NULL,
+						      FALSE,
+						      GSF_PARAM_STATIC | G_PARAM_READABLE));
+		       g_object_class_install_property
 			       (object_class, SOR_PROP_TEXT,
 				g_param_spec_string ("text", NULL, NULL, NULL,
 						     GSF_PARAM_STATIC | G_PARAM_READWRITE));



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