/**
* gtk_form_add_fields:
* @form: a #GtkForm object.
+ * @...: a NULL terminated list of #GtkFormFields to add.
*
*/
gboolean
}
/**
- * gtk_form_get_field_from_name:
+ * gtk_form_get_form_field_from_name:
* @form: a #GtkForm object.
* @field_name:
*
*/
GtkFormField
-*gtk_form_get_field_from_name (GtkForm *form, const gchar *field_name)
+*gtk_form_get_form_field_from_name (GtkForm *form, const gchar *field_name)
{
GtkFormField *field = NULL;
const gchar *name;
}
/**
- * gtk_form_get_widget_from_name:
+ * gtk_form_get_form_widget_from_name:
* @form: a #GtkForm object.
- * @widget_name:
+ * @widget_name: the #GtkFormWidget's name to return.
*
+ * Returns: a #GtkFormWidget.
*/
GtkFormWidget
-*gtk_form_get_widget_from_name (GtkForm *form, const gchar *widget_name)
+*gtk_form_get_form_widget_from_name (GtkForm *form, const gchar *widget_name)
{
GtkFormWidget *widget = NULL;
GtkFormWidget *widget_ret = NULL;
return widget_ret;
}
+/**
+ * gtk_form_get_objects:
+ * @form: a #GtkForm object.
+ *
+ * Returns: an array of all the #GtkWidget into the form. Must be free.
+ */
+GtkWidget
+**gtk_form_get_widgets (GtkForm *form)
+{
+ GtkFormPrivate *priv;
+
+ GtkWidget **ret;
+
+ GSList *fields;
+ guint l;
+
+ GtkFormWidget *form_widget;
+ GtkWidget *widget;
+
+ g_return_val_if_fail (IS_GTK_FORM (form), NULL);
+
+ priv = GTK_FORM_GET_PRIVATE (form);
+
+ ret = NULL;
+ l = 0;
+
+ fields = priv->fields;
+ while (fields != NULL)
+ {
+ l++;
+ ret = g_realloc (ret, l * sizeof (GtkWidget *));
+
+ form_widget = gtk_form_field_get_gtk_form_widget ((GtkFormField *)fields->data);
+ widget = gtk_form_widget_get_widget (form_widget);
+ ret[l] = widget;
+
+ fields = g_slist_next (fields);
+ }
+
+ return ret;
+}
+
+/**
+ * gtk_form_get_objects_by_name:
+ * @form: a #GtkForm object.
+ * @...: a NULL terminated list of objects name (gchar *) to return.
+ *
+ * Returns: an array of #GObject present in the #GtkBuilder object assigned to
+ * the form. Must be free.
+ */
+GObject
+**gtk_form_get_objects_by_name (GtkForm *form, ...)
+{
+ GObject **ret;
+
+ GtkFormPrivate *priv;
+
+ va_list vargs;
+ gchar *object_name;
+ guint l;
+
+ GObject *object;
+
+ g_return_val_if_fail (IS_GTK_FORM (form), NULL);
+
+ priv = GTK_FORM_GET_PRIVATE (form);
+
+ if (priv->gtkbuilder == NULL) return NULL;
+
+ ret = NULL;
+ l = 0;
+
+ va_start (vargs, form);
+
+ while ((object_name = va_arg (vargs, gchar *)) != NULL)
+ {
+ object = gtk_builder_get_object (priv->gtkbuilder, object_name);
+ if (object != NULL)
+ {
+ l++;
+ ret = g_realloc (ret, l * sizeof (GObject *));
+ ret[l] = object;
+ }
+ }
+
+ va_end (vargs);
+
+ return ret;
+}
+
/**
* gtk_form_clear:
* @form: a #GtkForm object.
gboolean gtk_form_add_fields (GtkForm *form, ...);
-GtkFormField *gtk_form_get_field_from_name (GtkForm *form, const gchar *field_name);
-GtkFormWidget *gtk_form_get_widget_from_name (GtkForm *form, const gchar *widget_name);
+GtkFormField *gtk_form_get_form_field_from_name (GtkForm *form, const gchar *field_name);
+GtkFormWidget *gtk_form_get_form_widget_from_name (GtkForm *form, const gchar *widget_name);
+
+GtkWidget **gtk_form_get_widgets (GtkForm *form);
+GObject **gtk_form_get_objects_by_name (GtkForm *form, ...);
gboolean gtk_form_clear (GtkForm *form);