From: Andrea Zagli Date: Wed, 28 Jul 2010 07:40:16 +0000 (+0200) Subject: Added functions GtkForm::get_form_field_value_by_name, X-Git-Tag: 0.1.4~3 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=c7044f0e0397482f035a660598c4afd13eaac96b;p=libgtkform Added functions GtkForm::get_form_field_value_by_name, GtkForm::get_form_widget_value_by_name, GtkForm::get_form_field_value_stringify_by_name, GtkForm::get_form_widget_value_stringify_by_name, GtkForm::get_form_field_value_sql_by_name and GtkForm::get_form_widget_value_sql_by_name. --- diff --git a/docs/reference/libgtkform-decl-list.txt b/docs/reference/libgtkform-decl-list.txt index c70119d..4e24d68 100644 --- a/docs/reference/libgtkform-decl-list.txt +++ b/docs/reference/libgtkform-decl-list.txt @@ -311,6 +311,12 @@ gtk_form_set_sensitive_by_name gtk_form_set_editable gtk_form_set_visible_by_name gtk_form_set_form_widget_visible_by_name +gtk_form_get_form_field_value_by_name +gtk_form_get_form_widget_value_by_name +gtk_form_get_form_field_value_stringify_by_name +gtk_form_get_form_widget_value_stringify_by_name +gtk_form_get_form_field_value_sql_by_name +gtk_form_get_form_widget_value_sql_by_name GtkFormSqlType gtk_form_get_sql gtk_form_fill_from_datamodel diff --git a/docs/reference/libgtkform-decl.txt b/docs/reference/libgtkform-decl.txt index 772b30c..9f31870 100644 --- a/docs/reference/libgtkform-decl.txt +++ b/docs/reference/libgtkform-decl.txt @@ -1323,6 +1323,36 @@ GtkForm *form, gboolean visible, ... void GtkForm *form, gboolean visible, ... + +gtk_form_get_form_field_value_by_name +GValue * +GtkForm *form, const gchar *field_name + + +gtk_form_get_form_widget_value_by_name +GValue * +GtkForm *form, const gchar *widget_name + + +gtk_form_get_form_field_value_stringify_by_name +const gchar * +GtkForm *form, const gchar *field_name + + +gtk_form_get_form_widget_value_stringify_by_name +const gchar * +GtkForm *form, const gchar *widget_name + + +gtk_form_get_form_field_value_sql_by_name +const gchar * +GtkForm *form, const gchar *field_name + + +gtk_form_get_form_widget_value_sql_by_name +const gchar * +GtkForm *form, const gchar *widget_name + GtkFormSqlType typedef enum diff --git a/docs/reference/libgtkform-undocumented.txt b/docs/reference/libgtkform-undocumented.txt index a57870d..48f1965 100644 --- a/docs/reference/libgtkform-undocumented.txt +++ b/docs/reference/libgtkform-undocumented.txt @@ -1,7 +1,7 @@ 8% symbol docs coverage. 28 symbols documented. 2 symbols incomplete. -315 not documented. +321 not documented. GTK_FORM @@ -199,8 +199,14 @@ gtk_form_fill_from_table gtk_form_get_field_from_name gtk_form_get_form_field_from_name gtk_form_get_form_field_from_widget +gtk_form_get_form_field_value_by_name +gtk_form_get_form_field_value_sql_by_name +gtk_form_get_form_field_value_stringify_by_name gtk_form_get_form_widget_from_name gtk_form_get_form_widget_from_widget +gtk_form_get_form_widget_value_by_name +gtk_form_get_form_widget_value_sql_by_name +gtk_form_get_form_widget_value_stringify_by_name gtk_form_get_group_by_name gtk_form_get_gtkbuilder gtk_form_get_key diff --git a/docs/reference/libgtkform-unused.txt b/docs/reference/libgtkform-unused.txt index 0497419..7755fe5 100644 --- a/docs/reference/libgtkform-unused.txt +++ b/docs/reference/libgtkform-unused.txt @@ -48,8 +48,14 @@ gtk_form_fill_from_hashtable gtk_form_fill_from_table gtk_form_get_form_field_from_name gtk_form_get_form_field_from_widget +gtk_form_get_form_field_value_by_name +gtk_form_get_form_field_value_sql_by_name +gtk_form_get_form_field_value_stringify_by_name gtk_form_get_form_widget_from_name gtk_form_get_form_widget_from_widget +gtk_form_get_form_widget_value_by_name +gtk_form_get_form_widget_value_sql_by_name +gtk_form_get_form_widget_value_stringify_by_name gtk_form_get_group_by_name gtk_form_get_gtkbuilder gtk_form_get_key diff --git a/src/field.c b/src/field.c index a0d7fe6..92daa51 100644 --- a/src/field.c +++ b/src/field.c @@ -212,6 +212,8 @@ GValue { GValue *ret; + ret = NULL; + if (IS_GTK_FORM_FIELD (field) && GTK_FORM_FIELD_GET_CLASS (field)->get_value != NULL) { ret = GTK_FORM_FIELD_GET_CLASS (field)->get_value (field); @@ -250,6 +252,8 @@ gtk_form_field_clear (GtkFormField *field) { gboolean ret; + ret = FALSE; + if (IS_GTK_FORM_FIELD (field) && GTK_FORM_FIELD_GET_CLASS (field)->clear != NULL) { ret = GTK_FORM_FIELD_GET_CLASS (field)->clear (field); diff --git a/src/form.c b/src/form.c index 4672e3f..cf4cd16 100644 --- a/src/form.c +++ b/src/form.c @@ -1531,7 +1531,7 @@ gtk_form_set_visible_by_name (GtkForm *form, gboolean visible, ...) /** * gtk_form_set_form_widgets_visible_by_name: - * @ a #GtkForm object. + * @form: a #GtkForm object. * @visible: whether to set every #GtkFormWidget visible or not. * @...: a #NULL terminated list of #GtkFormWidgets's names. * @@ -1570,6 +1570,141 @@ gtk_form_set_form_widgets_visible_by_name (GtkForm *form, gboolean visible, ...) va_end (vargs); } +/** + * gtk_form_get_form_field_value_by_name: + * @form: a #GtkForm object. + * @field_name: + * + */ +GValue +*gtk_form_get_form_field_value_by_name (GtkForm *form, const gchar *field_name) +{ + GValue *ret; + GtkFormField *field; + + ret = NULL; + + field = gtk_form_get_form_field_from_name (form, field_name); + ret = gtk_form_field_get_value (field); + + return ret; +} + +/** + * gtk_form_get_form_widget_value_by_name: + * @form: a #GtkForm object. + * @widget_name: + * + */ +GValue +*gtk_form_get_form_widget_value_by_name (GtkForm *form, const gchar *widget_name) +{ + GValue *ret; + GtkFormWidget *fwidget; + GtkFormField *field; + + ret = NULL; + + fwidget = gtk_form_get_form_widget_from_name (form, widget_name); + if (IS_GTK_FORM_WIDGET (fwidget)) + { + g_object_get (G_OBJECT (fwidget), "field", &field, NULL); + ret = gtk_form_field_get_value (field); + } + + return ret; +} + +/** + * gtk_form_get_form_field_value_stringify_by_name: + * @form: a #GtkForm object. + * @field_name: + * + */ +const gchar +*gtk_form_get_form_field_value_stringify_by_name (GtkForm *form, const gchar *field_name) +{ + gchar *ret; + GtkFormField *field; + + ret = NULL; + + field = gtk_form_get_form_field_from_name (form, field_name); + ret = gtk_form_field_get_value_stringify (field); + + return ret; +} + +/** + * gtk_form_get_form_widget_value_stringify_by_name: + * @form: a #GtkForm object. + * @widget_name: + * + */ +const gchar +*gtk_form_get_form_widget_value_stringify_by_name (GtkForm *form, const gchar *widget_name) +{ + gchar *ret; + GtkFormWidget *fwidget; + GtkFormField *field; + + ret = NULL; + + fwidget = gtk_form_get_form_widget_from_name (form, widget_name); + if (IS_GTK_FORM_WIDGET (fwidget)) + { + g_object_get (G_OBJECT (fwidget), "field", &field, NULL); + ret = gtk_form_field_get_value_stringify (field); + } + + return ret; +} + +/** + * gtk_form_get_form_field_value_sql_by_name: + * @form: a #GtkForm object. + * @field_name: + * + */ +const gchar +*gtk_form_get_form_field_value_sql_by_name (GtkForm *form, const gchar *field_name) +{ + gchar *ret; + GtkFormField *field; + + ret = NULL; + + field = gtk_form_get_form_field_from_name (form, field_name); + ret = gtk_form_field_get_value_sql (field); + + return ret; +} + +/** + * gtk_form_get_form_widget_value_sql_by_name: + * @form: a #GtkForm object. + * @widget_name: + * + */ +const gchar +*gtk_form_get_form_widget_value_sql_by_name (GtkForm *form, const gchar *widget_name) +{ + gchar *ret; + GtkFormWidget *fwidget; + GtkFormField *field; + + ret = NULL; + + fwidget = gtk_form_get_form_widget_from_name (form, widget_name); + if (IS_GTK_FORM_WIDGET (fwidget)) + { + g_object_get (G_OBJECT (fwidget), "field", &field, NULL); + ret = gtk_form_field_get_value_sql (field); + } + + return ret; +} + /** * gtk_form_get_sql: * @form: a #GtkForm object. diff --git a/src/form.h b/src/form.h index 5c33ade..f42ae37 100644 --- a/src/form.h +++ b/src/form.h @@ -104,6 +104,13 @@ void gtk_form_set_editable (GtkForm *form, gboolean editable); void gtk_form_set_visible_by_name (GtkForm *form, gboolean visible, ...); void gtk_form_set_form_widget_visible_by_name (GtkForm *form, gboolean visible, ...); +GValue *gtk_form_get_form_field_value_by_name (GtkForm *form, const gchar *field_name); +GValue *gtk_form_get_form_widget_value_by_name (GtkForm *form, const gchar *widget_name); +const gchar *gtk_form_get_form_field_value_stringify_by_name (GtkForm *form, const gchar *field_name); +const gchar *gtk_form_get_form_widget_value_stringify_by_name (GtkForm *form, const gchar *widget_name); +const gchar *gtk_form_get_form_field_value_sql_by_name (GtkForm *form, const gchar *field_name); +const gchar *gtk_form_get_form_widget_value_sql_by_name (GtkForm *form, const gchar *widget_name); + typedef enum { GTK_FORM_SQL_SELECT,