gboolean
gtk_form_group_set_from_datamodel (GtkFormGroup *group, GdaDataModel *dm, gint row)
{
- gboolean ret = FALSE;
+ gboolean ret;
+
+ GSList *els;
+
+ GtkFormField *ffield;
GtkFormGroupPrivate *priv = GTK_FORM_GROUP_GET_PRIVATE (group);
g_return_val_if_fail (GDA_IS_DATA_MODEL (dm), FALSE);
- /*if (IS_GTK_FORM_GROUP (group) && GTK_FORM_GROUP_GET_CLASS (group)->set_from_datamodel != NULL)
+ ret = FALSE;
+
+ els = priv->elements;
+ while (els != NULL)
{
- ret = GTK_FORM_GROUP_GET_CLASS (group)->set_from_datamodel (group, dm, row);
- }*/
+ if (IS_GTK_FORM_WIDGET ((GtkFormWidget *)els->data))
+ {
+ g_object_get (G_OBJECT (els->data), "field", &ffield, NULL);
+ }
+ else if (IS_GTK_FORM_FIELD ((GtkFormField *)els->data))
+ {
+ ffield = (GtkFormField *)els->data;
+ }
+
+ if (gtk_form_field_is_to_load (ffield))
+ {
+ gtk_form_field_set_from_datamodel (ffield, dm, row);
+ }
+
+ els = g_slist_next (els);
+ }
+
+ ret = TRUE;
return ret;
}
gboolean
gtk_form_group_set_from_hashtable (GtkFormGroup *group, GHashTable *hashtable)
{
- gboolean ret = FALSE;
+ gboolean ret;
+
+ GSList *els;
+
+ GtkFormField *ffield;
GtkFormGroupPrivate *priv = GTK_FORM_GROUP_GET_PRIVATE (group);
g_return_val_if_fail (hashtable != NULL, FALSE);
- /*if (IS_GTK_FORM_GROUP (group) && GTK_FORM_GROUP_GET_CLASS (group)->set_from_hashtable != NULL)
+ ret = FALSE;
+
+ els = priv->elements;
+ while (els != NULL)
{
- ret = GTK_FORM_GROUP_GET_CLASS (group)->set_from_hashtable (group, hashtable);
- }*/
+ if (IS_GTK_FORM_WIDGET ((GtkFormWidget *)els->data))
+ {
+ g_object_get (G_OBJECT (els->data), "field", &ffield, NULL);
+ }
+ else if (IS_GTK_FORM_FIELD ((GtkFormField *)els->data))
+ {
+ ffield = (GtkFormField *)els->data;
+ }
+
+ if (gtk_form_field_is_to_load (ffield))
+ {
+ gtk_form_field_set_from_hashtable (ffield, hashtable);
+ }
+
+ els = g_slist_next (els);
+ }
+
+ ret = TRUE;
return ret;
}