<ARG>
-<NAME>GtkFormFieldBoolean::default</NAME>
-<TYPE>gboolean</TYPE>
+<NAME>GtkForm::key</NAME>
+<TYPE>GtkFormKey*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Key</NICK>
+<BLURB>Key.</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GtkForm::quote</NAME>
+<TYPE>gchar</TYPE>
<RANGE></RANGE>
<FLAGS>rwx</FLAGS>
-<NICK>Default</NICK>
-<BLURB>Default value.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
+<NICK>Quoting character</NICK>
+<BLURB>Character to use to quote fields name.</BLURB>
+<DEFAULT>34</DEFAULT>
</ARG>
<ARG>
-<NAME>GtkFormWidget::widget</NAME>
-<TYPE>GtkWidget*</TYPE>
+<NAME>GtkForm::table</NAME>
+<TYPE>gchar*</TYPE>
<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>GtkWidget</NICK>
-<BLURB>The GtkWidget.</BLURB>
-<DEFAULT></DEFAULT>
+<FLAGS>rwx</FLAGS>
+<NICK>Table name</NICK>
+<BLURB>GtkForm's table name.</BLURB>
+<DEFAULT>""</DEFAULT>
</ARG>
<ARG>
-<NAME>GtkFormWidget::widget-name</NAME>
+<NAME>GtkFormField::field</NAME>
<TYPE>gchar*</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
-<NICK>Widget's name</NICK>
-<BLURB>Widget's name.</BLURB>
+<NICK>Field</NICK>
+<BLURB>Field's name.</BLURB>
<DEFAULT>""</DEFAULT>
</ARG>
<ARG>
-<NAME>GtkFormFieldText::default</NAME>
-<TYPE>gchar*</TYPE>
+<NAME>GtkFormField::form-widget</NAME>
+<TYPE>GtkFormWidget*</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>GtkFormWidget</NICK>
+<BLURB>The GtkFormWidget.</BLURB>
+<DEFAULT></DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GtkFormField::obligatory</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rw</FLAGS>
+<NICK>Obligatory</NICK>
+<BLURB>Whether the field could be empty.</BLURB>
+<DEFAULT>FALSE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GtkFormField::to-save</NAME>
+<TYPE>gboolean</TYPE>
+<RANGE></RANGE>
+<FLAGS>rwx</FLAGS>
+<NICK>Whether save the field or not</NICK>
+<BLURB>Whether the field should be included or not on sql INSERT INTO and UPDATE.</BLURB>
+<DEFAULT>TRUE</DEFAULT>
+</ARG>
+
+<ARG>
+<NAME>GtkFormFieldBoolean::default</NAME>
+<TYPE>gboolean</TYPE>
<RANGE></RANGE>
<FLAGS>rwx</FLAGS>
<NICK>Default</NICK>
<BLURB>Default value.</BLURB>
-<DEFAULT>""</DEFAULT>
+<DEFAULT>FALSE</DEFAULT>
</ARG>
<ARG>
</ARG>
<ARG>
-<NAME>GtkFormField::field</NAME>
-<TYPE>gchar*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Field</NICK>
-<BLURB>Field's name.</BLURB>
-<DEFAULT>""</DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GtkFormField::form-widget</NAME>
-<TYPE>GtkFormWidget*</TYPE>
-<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>GtkFormWidget</NICK>
-<BLURB>The GtkFormWidget.</BLURB>
-<DEFAULT></DEFAULT>
-</ARG>
-
-<ARG>
-<NAME>GtkFormField::obligatory</NAME>
-<TYPE>gboolean</TYPE>
+<NAME>GtkFormFieldInteger::default</NAME>
+<TYPE>gint</TYPE>
<RANGE></RANGE>
-<FLAGS>rw</FLAGS>
-<NICK>Obligatory</NICK>
-<BLURB>Whether the field could be empty.</BLURB>
-<DEFAULT>FALSE</DEFAULT>
+<FLAGS>rwx</FLAGS>
+<NICK>Default</NICK>
+<BLURB>Default value.</BLURB>
+<DEFAULT>0</DEFAULT>
</ARG>
<ARG>
-<NAME>GtkFormField::to-save</NAME>
-<TYPE>gboolean</TYPE>
+<NAME>GtkFormFieldText::default</NAME>
+<TYPE>gchar*</TYPE>
<RANGE></RANGE>
<FLAGS>rwx</FLAGS>
-<NICK>Whether save the field or not</NICK>
-<BLURB>Whether the field should be included or not on sql INSERT INTO and UPDATE.</BLURB>
-<DEFAULT>TRUE</DEFAULT>
+<NICK>Default</NICK>
+<BLURB>Default value.</BLURB>
+<DEFAULT>""</DEFAULT>
</ARG>
<ARG>
-<NAME>GtkForm::key</NAME>
-<TYPE>GtkFormKey*</TYPE>
+<NAME>GtkFormWidget::widget</NAME>
+<TYPE>GtkWidget*</TYPE>
<RANGE></RANGE>
<FLAGS>rw</FLAGS>
-<NICK>Key</NICK>
-<BLURB>Key.</BLURB>
+<NICK>GtkWidget</NICK>
+<BLURB>The GtkWidget.</BLURB>
<DEFAULT></DEFAULT>
</ARG>
<ARG>
-<NAME>GtkForm::quote</NAME>
-<TYPE>gchar</TYPE>
+<NAME>GtkFormWidget::widget-name</NAME>
+<TYPE>gchar*</TYPE>
<RANGE></RANGE>
-<FLAGS>rwx</FLAGS>
-<NICK>Quoting character</NICK>
-<BLURB>Character to use to quote fields name.</BLURB>
-<DEFAULT>34</DEFAULT>
+<FLAGS>rw</FLAGS>
+<NICK>Widget's name</NICK>
+<BLURB>Widget's name.</BLURB>
+<DEFAULT>""</DEFAULT>
</ARG>
<ARG>
-<NAME>GtkForm::table</NAME>
+<NAME>GtkFormWidgetRadio::return-value</NAME>
<TYPE>gchar*</TYPE>
<RANGE></RANGE>
<FLAGS>rwx</FLAGS>
-<NICK>Table name</NICK>
-<BLURB>GtkForm's table name.</BLURB>
+<NICK>Return value</NICK>
+<BLURB>Return value.</BLURB>
<DEFAULT>""</DEFAULT>
</ARG>
<DEFAULT>0</DEFAULT>
</ARG>
-<ARG>
-<NAME>GtkFormFieldInteger::default</NAME>
-<TYPE>gint</TYPE>
-<RANGE></RANGE>
-<FLAGS>rwx</FLAGS>
-<NICK>Default</NICK>
-<BLURB>Default value.</BLURB>
-<DEFAULT>0</DEFAULT>
-</ARG>
-
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;
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);
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;
-}