[libgda] GdauiBasicForm API cleanups
- From: Vivien Malerba <vivien src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgda] GdauiBasicForm API cleanups
- Date: Tue, 22 Dec 2009 20:40:06 +0000 (UTC)
commit 8a8943aa19abf4b45f39f58413cbb82819e4e2f5
Author: Vivien Malerba <malerba gnome-db org>
Date: Thu Dec 17 22:31:54 2009 +0100
GdauiBasicForm API cleanups
* "param_changed" signal renamed to "holder-changed"
* gdaui_basic_form_has_been_changed() to gdaui_basic_form_has_changed()
* gdaui_basic_form_set_current_as_orig() to gdaui_basic_form_set_as_reference()
* gdaui_basic_form_show_entry_actions() removed, use property
* gdaui_basic_form_entry_show() to gdaui_basic_form_entry_set_visible()
* gdaui_basic_form_set_entries_auto_default() removed, use property
* gdaui_basic_form_set_entries_default() to gdaui_basic_form_set_entries_to_default()
doc/C/libgda-ui-sections.txt | 12 +-
doc/C/tmpl/gdaui-basic-form.sgml | 65 +---
libgda-ui/gdaui-basic-form.c | 536 +++++++----------------
libgda-ui/gdaui-basic-form.h | 48 +--
libgda-ui/gdaui-raw-form.c | 16 +-
libgda-ui/gdaui-server-operation.c | 4 +-
libgda-ui/internal/gdaui-provider-auth-editor.c | 2 +-
libgda-ui/internal/gdaui-provider-spec-editor.c | 4 +-
libgda-ui/libgda-ui.symbols | 11 +-
testing/gdaui-test-data-entries.c | 8 +-
tools/browser/auth-dialog.c | 2 +-
tools/browser/browser-connections-list.c | 2 +-
tools/browser/query-exec/query-console.c | 10 +-
13 files changed, 215 insertions(+), 505 deletions(-)
---
diff --git a/doc/C/libgda-ui-sections.txt b/doc/C/libgda-ui-sections.txt
index f6bc465..a27218a 100644
--- a/doc/C/libgda-ui-sections.txt
+++ b/doc/C/libgda-ui-sections.txt
@@ -17,21 +17,17 @@ gdaui_plugin_declare
<FILE>gdaui-basic-form</FILE>
<TITLE>GdauiBasicForm</TITLE>
GdauiBasicForm
-GdauiFormLayoutSpec
gdaui_basic_form_new
-gdaui_basic_form_new_custom
gdaui_basic_form_new_in_dialog
gdaui_basic_form_get_data_set
gdaui_basic_form_is_valid
-gdaui_basic_form_has_been_changed
+gdaui_basic_form_has_changed
gdaui_basic_form_reset
-gdaui_basic_form_set_current_as_orig
-gdaui_basic_form_show_entry_actions
-gdaui_basic_form_entry_show
+gdaui_basic_form_set_as_reference
+gdaui_basic_form_entry_set_visible
gdaui_basic_form_entry_grab_focus
gdaui_basic_form_entry_set_editable
-gdaui_basic_form_set_entries_auto_default
-gdaui_basic_form_set_entries_default
+gdaui_basic_form_set_entries_to_default
gdaui_basic_form_get_entry_widget
gdaui_basic_form_get_label_widget
<SUBSECTION Standard>
diff --git a/doc/C/tmpl/gdaui-basic-form.sgml b/doc/C/tmpl/gdaui-basic-form.sgml
index e87db0b..b580874 100644
--- a/doc/C/tmpl/gdaui-basic-form.sgml
+++ b/doc/C/tmpl/gdaui-basic-form.sgml
@@ -30,7 +30,7 @@ Form widget mapping the values contained in a #GdaSet
@gdauibasicform: the object which received the signal.
-<!-- ##### SIGNAL GdauiBasicForm::param-changed ##### -->
+<!-- ##### SIGNAL GdauiBasicForm::holder-changed ##### -->
<para>
</para>
@@ -59,11 +59,6 @@ Form widget mapping the values contained in a #GdaSet
</para>
-<!-- ##### ARG GdauiBasicForm:layout-spec ##### -->
-<para>
-
-</para>
-
<!-- ##### ARG GdauiBasicForm:paramlist ##### -->
<para>
@@ -74,16 +69,6 @@ Form widget mapping the values contained in a #GdaSet
</para>
-<!-- ##### STRUCT GdauiFormLayoutSpec ##### -->
-<para>
-
-</para>
-
- xml_object:
- xml_file:
- root_element:
- form_prefix:
-
<!-- ##### FUNCTION gdaui_basic_form_new ##### -->
<para>
@@ -93,18 +78,6 @@ Form widget mapping the values contained in a #GdaSet
@Returns:
-<!-- ##### FUNCTION gdaui_basic_form_new_custom ##### -->
-<para>
-
-</para>
-
- data_set:
- glade_file:
- root_element:
- form_prefix:
- Returns:
-
-
<!-- ##### FUNCTION gdaui_basic_form_new_in_dialog ##### -->
<para>
@@ -135,7 +108,7 @@ Form widget mapping the values contained in a #GdaSet
@Returns:
-<!-- ##### FUNCTION gdaui_basic_form_has_been_changed ##### -->
+<!-- ##### FUNCTION gdaui_basic_form_has_changed ##### -->
<para>
</para>
@@ -152,30 +125,21 @@ Form widget mapping the values contained in a #GdaSet
@form:
-<!-- ##### FUNCTION gdaui_basic_form_set_current_as_orig ##### -->
-<para>
-
-</para>
-
- form:
-
-
-<!-- ##### FUNCTION gdaui_basic_form_show_entry_actions ##### -->
+<!-- ##### FUNCTION gdaui_basic_form_set_as_reference ##### -->
<para>
</para>
@form:
- show_actions:
-<!-- ##### FUNCTION gdaui_basic_form_entry_show ##### -->
+<!-- ##### FUNCTION gdaui_basic_form_entry_set_visible ##### -->
<para>
</para>
@form:
- param:
+ holder:
@show:
@@ -185,7 +149,7 @@ Form widget mapping the values contained in a #GdaSet
</para>
@form:
- param:
+ holder:
<!-- ##### FUNCTION gdaui_basic_form_entry_set_editable ##### -->
@@ -194,20 +158,11 @@ Form widget mapping the values contained in a #GdaSet
</para>
@form:
- param:
+ holder:
@editable:
-<!-- ##### FUNCTION gdaui_basic_form_set_entries_auto_default ##### -->
-<para>
-
-</para>
-
- form:
- auto_default:
-
-
-<!-- ##### FUNCTION gdaui_basic_form_set_entries_default ##### -->
+<!-- ##### FUNCTION gdaui_basic_form_set_entries_to_default ##### -->
<para>
</para>
@@ -221,7 +176,7 @@ Form widget mapping the values contained in a #GdaSet
</para>
@form:
- param:
+ holder:
@Returns:
@@ -231,7 +186,7 @@ Form widget mapping the values contained in a #GdaSet
</para>
@form:
- param:
+ holder:
@Returns:
diff --git a/libgda-ui/gdaui-basic-form.c b/libgda-ui/gdaui-basic-form.c
index 76b6a55..9d3d5f3 100644
--- a/libgda-ui/gdaui-basic-form.c
+++ b/libgda-ui/gdaui-basic-form.c
@@ -36,18 +36,18 @@ static void gdaui_basic_form_init (GdauiBasicForm *wid);
static void gdaui_basic_form_dispose (GObject *object);
static void gdaui_basic_form_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void gdaui_basic_form_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void layout_spec_free (GdauiFormLayoutSpec *spec);
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
static void gdaui_basic_form_fill (GdauiBasicForm *form);
static void gdaui_basic_form_clean (GdauiBasicForm *form);
+static void gdaui_basic_form_show_entry_actions (GdauiBasicForm *form, gboolean show_actions);
+static void gdaui_basic_form_set_entries_auto_default (GdauiBasicForm *form, gboolean auto_default);
static void get_rid_of_set (GdaSet *paramlist, GdauiBasicForm *form);
static void paramlist_public_data_changed_cb (GdauiSet *paramlist, GdauiBasicForm *form);
@@ -59,18 +59,15 @@ static void entry_contents_activated (GdauiDataEntry *entry, GdauiBasicForm *for
static void parameter_changed_cb (GdaHolder *param, GdauiDataEntry *entry);
static void mark_not_null_entry_labels (GdauiBasicForm *form, gboolean show_mark);
-enum
-{
- PARAM_CHANGED,
+enum {
+ HOLDER_CHANGED,
ACTIVATED,
LAST_SIGNAL
};
/* properties */
-enum
-{
- PROP_0,
- PROP_LAYOUT_SPEC,
+enum {
+ PROP_0,
PROP_DATA_LAYOUT,
PROP_PARAMLIST,
PROP_HEADERS_SENSITIVE,
@@ -91,10 +88,9 @@ struct _GdauiBasicFormPriv
GArray *signal_data; /* array of SignalData */
GSList *entries;/* list of GdauiDataEntry widgets */
- GSList *not_null_labels;/* list of GtkLabel widgets corresponding to NOT NULL entries */
+ GSList *not_null_labels; /* list of GtkLabel widgets corresponding to NOT NULL entries */
gboolean can_expand; /* ORed among the data entrie's expand requests */
- GdauiFormLayoutSpec *layout_spec;
GtkWidget *entries_table;
GtkWidget *entries_glade;
GSList *hidden_entries;
@@ -145,18 +141,18 @@ gdaui_basic_form_class_init (GdauiBasicFormClass * class)
/* signals */
/**
- * GdauiBasicForm::param-changed:
+ * GdauiBasicForm::holder-changed:
* @form: GdauiBasicForm
* @param: that changed
* @is_user_modif: TRUE if the modification has been initiated by a user modification
*
* Emitted when a GdaHolder changes
*/
- gdaui_basic_form_signals[PARAM_CHANGED] =
- g_signal_new ("param_changed",
+ gdaui_basic_form_signals[HOLDER_CHANGED] =
+ g_signal_new ("holder-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GdauiBasicFormClass, param_changed),
+ G_STRUCT_OFFSET (GdauiBasicFormClass, holder_changed),
NULL, NULL,
_gdaui_marshal_VOID__OBJECT_BOOLEAN, G_TYPE_NONE, 2,
GDA_TYPE_HOLDER, G_TYPE_BOOLEAN);
@@ -175,7 +171,7 @@ gdaui_basic_form_class_init (GdauiBasicFormClass * class)
NULL, NULL,
_gdaui_marshal_VOID__VOID, G_TYPE_NONE, 0);
- class->param_changed = NULL;
+ class->holder_changed = NULL;
class->activated = NULL;
object_class->dispose = gdaui_basic_form_dispose;
@@ -183,12 +179,8 @@ gdaui_basic_form_class_init (GdauiBasicFormClass * class)
object_class->set_property = gdaui_basic_form_set_property;
object_class->get_property = gdaui_basic_form_get_property;
- g_object_class_install_property (object_class, PROP_LAYOUT_SPEC,
- g_param_spec_pointer ("layout_spec",
- _("Pointer to a GdauiFormLayoutSpec structure"), NULL,
- G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_DATA_LAYOUT,
- g_param_spec_pointer ("data_layout",
+ g_param_spec_pointer ("data-layout",
_("Pointer to an XML data layout specification"), NULL,
G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_PARAMLIST,
@@ -196,17 +188,17 @@ gdaui_basic_form_class_init (GdauiBasicFormClass * class)
_("List of parameters to show in the form"), NULL,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_HEADERS_SENSITIVE,
- g_param_spec_boolean ("headers_sensitive",
+ g_param_spec_boolean ("headers-sensitive",
_("Entry headers are sensitive"),
NULL, FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_SHOW_ACTIONS,
- g_param_spec_boolean ("show_actions",
+ g_param_spec_boolean ("show-actions",
_("Show Entry actions"),
NULL, FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_ENTRIES_AUTO_DEFAULT,
- g_param_spec_boolean ("entries_auto_default",
+ g_param_spec_boolean ("entries-auto-default",
_("Entries Auto-default"),
NULL, FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
@@ -226,7 +218,6 @@ gdaui_basic_form_init (GdauiBasicForm * wid)
wid->priv->entries = NULL;
wid->priv->can_expand = FALSE;
wid->priv->not_null_labels = NULL;
- wid->priv->layout_spec = NULL;
wid->priv->entries_glade = NULL;
wid->priv->entries_table = NULL;
wid->priv->hidden_entries = NULL;
@@ -251,6 +242,8 @@ static void widget_shown_cb (GtkWidget *wid, GdauiBasicForm *form);
* node of @paramlist.
*
* Returns: the new widget
+ *
+ * Since: 4.2
*/
GtkWidget *
gdaui_basic_form_new (GdaSet *paramlist)
@@ -262,38 +255,6 @@ gdaui_basic_form_new (GdaSet *paramlist)
return (GtkWidget *) obj;
}
-/**
- * gdaui_basic_form_new_custom
- * @paramlist: a #GdaSet structure
- * @glade_file: a Glade XML file name
- * @root_element: the name of the top-most widget in @glade_file to use in the new form
- * @form_prefix: the prefix used to look for widgets to add entries in
- *
- * Creates a new #GdauiBasicForm widget using all the parameters provided in @paramlist.
- *
- * The layout is specified in the @glade_file specification, and an entry is created for each
- * node of @paramlist.
- *
- * Returns: the new widget
- */
-GtkWidget *
-gdaui_basic_form_new_custom (GdaSet *paramlist, const gchar *glade_file,
- const gchar *root_element, const gchar *form_prefix)
-{
- GdauiFormLayoutSpec spec;
- GObject *obj;
-#ifdef HAVE_LIBGLADE
- spec.xml_object = NULL;
-#endif
- spec.xml_file = (gchar *) glade_file;
- spec.root_element = (gchar *) root_element;
- spec.form_prefix = (gchar *) form_prefix;
- obj = g_object_new (GDAUI_TYPE_BASIC_FORM, "layout_spec", &spec, "paramlist", paramlist, NULL);
-
- return (GtkWidget *) obj;
-}
-
-
static void
widget_shown_cb (GtkWidget *wid, GdauiBasicForm *form)
{
@@ -408,7 +369,7 @@ paramlist_param_attr_changed_cb (GdaSet *paramlist, GdaHolder *param,
/* hide entries which were hidden */
for (list = hidden_params; list; list = list->next)
- gdaui_basic_form_entry_show (form, GDA_HOLDER (list->data), FALSE);
+ gdaui_basic_form_entry_set_visible (form, GDA_HOLDER (list->data), FALSE);
g_slist_free (hidden_params);
}
}
@@ -742,22 +703,22 @@ load_xml_data_layout_portal (GdauiBasicForm *form,
(GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
(GtkAttachOptions) (GTK_FILL|GTK_EXPAND), 0, 0);
} else
- if (!xmlStrcmp (node->parent->name, BAD_CAST "data_layout_notebook")) {
+ if (!xmlStrcmp (node->parent->name, BAD_CAST "data_layout_notebook")) {
- GtkLabel *label;
- gchar *markup = g_strdup_printf ("<b>%s</b>", (name != NULL) ? name : "");
- label = GTK_LABEL(gtk_label_new (markup));
- g_free (markup);
- gtk_widget_show (GTK_WIDGET(label));
- gtk_label_set_use_markup (label, TRUE);
+ GtkLabel *label;
+ gchar *markup = g_strdup_printf ("<b>%s</b>", (name != NULL) ? name : "");
+ label = GTK_LABEL(gtk_label_new (markup));
+ g_free (markup);
+ gtk_widget_show (GTK_WIDGET(label));
+ gtk_label_set_use_markup (label, TRUE);
- gtk_container_add (GTK_CONTAINER(data), GTK_WIDGET(vbox));
+ gtk_container_add (GTK_CONTAINER(data), GTK_WIDGET(vbox));
- gtk_notebook_set_tab_label (GTK_NOTEBOOK(data),
- gtk_notebook_get_nth_page
- (GTK_NOTEBOOK(data), sequence - 1),
- GTK_WIDGET(label));
- }
+ gtk_notebook_set_tab_label (GTK_NOTEBOOK(data),
+ gtk_notebook_get_nth_page
+ (GTK_NOTEBOOK(data), sequence - 1),
+ GTK_WIDGET(label));
+ }
g_free (name);
g_free (relationship);
@@ -931,53 +892,53 @@ load_xml_data_layout_group (GdauiBasicForm *form,
gtk_box_pack_start (GTK_BOX(data), GTK_WIDGET(frame), FALSE, TRUE, 0);
} else
- if (!xmlStrcmp (node->parent->name, BAD_CAST "data_layout_group")) {
+ if (!xmlStrcmp (node->parent->name, BAD_CAST "data_layout_group")) {
- GtkFrame *frame = GTK_FRAME(gtk_frame_new (NULL));
- gtk_widget_show (GTK_WIDGET(frame));
- gtk_frame_set_shadow_type (frame, GTK_SHADOW_NONE);
+ GtkFrame *frame = GTK_FRAME(gtk_frame_new (NULL));
+ gtk_widget_show (GTK_WIDGET(frame));
+ gtk_frame_set_shadow_type (frame, GTK_SHADOW_NONE);
- GtkAlignment *alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
- gtk_widget_show (GTK_WIDGET(alignment));
- gtk_container_add (GTK_CONTAINER(frame), GTK_WIDGET(alignment));
- gtk_alignment_set_padding (alignment, 0, 0, 12, 0);
+ GtkAlignment *alignment = GTK_ALIGNMENT(gtk_alignment_new (0.5, 0.5, 1, 1));
+ gtk_widget_show (GTK_WIDGET(alignment));
+ gtk_container_add (GTK_CONTAINER(frame), GTK_WIDGET(alignment));
+ gtk_alignment_set_padding (alignment, 0, 0, 12, 0);
- gtk_container_add (GTK_CONTAINER(alignment), GTK_WIDGET(table));
+ gtk_container_add (GTK_CONTAINER(alignment), GTK_WIDGET(table));
- gchar *markup = g_strdup_printf ("<b>%s</b>", (title != NULL) ? title : "");
- gtk_label_set_text (label, markup);
- g_free (markup);
- gtk_label_set_use_markup (label, TRUE);
+ gchar *markup = g_strdup_printf ("<b>%s</b>", (title != NULL) ? title : "");
+ gtk_label_set_text (label, markup);
+ g_free (markup);
+ gtk_label_set_use_markup (label, TRUE);
- gtk_frame_set_label_widget (frame, GTK_WIDGET(label));
+ gtk_frame_set_label_widget (frame, GTK_WIDGET(label));
- gint n_columns, n_rows;
- g_object_get (G_OBJECT(data), "n-columns", &n_columns, NULL);
- g_object_get (G_OBJECT(data), "n-rows", &n_rows, NULL);
+ gint n_columns, n_rows;
+ g_object_get (G_OBJECT(data), "n-columns", &n_columns, NULL);
+ g_object_get (G_OBJECT(data), "n-rows", &n_rows, NULL);
- gint col, row;
- col = 2 * ((sequence - 1) / n_rows);
- row = (sequence - 1) % n_rows;
+ gint col, row;
+ col = 2 * ((sequence - 1) / n_rows);
+ row = (sequence - 1) % n_rows;
- gtk_table_attach (GTK_TABLE(data), GTK_WIDGET(frame),
- col, col + 2, row, row + 1,
- (GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
- (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), 0, 0);
- } else
- if (!xmlStrcmp (node->parent->name, BAD_CAST "data_layout_notebook")) {
+ gtk_table_attach (GTK_TABLE(data), GTK_WIDGET(frame),
+ col, col + 2, row, row + 1,
+ (GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
+ (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), 0, 0);
+ } else
+ if (!xmlStrcmp (node->parent->name, BAD_CAST "data_layout_notebook")) {
- gchar *text = g_strdup ((title != NULL) ? title : "");
- gtk_label_set_text (label, text);
- g_free (text);
+ gchar *text = g_strdup ((title != NULL) ? title : "");
+ gtk_label_set_text (label, text);
+ g_free (text);
- gtk_container_add (GTK_CONTAINER(data), GTK_WIDGET(table));
+ gtk_container_add (GTK_CONTAINER(data), GTK_WIDGET(table));
- gtk_notebook_set_tab_label (GTK_NOTEBOOK(data),
- gtk_notebook_get_nth_page
- (GTK_NOTEBOOK(data), sequence - 1),
- GTK_WIDGET(label));
- }
+ gtk_notebook_set_tab_label (GTK_NOTEBOOK(data),
+ gtk_notebook_get_nth_page
+ (GTK_NOTEBOOK(data), sequence - 1),
+ GTK_WIDGET(label));
+ }
xmlNodePtr child;
for (child = node->children; child != NULL; child = child->next) {
@@ -1045,8 +1006,6 @@ load_xml_data_layout_groups (GdauiBasicForm *form,
gtk_scrolled_window_add_with_viewport (form->priv->scrolled_window,
(GtkWidget *) vbox);
- /* gtk_box_pack_start (GTK_BOX(form), (GtkWidget *) form->priv->scrolled_window, */
- /* TRUE, TRUE, 0); */
xmlNodePtr child;
for (child = node->children; child != NULL; child = child->next) {
@@ -1108,9 +1067,7 @@ load_xml_data_layout (GdauiBasicForm *form,
}
static void
-load_xml_data_layouts (GdauiBasicForm *form,
- xmlNodePtr node,
- gpointer data)
+load_xml_data_layouts (GdauiBasicForm *form, xmlNodePtr node, gpointer data)
{
g_print ("%s:\n", __func__);
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
@@ -1200,54 +1157,10 @@ gdaui_basic_form_set_property (GObject *object,
GParamSpec *pspec)
{
GdauiBasicForm *form;
-#ifdef HAVE_LIBGLADE
- GdauiFormLayoutSpec *lspec, *new_spec = NULL;
-#endif
form = GDAUI_BASIC_FORM (object);
if (form->priv) {
switch (param_id) {
- case PROP_LAYOUT_SPEC:
-#ifdef HAVE_LIBGLADE
- lspec = g_value_get_pointer (value);
- if (lspec) {
- g_return_if_fail (lspec->xml_file || lspec->xml_object);
- g_return_if_fail (lspec->root_element);
-
- /* spec copy */
- new_spec = g_new0 (GdauiFormLayoutSpec, 1);
- if (lspec->xml_file)
- new_spec->xml_file = g_strdup (lspec->xml_file);
- if (lspec->xml_object) {
- new_spec->xml_object = lspec->xml_object;
- g_object_ref (new_spec->xml_object);
- }
- if (lspec->root_element)
- new_spec->root_element = g_strdup (lspec->root_element);
- if (lspec->form_prefix)
- new_spec->form_prefix = g_strdup (lspec->form_prefix);
-
- /* spec verify */
- if (!new_spec->xml_object) {
- new_spec->xml_object = glade_xml_new (new_spec->xml_file, new_spec->root_element, NULL);
- if (! new_spec->xml_object) {
- layout_spec_free (new_spec);
- g_warning (_("Could not load file '%s'"), new_spec->xml_file);
- return;
- }
- }
- }
-
- gdaui_basic_form_clean (form);
- if (new_spec) {
- form->priv->layout_spec = new_spec;
- g_print ("Loaded Glade file, reinit interface\n");
- }
- gdaui_basic_form_fill (form);
-#else
- g_warning (_("Libglade support not built."));
-#endif
- break;
case PROP_DATA_LAYOUT:
{
xmlNodePtr node = g_value_get_pointer (value);
@@ -1272,44 +1185,6 @@ gdaui_basic_form_set_property (GObject *object,
break;
case PROP_PARAMLIST:
if (form->priv->set) {
-#ifdef HAVE_LIBGLADE
- new_spec = NULL;
- if (form->priv->layout_spec) {
- /* old spec */
- lspec = form->priv->layout_spec;
- /* spec copy */
- new_spec = g_new0 (GdauiFormLayoutSpec, 1);
- if (lspec->xml_file)
- new_spec->xml_file = g_strdup (lspec->xml_file);
- if (lspec->xml_object) {
- new_spec->xml_object = lspec->xml_object;
- g_object_ref (new_spec->xml_object);
- }
- if (lspec->root_element)
- new_spec->root_element = g_strdup (lspec->root_element);
- if (lspec->form_prefix)
- new_spec->form_prefix = g_strdup (lspec->form_prefix);
- }
-#endif
-#ifdef HAVE_LIBGLADE
- new_spec = NULL;
- if (form->priv->layout_spec) {
- /* old spec */
- lspec = form->priv->layout_spec;
- /* spec copy */
- new_spec = g_new0 (GdauiFormLayoutSpec, 1);
- if (lspec->xml_file)
- new_spec->xml_file = g_strdup (lspec->xml_file);
- if (lspec->xml_object) {
- new_spec->xml_object = lspec->xml_object;
- g_object_ref (new_spec->xml_object);
- }
- if (lspec->root_element)
- new_spec->root_element = g_strdup (lspec->root_element);
- if (lspec->form_prefix)
- new_spec->form_prefix = g_strdup (lspec->form_prefix);
- }
-#endif
get_rid_of_set (form->priv->set, form);
gdaui_basic_form_clean (form);
}
@@ -1326,11 +1201,6 @@ gdaui_basic_form_set_property (GObject *object,
g_signal_connect (form->priv->set, "holder-attr-changed",
G_CALLBACK (paramlist_param_attr_changed_cb), form);
-#ifdef HAVE_LIBGLADE
- if (new_spec)
- form->priv->layout_spec = new_spec;
- new_spec = NULL;
-#endif
gdaui_basic_form_fill (form);
}
break;
@@ -1338,10 +1208,10 @@ gdaui_basic_form_set_property (GObject *object,
form->priv->headers_sensitive = g_value_get_boolean (value);
break;
case PROP_SHOW_ACTIONS:
- gdaui_basic_form_show_entry_actions(form, g_value_get_boolean(value));
+ gdaui_basic_form_show_entry_actions(form, g_value_get_boolean (value));
break;
case PROP_ENTRIES_AUTO_DEFAULT:
- gdaui_basic_form_set_entries_auto_default(form, g_value_get_boolean(value));
+ gdaui_basic_form_set_entries_auto_default(form, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
@@ -1352,9 +1222,9 @@ gdaui_basic_form_set_property (GObject *object,
static void
gdaui_basic_form_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GdauiBasicForm *form;
@@ -1410,10 +1280,6 @@ gdaui_basic_form_clean (GdauiBasicForm *form)
gtk_widget_destroy (form->priv->entries_glade);
form->priv->entries_glade = NULL;
}
- if (form->priv->layout_spec) {
- layout_spec_free (form->priv->layout_spec);
- form->priv->layout_spec = NULL;
- }
g_slist_free (form->priv->not_null_labels);
form->priv->not_null_labels = NULL;
@@ -1427,19 +1293,6 @@ gdaui_basic_form_clean (GdauiBasicForm *form)
}
}
-static void
-layout_spec_free (GdauiFormLayoutSpec *spec)
-{
-#ifdef HAVE_LIBGLADE
- if (spec->xml_object)
- g_object_unref (spec->xml_object);
-#endif
- g_free (spec->xml_file);
- g_free (spec->root_element);
- g_free (spec->form_prefix);
- g_free (spec);
-}
-
static void entry_destroyed_cb (GtkWidget *entry, GdauiBasicForm *form);
static void label_destroyed_cb (GtkWidget *label, GdauiBasicForm *form);
@@ -1530,13 +1383,13 @@ gdaui_basic_form_fill (GdauiBasicForm *form)
if (default_val) {
gdaui_data_entry_set_value_default (GDAUI_DATA_ENTRY (entry), default_val);
gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (entry),
- GDA_VALUE_ATTR_CAN_BE_DEFAULT,
- GDA_VALUE_ATTR_CAN_BE_DEFAULT);
+ GDA_VALUE_ATTR_CAN_BE_DEFAULT,
+ GDA_VALUE_ATTR_CAN_BE_DEFAULT);
}
gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (entry),
- nnul ? 0 : GDA_VALUE_ATTR_CAN_BE_NULL,
- GDA_VALUE_ATTR_CAN_BE_NULL);
+ nnul ? 0 : GDA_VALUE_ATTR_CAN_BE_NULL,
+ GDA_VALUE_ATTR_CAN_BE_NULL);
g_object_set_data (G_OBJECT (entry), "param", param);
g_object_set_data (G_OBJECT (entry), "form", form);
@@ -1578,8 +1431,8 @@ gdaui_basic_form_fill (GdauiBasicForm *form)
g_array_prepend_val (form->priv->signal_data, sd);
}
gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (entry),
- nnul ? 0 : GDA_VALUE_ATTR_CAN_BE_NULL,
- GDA_VALUE_ATTR_CAN_BE_NULL);
+ nnul ? 0 : GDA_VALUE_ATTR_CAN_BE_NULL,
+ GDA_VALUE_ATTR_CAN_BE_NULL);
}
/* connect the entry's changes */
@@ -1589,61 +1442,7 @@ gdaui_basic_form_fill (GdauiBasicForm *form)
G_CALLBACK (entry_contents_activated), form);
}
-
- /*
- * If there is a layout spec, then try to use it
- */
-#ifdef HAVE_LIBGLADE
- if (form->priv->layout_spec) {
- GtkWidget *layout = NULL;
-
- layout = glade_xml_get_widget (form->priv->layout_spec->xml_object, form->priv->layout_spec->root_element);
- if (!layout) {
- g_warning (_("Can't find widget named '%s', returning to basic layout"),
- form->priv->layout_spec->root_element);
- layout_spec_free (form->priv->layout_spec);
- form->priv->layout_spec = NULL;
- }
- else {
- /* really use the provided layout */
- GtkWidget *box;
- GSList *groups;
-
- gtk_box_pack_start (GTK_BOX (form), layout, TRUE, TRUE, 0);
- list = form->priv->entries;
- groups = form->priv->set->groups_list;
- while (groups && list) {
- gint param_no;
- gchar *box_name;
-
- param_no = g_slist_index (form->priv->set->holders,
- ((GdaSetNode *)(((GdaSetGroup *)groups->data)->nodes->data))->holder);
- box_name = g_strdup_printf ("%s_%d", form->priv->layout_spec->form_prefix, param_no);
- box = glade_xml_get_widget (form->priv->layout_spec->xml_object, box_name);
- g_print ("Box named %s => %p\n", box_name, box);
- g_free (box_name);
- if (box) {
- gboolean expand;
- expand = gdaui_data_entry_expand_in_layout (GDAUI_DATA_ENTRY (list->data));
- form_expand = form_expand || expand;
-
- gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (list->data), expand, TRUE, 0);
- gtk_widget_show (GTK_WIDGET (list->data));
- if (! g_object_get_data (G_OBJECT (box), "show_actions"))
- gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (list->data),
- 0, GDA_VALUE_ATTR_ACTIONS_SHOWN);
- }
- list = g_slist_next (list);
- groups = g_slist_next (groups);
- }
- g_assert (!groups && !list);
- gtk_widget_show (layout);
- }
- }
-#endif
-
if (form->priv->scrolled_window != NULL) {
-
gtk_box_pack_start (GTK_BOX(form),
(GtkWidget *) form->priv->scrolled_window,
TRUE, TRUE, 0);
@@ -1691,7 +1490,7 @@ gdaui_basic_form_fill (GdauiBasicForm *form)
* There is no layout spec (or the provided one could not be used),
* so use the default tables arrangment
*/
- if (!form->priv->layout_spec && form->priv->scrolled_window == NULL) {
+ if (form->priv->scrolled_window == NULL) {
GtkWidget *table, *label;
gint i;
@@ -1725,11 +1524,6 @@ gdaui_basic_form_fill (GdauiBasicForm *form)
form->priv->not_null_labels = g_slist_prepend (form->priv->not_null_labels,
label);
-#ifdef HAVE_LIBGLADE_FIXME
- if (new_spec)
- form->priv->layout_spec = new_spec;
- new_spec = NULL;
-#endif
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i+1,
@@ -1896,7 +1690,7 @@ entry_contents_modified (GdauiDataEntry *entry, GdauiBasicForm *form)
(attr & GDA_VALUE_ATTR_IS_DEFAULT))
gda_holder_set_value_to_default (param);
else if (gda_holder_set_value (param, value, NULL))
- g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[PARAM_CHANGED], 0, param, TRUE);
+ g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[HOLDER_CHANGED], 0, param, TRUE);
else {
/* GdaHolder refused value => reset GdaDataEntry */
g_signal_handlers_block_by_func (G_OBJECT (entry),
@@ -1922,9 +1716,9 @@ entry_contents_modified (GdauiDataEntry *entry, GdauiBasicForm *form)
/* REM: if there is more than one value in 'params', then a
* signal is emitted for each param that is changed,
* and there is no way for the listener of that signal to know if it
- * the end of the "param_changed" sequence. What could be done is:
+ * the end of the "holder-changed" sequence. What could be done is:
* - adding another boolean to tell if that signal is the
- * last one in the "param_changed" sequence, or
+ * last one in the "holder-changed" sequence, or
* - modify the signal to add a list of parameters which are changed
* and emit only one signal.
*/
@@ -1934,14 +1728,8 @@ entry_contents_modified (GdauiDataEntry *entry, GdauiBasicForm *form)
/* parameter's value */
param = GDA_SET_NODE (params->data)->holder;
gda_holder_set_value (param, (GValue *)(list->data), NULL);
-#ifdef debug_signal
- g_print (">> 'PARAM_CHANGED' from %s\n", __FUNCTION__);
-#endif
- g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[PARAM_CHANGED],
+ g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[HOLDER_CHANGED],
0, param, TRUE);
-#ifdef debug_signal
- g_print ("<< 'PARAM_CHANGED' from %s\n", __FUNCTION__);
-#endif
form->priv->forward_param_updates = TRUE;
}
g_slist_free (values);
@@ -1980,7 +1768,7 @@ entry_contents_modified (GdauiDataEntry *entry, GdauiBasicForm *form)
/*
* Called when a parameter changes
- * We emit a "param_changed" signal only if the 'form->priv->forward_param_updates' is TRUE, which means
+ * We emit a "holder-changed" signal only if the 'form->priv->forward_param_updates' is TRUE, which means
* the param change does not come from a GdauiDataEntry change.
*/
static void
@@ -2041,44 +1829,23 @@ parameter_changed_cb (GdaHolder *param, GdauiDataEntry *entry)
G_CALLBACK (entry_contents_activated), form);
}
-#ifdef debug_signal
- g_print (">> 'PARAM_CHANGED' from %s\n", __FUNCTION__);
-#endif
- g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[PARAM_CHANGED], 0, param, FALSE);
-#ifdef debug_signal
- g_print ("<< 'PARAM_CHANGED' from %s\n", __FUNCTION__);
-#endif
+ g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[HOLDER_CHANGED], 0, param, FALSE);
}
}
/**
- * gdaui_basic_form_get_paramlist
- * @form: a #GdauiBasicForm widget
- *
- * Get a pointer to the #GdaSet used internally by @form to store
- * values
- *
- * Returns:
- */
-GdaSet *
-gdaui_basic_form_get_paramlist (GdauiBasicForm *form)
-{
- g_return_val_if_fail (GDAUI_IS_BASIC_FORM (form), NULL);
-
- return form->priv->set;
-}
-
-/**
- * gdaui_basic_form_set_current_as_orig
+ * gdaui_basic_form_set_as_reference
* @form: a #GdauiBasicForm widget
*
* Tells @form that the current values in the different entries are
* to be considered as the original values for all the entries; the immediate
- * consequence is that any sub-sequent call to gdaui_basic_form_has_been_changed()
+ * consequence is that any sub-sequent call to gdaui_basic_form_has_changed()
* will return FALSE (of course until any entry is changed).
+ *
+ * Since: 4.2
*/
void
-gdaui_basic_form_set_current_as_orig (GdauiBasicForm *form)
+gdaui_basic_form_set_as_reference (GdauiBasicForm *form)
{
GSList *list;
GdaHolder *param;
@@ -2133,6 +1900,8 @@ gdaui_basic_form_set_current_as_orig (GdauiBasicForm *form)
* Tells if the form can be used as-is (if all the parameters do have some valid values)
*
* Returns: TRUE if the form is valid
+ *
+ * Since: 4.2
*/
gboolean
gdaui_basic_form_is_valid (GdauiBasicForm *form)
@@ -2149,7 +1918,9 @@ gdaui_basic_form_is_valid (GdauiBasicForm *form)
* Get a pointer to the #GdaSet object which
* is modified by @form
*
- * Returns:
+ * Returns: a pointer to the #GdaSet
+ *
+ * Since: 4.2
*/
GdaSet *
gdaui_basic_form_get_data_set (GdauiBasicForm *form)
@@ -2160,32 +1931,31 @@ gdaui_basic_form_get_data_set (GdauiBasicForm *form)
}
/**
- * gdaui_basic_form_has_been_changed
+ * gdaui_basic_form_has_changed
* @form: a #GdauiBasicForm widget
*
- * Tells if the form has had at least on entry changed, or not
+ * Tells if the form has had at least on entry changed since @form was created or
+ * gdaui_basic_form_set_as_reference() has been called.
+ *
+ * Returns: %TRUE if one entry has changed at least
*
- * Returns:
+ * Since: 4.2
*/
gboolean
-gdaui_basic_form_has_been_changed (GdauiBasicForm *form)
+gdaui_basic_form_has_changed (GdauiBasicForm *form)
{
- gboolean changed = FALSE;
GSList *list;
g_return_val_if_fail (GDAUI_IS_BASIC_FORM (form), FALSE);
- list = form->priv->entries;
- while (list && !changed) {
- if (! (gdaui_data_entry_get_attributes (GDAUI_DATA_ENTRY (list->data)) & GDA_VALUE_ATTR_IS_UNCHANGED))
- changed = TRUE;
- list = g_slist_next (list);
- }
-
- return changed;
+ for (list = form->priv->entries; list; list = list->next)
+ if (! (gdaui_data_entry_get_attributes (GDAUI_DATA_ENTRY (list->data)) &
+ GDA_VALUE_ATTR_IS_UNCHANGED))
+ return TRUE;
+ return FALSE;
}
-/**
+/*
* gdaui_basic_form_show_entry_actions
* @form: a #GdauiBasicForm widget
* @show_actions: a boolean
@@ -2193,7 +1963,7 @@ gdaui_basic_form_has_been_changed (GdauiBasicForm *form)
* Show or hide the actions button available at the end of each data entry
* in the form
*/
-void
+static void
gdaui_basic_form_show_entry_actions (GdauiBasicForm *form, gboolean show_actions)
{
GSList *entries;
@@ -2204,13 +1974,9 @@ gdaui_basic_form_show_entry_actions (GdauiBasicForm *form, gboolean show_actions
show = show_actions ? GDA_VALUE_ATTR_ACTIONS_SHOWN : 0;
form->priv->show_actions = show_actions;
- entries = form->priv->entries;
- while (entries) {
+ for (entries = form->priv->entries; entries; entries = entries->next)
gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (entries->data), show,
- GDA_VALUE_ATTR_ACTIONS_SHOWN);
- entries = g_slist_next (entries);
- }
-
+ GDA_VALUE_ATTR_ACTIONS_SHOWN);
/* mark_not_null_entry_labels (form, show_actions); */
}
@@ -2220,6 +1986,8 @@ gdaui_basic_form_show_entry_actions (GdauiBasicForm *form, gboolean show_actions
*
* Resets all the entries in the form to their
* original values
+ *
+ * Since: 4.2
*/
void
gdaui_basic_form_reset (GdauiBasicForm *form)
@@ -2253,16 +2021,18 @@ gdaui_basic_form_reset (GdauiBasicForm *form)
/**
- * gdaui_basic_form_entry_show
+ * gdaui_basic_form_entry_set_visible
* @form: a #GdauiBasicForm widget
* @param: a #GdaHolder object
* @show:
*
* Shows or hides the #GdauiDataEntry in @form which corresponds to the
* @param parameter
+ *
+ * Since: 4.2
*/
void
-gdaui_basic_form_entry_show (GdauiBasicForm *form, GdaHolder *param, gboolean show)
+gdaui_basic_form_entry_set_visible (GdauiBasicForm *form, GdaHolder *param, gboolean show)
{
GtkWidget *entry;
@@ -2326,6 +2096,8 @@ gdaui_basic_form_entry_show (GdauiBasicForm *form, GdaHolder *param, gboolean sh
* @param: a #GdaHolder object
*
* Makes the data entry corresponding to @param grab the focus for the window it's in
+ *
+ * Since: 4.2
*/
void
gdaui_basic_form_entry_grab_focus (GdauiBasicForm *form, GdaHolder *param)
@@ -2349,6 +2121,8 @@ gdaui_basic_form_entry_grab_focus (GdauiBasicForm *form, GdaHolder *param)
* Sets the #GdauiDataEntry in @form which corresponds to the
* @param parameter editable or not. If @param is %NULL, then all the parameters
* are concerned.
+ *
+ * Since: 4.2
*/
void
gdaui_basic_form_entry_set_editable (GdauiBasicForm *form, GdaHolder *param, gboolean editable)
@@ -2375,19 +2149,19 @@ gdaui_basic_form_entry_set_editable (GdauiBasicForm *form, GdaHolder *param, gbo
}
-/**
+/*
* gdaui_basic_form_set_entries_auto_default
* @form: a #GdauiBasicForm widget
* @auto_default:
*
- * Sets weather all the #GdauiDataEntry entries in the form must default
+ * Sets wether all the #GdauiDataEntry entries in the form must default
* to a default value if they are assigned a non valid value.
* Depending on the real type of entry, it will provide a default value
* which the user does not need to modify if it is OK.
*
* For example a date entry can by default display the current date.
*/
-void
+static void
gdaui_basic_form_set_entries_auto_default (GdauiBasicForm *form, gboolean auto_default)
{
GSList *entries;
@@ -2395,39 +2169,37 @@ gdaui_basic_form_set_entries_auto_default (GdauiBasicForm *form, gboolean auto_d
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
form->priv->entries_auto_default = auto_default;
- entries = form->priv->entries;
- while (entries) {
+ for (entries = form->priv->entries; entries; entries = entries->next) {
if (g_object_class_find_property (G_OBJECT_GET_CLASS (entries->data), "set_default_if_invalid"))
g_object_set (G_OBJECT (entries->data), "set_default_if_invalid", auto_default, NULL);
- entries = g_slist_next (entries);
}
}
/**
- * gdaui_basic_form_set_entries_default
+ * gdaui_basic_form_set_entries_to_default
* @form: a #GdauiBasicForm widget
*
* For each entry in the form, sets it to a default value if it is possible to do so.
+ *
+ * Since: 4.2
*/
void
-gdaui_basic_form_set_entries_default (GdauiBasicForm *form)
+gdaui_basic_form_set_entries_to_default (GdauiBasicForm *form)
{
GSList *entries;
guint attrs;
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
- entries = form->priv->entries;
- while (entries) {
+ for (entries = form->priv->entries; entries; entries = entries->next) {
attrs = gdaui_data_entry_get_attributes (GDAUI_DATA_ENTRY (entries->data));
if (attrs & GDA_VALUE_ATTR_CAN_BE_DEFAULT)
gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (entries->data),
- GDA_VALUE_ATTR_IS_DEFAULT, GDA_VALUE_ATTR_IS_DEFAULT);
- entries = g_slist_next (entries);
+ GDA_VALUE_ATTR_IS_DEFAULT, GDA_VALUE_ATTR_IS_DEFAULT);
}
}
-static void form_param_changed (GdauiBasicForm *form, GdaHolder *param, gboolean is_user_modif, GtkDialog *dlg);
+static void form_holder_changed (GdauiBasicForm *form, GdaHolder *param, gboolean is_user_modif, GtkDialog *dlg);
/**
* gdaui_basic_form_get_entry_widget
@@ -2437,6 +2209,8 @@ static void form_param_changed (GdauiBasicForm *form, GdaHolder *param, gboolean
* Get the #GdauiDataEntry in @form which corresponds to the param parameter.
*
* Returns: the requested widget, or %NULL if not found
+ *
+ * Since: 4.2
*/
GtkWidget *
gdaui_basic_form_get_entry_widget (GdauiBasicForm *form, GdaHolder *param)
@@ -2479,6 +2253,8 @@ gdaui_basic_form_get_entry_widget (GdauiBasicForm *form, GdaHolder *param)
* Get the label in @form which corresponds to the param parameter.
*
* Returns: the requested widget, or %NULL if not found
+ *
+ * Since: 4.2
*/
GtkWidget *
gdaui_basic_form_get_label_widget (GdauiBasicForm *form, GdaHolder *param)
@@ -2510,6 +2286,8 @@ gdaui_basic_form_get_label_widget (GdauiBasicForm *form, GdaHolder *param)
* "form".
*
* Returns: the new #GtkDialog widget
+ *
+ * Since: 4.2
*/
GtkWidget *
gdaui_basic_form_new_in_dialog (GdaSet *paramlist, GtkWindow *parent,
@@ -2549,34 +2327,36 @@ gdaui_basic_form_new_in_dialog (GdaSet *paramlist, GtkWindow *parent,
#endif
gtk_widget_show (label);
}
-
-
+
+
#if GTK_CHECK_VERSION(2,18,0)
gtk_container_set_border_width (GTK_CONTAINER (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg)))), 4);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), form,
+ GDAUI_BASIC_FORM (form)->priv->can_expand,
+ GDAUI_BASIC_FORM (form)->priv->can_expand, 10);
#else
gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), form,
-#endif
GDAUI_BASIC_FORM (form)->priv->can_expand,
GDAUI_BASIC_FORM (form)->priv->can_expand, 10);
+#endif
- g_signal_connect (G_OBJECT (form), "param_changed",
- G_CALLBACK (form_param_changed), dlg);
+ g_signal_connect (G_OBJECT (form), "holder-changed",
+ G_CALLBACK (form_holder_changed), dlg);
g_object_set_data (G_OBJECT (dlg), "form", form);
-
+
gtk_widget_show_all (form);
- form_param_changed (GDAUI_BASIC_FORM (form), NULL, FALSE, GTK_DIALOG (dlg));
-
+ form_holder_changed (GDAUI_BASIC_FORM (form), NULL, FALSE, GTK_DIALOG (dlg));
+
return dlg;
}
static void
-form_param_changed (GdauiBasicForm *form, GdaHolder *param, gboolean is_user_modif, GtkDialog *dlg)
+form_holder_changed (GdauiBasicForm *form, GdaHolder *param, gboolean is_user_modif, GtkDialog *dlg)
{
gboolean valid;
-
+
valid = gdaui_basic_form_is_valid (form);
-
+
gtk_dialog_set_response_sensitive (dlg, GTK_RESPONSE_ACCEPT, valid);
}
diff --git a/libgda-ui/gdaui-basic-form.h b/libgda-ui/gdaui-basic-form.h
index af07ef1..4ac6096 100644
--- a/libgda-ui/gdaui-basic-form.h
+++ b/libgda-ui/gdaui-basic-form.h
@@ -23,9 +23,6 @@
#include <gtk/gtk.h>
#include <libgda/libgda.h>
-#ifdef HAVE_LIBGLADE
-#include <glade/glade.h>
-#endif
G_BEGIN_DECLS
@@ -34,15 +31,6 @@ G_BEGIN_DECLS
#define GDAUI_BASIC_FORM_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gdaui_basic_form_get_type (), GdauiBasicFormClass)
#define GDAUI_IS_BASIC_FORM(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gdaui_basic_form_get_type ())
-typedef struct {
-#ifdef HAVE_LIBGLADE
- GladeXML *xml_object; /* one of xml_object or */
-#endif
- gchar *xml_file; /* xml_file is required */
-
- gchar *root_element; /* required */
- gchar *form_prefix; /* required */
-} GdauiFormLayoutSpec;
typedef struct _GdauiBasicForm GdauiBasicForm;
typedef struct _GdauiBasicFormClass GdauiBasicFormClass;
@@ -51,7 +39,7 @@ typedef struct _GdauiBasicFormPriv GdauiBasicFormPriv;
/* struct for the object's data */
struct _GdauiBasicForm
{
- GtkVBox object;
+ GtkVBox object;
GdauiBasicFormPriv *priv;
};
@@ -59,11 +47,11 @@ struct _GdauiBasicForm
/* struct for the object's class */
struct _GdauiBasicFormClass
{
- GtkVBoxClass parent_class;
+ GtkVBoxClass parent_class;
/* signals */
- void (*param_changed) (GdauiBasicForm *form, GdaHolder *param, gboolean is_user_modif);
- void (*activated) (GdauiBasicForm *form);
+ void (*holder_changed) (GdauiBasicForm *form, GdaHolder *holder, gboolean is_user_action);
+ void (*activated) (GdauiBasicForm *form);
};
/*
@@ -71,29 +59,23 @@ struct _GdauiBasicFormClass
*/
GType gdaui_basic_form_get_type (void) G_GNUC_CONST;
GtkWidget *gdaui_basic_form_new (GdaSet *data_set);
-GtkWidget *gdaui_basic_form_new_custom (GdaSet *data_set, const gchar *glade_file,
- const gchar *root_element, const gchar *form_prefix);
GtkWidget *gdaui_basic_form_new_in_dialog (GdaSet *data_set, GtkWindow *parent,
- const gchar *title, const gchar *header);
+ const gchar *title, const gchar *header);
GdaSet *gdaui_basic_form_get_data_set (GdauiBasicForm *form);
gboolean gdaui_basic_form_is_valid (GdauiBasicForm *form);
-gboolean gdaui_basic_form_has_been_changed (GdauiBasicForm *form);
+gboolean gdaui_basic_form_has_changed (GdauiBasicForm *form);
void gdaui_basic_form_reset (GdauiBasicForm *form);
-void gdaui_basic_form_set_current_as_orig (GdauiBasicForm *form);
-
-void gdaui_basic_form_show_entry_actions (GdauiBasicForm *form, gboolean show_actions);
-void gdaui_basic_form_entry_show (GdauiBasicForm *form,
- GdaHolder *param, gboolean show);
-void gdaui_basic_form_entry_grab_focus (GdauiBasicForm *form, GdaHolder *param);
-void gdaui_basic_form_entry_set_editable (GdauiBasicForm *form, GdaHolder *param,
- gboolean editable);
-void gdaui_basic_form_set_entries_auto_default (GdauiBasicForm *form, gboolean auto_default);
-void gdaui_basic_form_set_entries_default (GdauiBasicForm *form);
-
-GtkWidget *gdaui_basic_form_get_entry_widget (GdauiBasicForm *form, GdaHolder *param);
-GtkWidget *gdaui_basic_form_get_label_widget (GdauiBasicForm *form, GdaHolder *param);
+void gdaui_basic_form_set_as_reference (GdauiBasicForm *form);
+void gdaui_basic_form_entry_set_visible (GdauiBasicForm *form,
+ GdaHolder *holder, gboolean show);
+void gdaui_basic_form_entry_grab_focus (GdauiBasicForm *form, GdaHolder *holder);
+void gdaui_basic_form_entry_set_editable (GdauiBasicForm *form, GdaHolder *holder,
+ gboolean editable);
+void gdaui_basic_form_set_entries_to_default (GdauiBasicForm *form);
+GtkWidget *gdaui_basic_form_get_entry_widget (GdauiBasicForm *form, GdaHolder *holder);
+GtkWidget *gdaui_basic_form_get_label_widget (GdauiBasicForm *form, GdaHolder *holder);
G_END_DECLS
diff --git a/libgda-ui/gdaui-raw-form.c b/libgda-ui/gdaui-raw-form.c
index 199134b..dfb08d3 100644
--- a/libgda-ui/gdaui-raw-form.c
+++ b/libgda-ui/gdaui-raw-form.c
@@ -219,7 +219,7 @@ form_activated_cb (GdauiRawForm *form, gpointer data)
}
static void
-form_param_changed_cb (GdauiRawForm *form, gpointer data)
+form_holder_changed_cb (GdauiRawForm *form, gpointer data)
{
if (form->priv->write_mode == GDAUI_DATA_WIDGET_WRITE_ON_VALUE_CHANGE) {
gint row;
@@ -252,8 +252,8 @@ gdaui_raw_form_init (GdauiRawForm *wid)
g_signal_connect (G_OBJECT (wid), "activated",
G_CALLBACK (form_activated_cb), NULL);
- g_signal_connect (G_OBJECT (wid), "param_changed",
- G_CALLBACK (form_param_changed_cb), NULL);
+ g_signal_connect (G_OBJECT (wid), "holder-changed",
+ G_CALLBACK (form_holder_changed_cb), NULL);
/* action group */
wid->priv->actions_group = gtk_action_group_new ("Actions");
@@ -465,7 +465,7 @@ iter_validate_set_cb (GdaDataModelIter *iter, GdauiRawForm *form)
static void
iter_row_changed_cb (GdaDataModelIter *iter, gint row, GdauiRawForm *form)
{
- gdaui_basic_form_set_current_as_orig (GDAUI_BASIC_FORM (form));
+ gdaui_basic_form_set_as_reference (GDAUI_BASIC_FORM (form));
gtk_widget_set_sensitive (GTK_WIDGET (form), (row == -1) ? FALSE : TRUE);
if (row >= 0) {
@@ -544,7 +544,7 @@ gdaui_raw_form_initialize (GdauiRawForm *form, GtkWidget *layout, GHashTable *bo
* the form itself
*/
if (!layout && gda_data_proxy_is_read_only (form->priv->proxy))
- gdaui_basic_form_show_entry_actions (GDAUI_BASIC_FORM (form), FALSE);
+ g_object_set ((GObject*) form, "show-actions", FALSE, NULL);
/* data display update */
proxy_changed_cb (form->priv->proxy, form);
@@ -945,7 +945,7 @@ gdaui_raw_form_col_set_show (GdauiDataWidget *iface, gint column, gboolean shown
param = gda_data_model_iter_get_holder_for_field (form->priv->iter, column);
g_return_if_fail (param);
- gdaui_basic_form_entry_show (GDAUI_BASIC_FORM (form), param, shown);
+ gdaui_basic_form_entry_set_visible (GDAUI_BASIC_FORM (form), param, shown);
}
void
@@ -961,7 +961,7 @@ gdaui_raw_form_set_column_editable (GdauiDataWidget *iface, gint column, gboolea
/* What needs to be done:
* - create a gdaui_basic_form_set_entry_editable() function for GdauiBasicForm, and call it
* - in the GdauiDataEntry, add a GDA_VALUE_ATTR_EDITABLE property which defaults to TRUE.
- * - imtplement the gdaui_basic_form_set_entry_editable() in the same way as gdaui_basic_form_set_entries_default()
+ * - imtplement the gdaui_basic_form_set_entry_editable() in the same way as gdaui_basic_form_set_entries_to_default()
* by setting that new property
* - implement the new property in GdauiEntryWrapper and GdauiEntryCombo.
*/
@@ -977,7 +977,7 @@ gdaui_raw_form_show_column_actions (GdauiDataWidget *iface, gint column, gboolea
g_return_if_fail (form->priv);
/* REM: don't take care of the @column argument */
- gdaui_basic_form_show_entry_actions (GDAUI_BASIC_FORM (form), show_actions);
+ g_object_set ((GObject*) form, "show-actions", show_actions, NULL);
}
static GtkActionGroup *
diff --git a/libgda-ui/gdaui-server-operation.c b/libgda-ui/gdaui-server-operation.c
index 084a8c8..e44aa80 100644
--- a/libgda-ui/gdaui-server-operation.c
+++ b/libgda-ui/gdaui-server-operation.c
@@ -419,7 +419,7 @@ fill_create_widget (GdauiServerOperation *form, const gchar *path, gchar **secti
plist = info_node->plist;
plwid = gdaui_basic_form_new (plist);
- gdaui_basic_form_show_entry_actions (GDAUI_BASIC_FORM (plwid), FALSE);
+ g_object_set ((GObject*) plwid, "show-actions", FALSE, NULL);
if (section_str) {
const gchar *name;
@@ -524,7 +524,7 @@ fill_create_widget (GdauiServerOperation *form, const gchar *path, gchar **secti
plist = gda_set_new (list);
g_slist_free (list);
plwid = gdaui_basic_form_new (plist);
- gdaui_basic_form_show_entry_actions (GDAUI_BASIC_FORM (plwid), FALSE);
+ g_object_set ((GObject*) plwid, "show-actions", FALSE, NULL);
/* we don't need plist anymore */
g_object_unref (plist);
diff --git a/libgda-ui/internal/gdaui-provider-auth-editor.c b/libgda-ui/internal/gdaui-provider-auth-editor.c
index 12018e7..0bf1dfd 100644
--- a/libgda-ui/internal/gdaui-provider-auth-editor.c
+++ b/libgda-ui/internal/gdaui-provider-auth-editor.c
@@ -249,7 +249,7 @@ _gdaui_provider_auth_editor_set_provider (GdauiProviderAuthEditor *auth, const g
set = gda_set_copy (auth->priv->pinfo->auth_params);
auth->priv->auth_widget = gdaui_basic_form_new (set);
- g_signal_connect (G_OBJECT (auth->priv->auth_widget), "param-changed",
+ g_signal_connect (G_OBJECT (auth->priv->auth_widget), "holder-changed",
G_CALLBACK (auth_form_changed), auth);
g_object_unref (set);
}
diff --git a/libgda-ui/internal/gdaui-provider-spec-editor.c b/libgda-ui/internal/gdaui-provider-spec-editor.c
index 13f36c4..8076186 100644
--- a/libgda-ui/internal/gdaui-provider-spec-editor.c
+++ b/libgda-ui/internal/gdaui-provider-spec-editor.c
@@ -206,12 +206,12 @@ adapt_form_widget (GdauiProviderSpecEditor *spec)
spec->priv->type = PROVIDER_FORM;
wid = gdaui_basic_form_new (dset);
- gdaui_basic_form_show_entry_actions (GDAUI_BASIC_FORM (wid), FALSE);
+ g_object_set ((GObject*) wid, "show-actions", FALSE, NULL);
g_object_unref (dset);
spec->priv->form = wid;
update_form_contents (spec);
- g_signal_connect (G_OBJECT (wid), "param_changed",
+ g_signal_connect (G_OBJECT (wid), "holder-changed",
G_CALLBACK (dsn_form_changed), spec);
}
diff --git a/libgda-ui/libgda-ui.symbols b/libgda-ui/libgda-ui.symbols
index 917b070..6fa6bc5 100644
--- a/libgda-ui/libgda-ui.symbols
+++ b/libgda-ui/libgda-ui.symbols
@@ -6,18 +6,15 @@
gdaui_basic_form_get_data_set
gdaui_basic_form_get_entry_widget
gdaui_basic_form_get_label_widget
- gdaui_basic_form_get_paramlist
+ gdaui_basic_form_get_data_set
gdaui_basic_form_get_type
- gdaui_basic_form_has_been_changed
+ gdaui_basic_form_has_changed
gdaui_basic_form_is_valid
gdaui_basic_form_new
- gdaui_basic_form_new_custom
gdaui_basic_form_new_in_dialog
gdaui_basic_form_reset
- gdaui_basic_form_set_current_as_orig
- gdaui_basic_form_set_entries_auto_default
- gdaui_basic_form_set_entries_default
- gdaui_basic_form_show_entry_actions
+ gdaui_basic_form_set_as_reference
+ gdaui_basic_form_set_entries_to_default
gdaui_cloud_create_filter_widget
gdaui_cloud_filter
gdaui_cloud_get_selection
diff --git a/testing/gdaui-test-data-entries.c b/testing/gdaui-test-data-entries.c
index 6318e8f..1684b12 100644
--- a/testing/gdaui-test-data-entries.c
+++ b/testing/gdaui-test-data-entries.c
@@ -374,7 +374,7 @@ plugin_hash_foreach_func (const gchar *plugin_name, GdauiPlugin *plugin, GtkWidg
static void create_plugin_nb (GtkWidget *vbox, GdauiPlugin *plugin);
-static void options_form_param_changed_cb (GdauiBasicForm *form, GdaHolder *param, gboolean user_modif,
+static void options_form_holder_changed_cb (GdauiBasicForm *form, GdaHolder *param, gboolean user_modif,
GtkWidget *table);
static GtkWidget *
build_test_for_plugin_struct (GdauiPlugin *plugin)
@@ -448,8 +448,8 @@ build_test_for_plugin_struct (GdauiPlugin *plugin)
gtk_table_attach (GTK_TABLE (table), form, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_widget_show (form);
g_object_set_data (G_OBJECT (table), "options", form);
- g_signal_connect (G_OBJECT (form), "param_changed",
- G_CALLBACK (options_form_param_changed_cb), table);
+ g_signal_connect (G_OBJECT (form), "holder-changed",
+ G_CALLBACK (options_form_holder_changed_cb), table);
}
}
else {
@@ -625,7 +625,7 @@ build_test_widget (TestWidgetData *tdata)
}
static void
-options_form_param_changed_cb (GdauiBasicForm *form, GdaHolder *param, gboolean user_modif, GtkWidget *table)
+options_form_holder_changed_cb (GdauiBasicForm *form, GdaHolder *param, gboolean user_modif, GtkWidget *table)
{
GtkWidget *nb;
GdauiPlugin *plugin;
diff --git a/tools/browser/auth-dialog.c b/tools/browser/auth-dialog.c
index 1e7eee0..4034d87 100644
--- a/tools/browser/auth-dialog.c
+++ b/tools/browser/auth-dialog.c
@@ -396,7 +396,7 @@ auth_dialog_add_cnc_string (AuthDialog *dialog, const gchar *cnc_string, GError
set = gda_set_copy (pinfo->auth_params);
ad->auth_widget = gdaui_basic_form_new (set);
- /*g_signal_connect (G_OBJECT (ad->auth_widget), "param-changed",
+ /*g_signal_connect (G_OBJECT (ad->auth_widget), "holder-changed",
G_CALLBACK (auth_form_changed), dialog);*/
g_object_unref (set);
diff --git a/tools/browser/browser-connections-list.c b/tools/browser/browser-connections-list.c
index 477fe1b..a0fbf48 100644
--- a/tools/browser/browser-connections-list.c
+++ b/tools/browser/browser-connections-list.c
@@ -226,7 +226,7 @@ selection_changed_cb (GtkTreeSelection *select, BrowserConnectionsList *clist)
/* create form */
GtkWidget *wid;
wid = gdaui_basic_form_new (dset);
- gdaui_basic_form_show_entry_actions (GDAUI_BASIC_FORM (wid), FALSE);
+ g_object_set ((GObject*) wid, "show-actions", FALSE, NULL);
gdaui_basic_form_entry_set_editable (GDAUI_BASIC_FORM (wid), NULL, FALSE);
gtk_table_attach_defaults (clist->priv->layout_table, wid, 1, 2, 2, 3);
gtk_widget_show (wid);
diff --git a/tools/browser/query-exec/query-console.c b/tools/browser/query-exec/query-console.c
index 2411778..f69c95b 100644
--- a/tools/browser/query-exec/query-console.c
+++ b/tools/browser/query-exec/query-console.c
@@ -623,8 +623,8 @@ compute_params (QueryConsole *tconsole)
if (tconsole->priv->params) {
show_variables = TRUE;
tconsole->priv->params_form = gdaui_basic_form_new (tconsole->priv->params);
- gdaui_basic_form_show_entry_actions (GDAUI_BASIC_FORM (tconsole->priv->params_form),
- TRUE);
+ g_object_set ((GObject*) tconsole->priv->params_form,
+ "show-actions", TRUE, NULL);
}
else {
tconsole->priv->params_form = gtk_label_new ("");
@@ -890,9 +890,9 @@ sql_execute_clicked_cb (GtkButton *button, QueryConsole *tconsole)
}
cont = g_object_get_data (G_OBJECT (tconsole->priv->params_popup), "cont");
- form = gdaui_basic_form_new (tconsole->priv->params);
- gdaui_basic_form_show_entry_actions (GDAUI_BASIC_FORM (form), TRUE);
- g_signal_connect (form, "param-changed",
+ form = gdaui_basic_form_new (tconsole->priv->params);
+ g_object_set ((GObject*) form, "show-actions", TRUE, NULL);
+ g_signal_connect (form, "holder-changed",
G_CALLBACK (params_form_changed_cb), tconsole);
gtk_box_pack_start (GTK_BOX (cont), form, TRUE, TRUE, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]