From 1885aa704fbdff571ecdd735539f57b59c188f0e Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sun, 21 Feb 2010 11:36:33 +0100 Subject: [PATCH] Bugfix on GtkFormWidgetRadio::set_value_stringify. --- docs/reference/libgtkform.args | 152 +++++++++++++++------------- docs/reference/libgtkform.hierarchy | 19 ++-- src/widgetradio.c | 40 ++------ 3 files changed, 97 insertions(+), 114 deletions(-) diff --git a/docs/reference/libgtkform.args b/docs/reference/libgtkform.args index b8641ae..e1d63b3 100644 --- a/docs/reference/libgtkform.args +++ b/docs/reference/libgtkform.args @@ -1,41 +1,81 @@ -GtkFormFieldBoolean::default -gboolean +GtkForm::key +GtkFormKey* + +rw +Key +Key. + + + + +GtkForm::quote +gchar rwx -Default -Default value. -FALSE +Quoting character +Character to use to quote fields name. +34 -GtkFormWidget::widget -GtkWidget* +GtkForm::table +gchar* -rw -GtkWidget -The GtkWidget. - +rwx +Table name +GtkForm's table name. +"" -GtkFormWidget::widget-name +GtkFormField::field gchar* rw -Widget's name -Widget's name. +Field +Field's name. "" -GtkFormFieldText::default -gchar* +GtkFormField::form-widget +GtkFormWidget* + +rw +GtkFormWidget +The GtkFormWidget. + + + + +GtkFormField::obligatory +gboolean + +rw +Obligatory +Whether the field could be empty. +FALSE + + + +GtkFormField::to-save +gboolean + +rwx +Whether save the field or not +Whether the field should be included or not on sql INSERT INTO and UPDATE. +TRUE + + + +GtkFormFieldBoolean::default +gboolean rwx Default Default value. -"" +FALSE @@ -79,72 +119,52 @@ -GtkFormField::field -gchar* - -rw -Field -Field's name. -"" - - - -GtkFormField::form-widget -GtkFormWidget* - -rw -GtkFormWidget -The GtkFormWidget. - - - - -GtkFormField::obligatory -gboolean +GtkFormFieldInteger::default +gint -rw -Obligatory -Whether the field could be empty. -FALSE +rwx +Default +Default value. +0 -GtkFormField::to-save -gboolean +GtkFormFieldText::default +gchar* rwx -Whether save the field or not -Whether the field should be included or not on sql INSERT INTO and UPDATE. -TRUE +Default +Default value. +"" -GtkForm::key -GtkFormKey* +GtkFormWidget::widget +GtkWidget* rw -Key -Key. +GtkWidget +The GtkWidget. -GtkForm::quote -gchar +GtkFormWidget::widget-name +gchar* -rwx -Quoting character -Character to use to quote fields name. -34 +rw +Widget's name +Widget's name. +"" -GtkForm::table +GtkFormWidgetRadio::return-value gchar* rwx -Table name -GtkForm's table name. +Return value +Return value. "" @@ -158,13 +178,3 @@ 0 - -GtkFormFieldInteger::default -gint - -rwx -Default -Default value. -0 - - diff --git a/docs/reference/libgtkform.hierarchy b/docs/reference/libgtkform.hierarchy index 6b62b2e..75f08f8 100644 --- a/docs/reference/libgtkform.hierarchy +++ b/docs/reference/libgtkform.hierarchy @@ -1,19 +1,20 @@ GObject - GtkFormWidget - GtkFormWidgetSpin - GtkFormWidgetCheck - GtkFormWidgetLabel - GtkFormWidgetTextview - GtkFormWidgetComboBox - GtkFormWidgetEntry + GtkForm GtkFormField GtkFormFieldBoolean - GtkFormFieldText GtkFormFieldDateTime GtkFormFieldFloat GtkFormFieldInteger + GtkFormFieldText GtkFormKey - GtkForm + GtkFormWidget + GtkFormWidgetCheck + GtkFormWidgetEntry + GtkFormWidgetLabel + GtkFormWidgetRadio + GtkFormWidgetSpin + GtkFormWidgetTextview + GtkFormWidgetComboBox GInitiallyUnowned GtkObject GtkWidget diff --git a/src/widgetradio.c b/src/widgetradio.c index 6fd4352..b9aab81 100644 --- a/src/widgetradio.c +++ b/src/widgetradio.c @@ -40,8 +40,6 @@ static void gtk_form_widget_radio_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static gboolean check_value (const gchar *value); - #define GTK_FORM_WIDGET_RADIO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_WIDGET_RADIO, GtkFormWidgetRadioPrivate)) typedef struct _GtkFormWidgetRadioPrivate GtkFormWidgetRadioPrivate; @@ -142,19 +140,23 @@ gchar gboolean gtk_form_widget_radio_set_value_stringify (GtkFormWidget *fwidget, const gchar *value) { - gboolean ret = FALSE; + gboolean ret; GtkWidget *w; gboolean active; + GtkFormWidgetRadioPrivate *priv; g_return_val_if_fail (IS_GTK_FORM_WIDGET_RADIO (fwidget), FALSE); + priv = GTK_FORM_WIDGET_RADIO_GET_PRIVATE (GTK_FORM_WIDGET_RADIO (fwidget)); + + ret = FALSE; active = FALSE; g_object_get (G_OBJECT (fwidget), "widget", &w, NULL); - active = check_value (value); + active = (g_strcmp0 (priv->value, value) == 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), active); @@ -276,33 +278,3 @@ gtk_form_widget_radio_get_property (GObject *object, break; } } - -static gboolean -check_value (const gchar *value) -{ - gchar *str_value; - gboolean active; - - active = FALSE; - - str_value = g_strstrip (g_strdup (value)); - - if (strcmp (str_value, "0") == 0 - || strcasecmp (str_value, "f") == 0 - || strcasecmp (str_value, "false") == 0 - || strcasecmp (str_value, "n") == 0 - || strcasecmp (str_value, "no") == 0) - { - active = FALSE; - } - else if (strcmp (str_value, "1") == 0 - || strcasecmp (str_value, "t") == 0 - || strcasecmp (str_value, "true") == 0 - || strcasecmp (str_value, "y") == 0 - || strcasecmp (str_value, "yes") == 0) - { - active = TRUE; - } - - return active; -} -- 2.49.0