[libgda] GdauiBasicForm rework
- From: Vivien Malerba <vivien src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgda] GdauiBasicForm rework
- Date: Tue, 5 Jan 2010 18:01:25 +0000 (UTC)
commit b10b9715f29f85f1f6f8aa982ff0be9fbaa608c3
Author: Vivien Malerba <malerba gnome-db org>
Date: Tue Jan 5 19:00:59 2010 +0100
GdauiBasicForm rework
* now has a much improved internal structure
* re-wrote the custom layou code to use a more lisible XML syntax
* improved examples
control-center/dsn-config.c | 6 +-
control-center/gdaui-dsn-assistant.c | 2 +-
control-center/provider-config.c | 2 +-
doc/C/libgda-ui-sections.txt | 5 +-
doc/C/tmpl/gdaui-basic-form.sgml | 85 +-
doc/C/tmpl/gdaui-data-entry.sgml | 9 +
libgda-ui/Makefile.am | 2 +-
.../data-entries/gdaui-data-cell-renderer-bin.c | 12 +-
.../gdaui-data-cell-renderer-boolean.c | 8 +-
.../data-entries/gdaui-data-cell-renderer-combo.c | 30 +-
.../data-entries/gdaui-data-cell-renderer-info.c | 6 +-
.../gdaui-data-cell-renderer-textual.c | 18 +-
libgda-ui/data-entries/gdaui-entry-combo.c | 10 +-
libgda-ui/data-entries/gdaui-entry-common-time.c | 24 +-
libgda-ui/data-entries/gdaui-entry-number.c | 8 +-
libgda-ui/data-entries/gdaui-entry-shell.c | 67 +-
libgda-ui/data-entries/gdaui-entry-string.c | 6 +-
libgda-ui/data-entries/gdaui-entry-wrapper.c | 166 +-
libgda-ui/data-entries/gdaui-numeric-entry.c | 2 +-
libgda-ui/data-entries/plugins/common-pict.c | 64 +-
.../plugins/gdaui-data-cell-renderer-cgrid.c | 6 +-
.../plugins/gdaui-data-cell-renderer-password.c | 18 +-
.../plugins/gdaui-data-cell-renderer-pict.c | 8 +-
libgda-ui/data-entries/plugins/gdaui-entry-cgrid.c | 8 +-
libgda-ui/data-entries/plugins/gdaui-entry-pict.c | 58 +-
libgda-ui/data-entries/plugins/gdaui-entry-text.c | 13 +
libgda-ui/data-layout.dtd | 194 --
libgda-ui/demos/Makefile.am | 5 +-
libgda-ui/demos/basic_form.c | 83 +
libgda-ui/demos/custom_layout.xml | 55 +
libgda-ui/demos/demo_db.db | Bin 2027520 -> 2144256 bytes
libgda-ui/demos/example_automatic_layout.xml | 492 -----
libgda-ui/demos/form_data_layout.c | 55 +-
libgda-ui/demos/grid_data_layout.c | 13 +-
libgda-ui/demos/linked_grid_form.c | 4 +-
libgda-ui/demos/main.c | 2 +-
libgda-ui/gdaui-basic-form.c | 2295 ++++++++------------
libgda-ui/gdaui-basic-form.h | 5 +-
libgda-ui/gdaui-combo.c | 6 +-
libgda-ui/gdaui-data-entry.c | 34 +-
libgda-ui/gdaui-data-entry.h | 3 +
libgda-ui/gdaui-data-filter.c | 6 +-
libgda-ui/gdaui-data-proxy-info.c | 2 +-
libgda-ui/gdaui-data-store.c | 8 +-
libgda-ui/gdaui-layout.dtd | 28 +
libgda-ui/gdaui-raw-form.c | 11 +-
libgda-ui/gdaui-raw-grid.c | 122 +-
libgda-ui/gdaui-server-operation.c | 16 +-
libgda-ui/internal/popup-container.c | 8 +-
libgda/gda-value.c | 10 +-
testing/gdaui-test-data-entries.c | 4 +-
tools/browser/browser-connections-list.c | 2 +-
tools/browser/browser-window.c | 2 +-
tools/browser/canvas-example.c | 2 +-
54 files changed, 1623 insertions(+), 2487 deletions(-)
---
diff --git a/control-center/dsn-config.c b/control-center/dsn-config.c
index 3b75ed2..0cc7570 100644
--- a/control-center/dsn-config.c
+++ b/control-center/dsn-config.c
@@ -157,14 +157,14 @@ dsn_config_new (void)
gdaui_data_proxy_column_set_editable (GDAUI_DATA_PROXY (priv->dsn_list), 0, FALSE);
gdaui_data_selector_set_column_visible (GDAUI_DATA_SELECTOR (priv->dsn_list), 3, FALSE);
gdaui_data_selector_set_column_visible (GDAUI_DATA_SELECTOR (priv->dsn_list), 4, FALSE);
- g_object_set (priv->dsn_list, "info_cell_visible", FALSE, NULL);
+ g_object_set (priv->dsn_list, "info-cell-visible", FALSE, NULL);
gtk_container_add (GTK_CONTAINER (sw), priv->dsn_list);
gtk_widget_show_all (sw);
- g_signal_connect (priv->dsn_list, "double_clicked",
+ g_signal_connect (priv->dsn_list, "double-clicked",
G_CALLBACK (list_double_clicked_cb), dsn);
- g_signal_connect (priv->dsn_list, "populate_popup",
+ g_signal_connect (priv->dsn_list, "populate-popup",
G_CALLBACK (list_popup_cb), dsn);
/* add tip */
diff --git a/control-center/gdaui-dsn-assistant.c b/control-center/gdaui-dsn-assistant.c
index b532eea..5df1d03 100644
--- a/control-center/gdaui-dsn-assistant.c
+++ b/control-center/gdaui-dsn-assistant.c
@@ -254,7 +254,7 @@ provider_changed_cb (GtkWidget *combo, GdauiDsnAssistant *assistant)
op = get_specs_database_creation (assistant);
if (op) {
assistant->priv->newdb_params = g_object_new (GDAUI_TYPE_SERVER_OPERATION,
- "hide-single-header", TRUE, "server_operation", op, NULL);
+ "hide-single-header", TRUE, "server-operation", op, NULL);
gtk_widget_show (assistant->priv->newdb_params);
gtk_container_add (GTK_CONTAINER (assistant->priv->newdb_box),
assistant->priv->newdb_params);
diff --git a/control-center/provider-config.c b/control-center/provider-config.c
index faf66a7..b577a69 100644
--- a/control-center/provider-config.c
+++ b/control-center/provider-config.c
@@ -96,7 +96,7 @@ provider_config_new (void)
g_object_unref (model);
gdaui_data_proxy_column_set_editable (GDAUI_DATA_PROXY (priv->provider_list), 0, FALSE);
gdaui_data_selector_set_column_visible (GDAUI_DATA_SELECTOR (priv->provider_list), 2, FALSE);
- g_object_set (G_OBJECT (priv->provider_list), "info_cell_visible", FALSE, NULL);
+ g_object_set (G_OBJECT (priv->provider_list), "info-cell-visible", FALSE, NULL);
gtk_container_add (GTK_CONTAINER (sw), priv->provider_list);
gtk_widget_show_all (sw);
diff --git a/doc/C/libgda-ui-sections.txt b/doc/C/libgda-ui-sections.txt
index 113db04..4eb04ca 100644
--- a/doc/C/libgda-ui-sections.txt
+++ b/doc/C/libgda-ui-sections.txt
@@ -30,7 +30,9 @@ gdaui_basic_form_entry_set_editable
gdaui_basic_form_set_entries_to_default
gdaui_basic_form_get_entry_widget
gdaui_basic_form_get_label_widget
-gdaui_basic_form_set_data_layout_from_file
+<SUBSECTION>
+gdaui_basic_form_set_layout_from_file
+gdaui_basic_form_get_place_holder
<SUBSECTION Standard>
GDAUI_BASIC_FORM
GDAUI_BASIC_FORM_CLASS
@@ -76,6 +78,7 @@ gdaui_data_entry_get_attributes
gdaui_data_entry_get_handler
gdaui_data_entry_expand_in_layout
gdaui_data_entry_set_editable
+gdaui_data_entry_get_editable
gdaui_data_entry_grab_focus
<SUBSECTION Standard>
GDAUI_DATA_ENTRY
diff --git a/doc/C/tmpl/gdaui-basic-form.sgml b/doc/C/tmpl/gdaui-basic-form.sgml
index de4dc4a..66c68d8 100644
--- a/doc/C/tmpl/gdaui-basic-form.sgml
+++ b/doc/C/tmpl/gdaui-basic-form.sgml
@@ -30,6 +30,71 @@ g_object_unref (params);
g_object_unref (stmt);
</programlisting>
</para>
+<para>
+ The default layout within a #GdauiBasicForm is a vertical column: all the data entry widgets are aligned
+ in a single column. This behaviour can be changed using the gdaui_basic_form_set_layout_from_file() method or
+ setting the <link linkend="GdauiBasicForm--xml-layout">xml-layout</link> property.
+</para>
+
+<refsect2 id="GdauiBasicFormXMLLayout"><title>XML Layout Definitions</title>
+<para>
+The #GdauiBasicForm class parses textual descriptions of XML layout which
+which can be described by the following DTD.
+</para>
+<para>
+<programlisting><![CDATA[
+<!ELEMENT gdaui_layouts (gdaui_form | gdaui_grid)>
+
+<!ELEMENT gdaui_form (gdaui_section | gdaui_column | gdaui_notebook)*>
+<!ATTLIST gdaui_form
+ name CDATA #REQUIRED
+ container (columns|rows|hpaned|vpaned) #IMPLIED>
+
+<!ELEMENT gdaui_section (gdaui_section | gdaui_column | gdaui_notebook)*>
+<!ATTLIST gdaui_section
+ title CDATA #IMPLIED >
+
+<!ELEMENT gdaui_notebook (gdaui_section | gdaui_column | gdaui_notebook)*>
+
+<!ELEMENT gdaui_column (gdaui_entry | gdaui_placeholder)*>
+
+<!ELEMENT gdaui_entry EMPTY>
+<!ATTLIST gdaui_entry
+ name CDATA #REQUIRED
+ editable (true|false) #IMPLIED
+ label CDATA #IMPLIED
+ plugin CDATA #IMPLIED>
+
+<!ELEMENT gdaui_placeholder EMPTY>
+<!ATTLIST gdaui_placeholder
+ id CDATA #REQUIRED
+ label CDATA #IMPLIED>
+]]></programlisting>
+</para>
+<example>
+ <title>A GdauiBasicForm layout example</title>
+ <programlisting><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<gdaui_layouts>
+ <gdaui_form name="customers" container="hpaned">
+ <gdaui_section title="Summary">
+ <gdaui_column>
+ <gdaui_entry name="id" editable="no"/>
+ <gdaui_entry name="name"/>
+ <gdaui_entry name="comments" plugin="text"/>
+ <gdaui_entry name="total_orders" label="Total ordered" plugin="number:NB_DECIMALS=2;CURRENCY=â?¬"/>
+ </gdaui_column>
+ </gdaui_section>
+ <gdaui_section title="Photo">
+ <gdaui_column>
+ <gdaui_entry name="photo" plugin="picture"/>
+ </gdaui_column>
+ </gdaui_section>
+ </gdaui_form>
+</gdaui_layouts>
+]]></programlisting>
+</example>
+</refsect2>
<!-- ##### SECTION See_Also ##### -->
<para>
@@ -73,11 +138,6 @@ g_object_unref (stmt);
</para>
-<!-- ##### ARG GdauiBasicForm:data-layout ##### -->
-<para>
-
-</para>
-
<!-- ##### ARG GdauiBasicForm:entries-auto-default ##### -->
<para>
@@ -98,6 +158,11 @@ g_object_unref (stmt);
</para>
+<!-- ##### ARG GdauiBasicForm:xml-layout ##### -->
+<para>
+
+</para>
+
<!-- ##### FUNCTION gdaui_basic_form_new ##### -->
<para>
@@ -219,13 +284,3 @@ g_object_unref (stmt);
@Returns:
-<!-- ##### FUNCTION gdaui_basic_form_set_data_layout_from_file ##### -->
-<para>
-
-</para>
-
- form:
- file_name:
- parent_table:
-
-
diff --git a/doc/C/tmpl/gdaui-data-entry.sgml b/doc/C/tmpl/gdaui-data-entry.sgml
index b37266b..7c1a210 100644
--- a/doc/C/tmpl/gdaui-data-entry.sgml
+++ b/doc/C/tmpl/gdaui-data-entry.sgml
@@ -199,6 +199,15 @@ Data entry widget
@editable:
+<!-- ##### FUNCTION gdaui_data_entry_get_editable ##### -->
+<para>
+
+</para>
+
+ de:
+ Returns:
+
+
<!-- ##### FUNCTION gdaui_data_entry_grab_focus ##### -->
<para>
diff --git a/libgda-ui/Makefile.am b/libgda-ui/Makefile.am
index 93dc834..b487a21 100644
--- a/libgda-ui/Makefile.am
+++ b/libgda-ui/Makefile.am
@@ -143,7 +143,7 @@ CLEANFILES = $(libgda_ui_built_headers) $(libgda_ui_built_cfiles) \
libgda-ui.def \
libgda-ui-$(GDA_ABI_VERSION).lib
-DTD_FILES = data-layout.dtd
+DTD_FILES = gdaui-layout.dtd
dtddir=$(datadir)/libgda-$(GDA_ABI_MAJOR_VERSION).$(GDA_ABI_MINOR_VERSION)/dtd
dtd_DATA=$(DTD_FILES)
diff --git a/libgda-ui/data-entries/gdaui-data-cell-renderer-bin.c b/libgda-ui/data-entries/gdaui-data-cell-renderer-bin.c
index 7177fa7..3e469e8 100644
--- a/libgda-ui/data-entries/gdaui-data-cell-renderer-bin.c
+++ b/libgda-ui/data-entries/gdaui-data-cell-renderer-bin.c
@@ -161,7 +161,7 @@ gdaui_data_cell_renderer_bin_class_init (GdauiDataCellRendererBinClass *class)
g_object_class_install_property (object_class,
PROP_VALUE_ATTRIBUTES,
- g_param_spec_flags ("value_attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
+ g_param_spec_flags ("value-attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
GDA_VALUE_ATTR_NONE, G_PARAM_READWRITE));
g_object_class_install_property (object_class,
@@ -175,11 +175,11 @@ gdaui_data_cell_renderer_bin_class_init (GdauiDataCellRendererBinClass *class)
g_object_class_install_property (object_class,
PROP_TO_BE_DELETED,
- g_param_spec_boolean ("to_be_deleted", NULL, NULL, FALSE,
+ g_param_spec_boolean ("to-be-deleted", NULL, NULL, FALSE,
G_PARAM_WRITABLE));
g_object_class_install_property(object_class,
PROP_DATA_HANDLER,
- g_param_spec_object("data_handler", NULL, NULL, GDA_TYPE_DATA_HANDLER,
+ g_param_spec_object("data-handler", NULL, NULL, GDA_TYPE_DATA_HANDLER,
G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(object_class,
PROP_TYPE,
@@ -328,7 +328,7 @@ gdaui_data_cell_renderer_bin_new (GdaDataHandler *dh, GType type)
g_return_val_if_fail (dh && GDA_IS_DATA_HANDLER (dh), NULL);
obj = g_object_new (GDAUI_TYPE_DATA_CELL_RENDERER_BIN, "type", type,
- "data_handler", dh,
+ "data-handler", dh,
"editable", FALSE, NULL);
return GTK_CELL_RENDERER (obj);
@@ -384,7 +384,7 @@ static void
bin_data_changed_cb (GdauiDataCellRendererBin *bincell, GValue *value)
{
g_signal_emit (G_OBJECT (bincell), bin_cell_signals[CHANGED], 0,
- g_object_get_data (G_OBJECT (bincell), "last_path"), value);
+ g_object_get_data (G_OBJECT (bincell), "last-path"), value);
gda_value_free (value);
}
@@ -439,7 +439,7 @@ gdaui_data_cell_renderer_bin_activate (GtkCellRenderer *cell,
bincell = GDAUI_DATA_CELL_RENDERER_BIN (cell);
- g_object_set_data_full (G_OBJECT (bincell), "last_path", g_strdup (path), g_free);
+ g_object_set_data_full (G_OBJECT (bincell), "last-path", g_strdup (path), g_free);
if (!bincell->priv->menu.popup) {
common_bin_create_menu (&(bincell->priv->menu), popup_position, bincell->priv->type,
(BinCallback) bin_data_changed_cb, bincell);
diff --git a/libgda-ui/data-entries/gdaui-data-cell-renderer-boolean.c b/libgda-ui/data-entries/gdaui-data-cell-renderer-boolean.c
index efefd38..fee2260 100644
--- a/libgda-ui/data-entries/gdaui-data-cell-renderer-boolean.c
+++ b/libgda-ui/data-entries/gdaui-data-cell-renderer-boolean.c
@@ -158,7 +158,7 @@ gdaui_data_cell_renderer_boolean_class_init (GdauiDataCellRendererBooleanClass *
g_object_class_install_property (object_class,
PROP_VALUE_ATTRIBUTES,
- g_param_spec_flags ("value_attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
+ g_param_spec_flags ("value-attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
GDA_VALUE_ATTR_NONE, G_PARAM_READWRITE));
g_object_class_install_property (object_class,
@@ -172,11 +172,11 @@ gdaui_data_cell_renderer_boolean_class_init (GdauiDataCellRendererBooleanClass *
g_object_class_install_property (object_class,
PROP_TO_BE_DELETED,
- g_param_spec_boolean ("to_be_deleted", NULL, NULL, FALSE,
+ g_param_spec_boolean ("to-be-deleted", NULL, NULL, FALSE,
G_PARAM_WRITABLE));
g_object_class_install_property(object_class,
PROP_DATA_HANDLER,
- g_param_spec_object("data_handler", NULL, NULL, GDA_TYPE_DATA_HANDLER,
+ g_param_spec_object("data-handler", NULL, NULL, GDA_TYPE_DATA_HANDLER,
G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(object_class,
PROP_TYPE,
@@ -334,7 +334,7 @@ gdaui_data_cell_renderer_boolean_new (GdaDataHandler *dh, GType type)
g_return_val_if_fail (dh && GDA_IS_DATA_HANDLER (dh), NULL);
obj = g_object_new (GDAUI_TYPE_DATA_CELL_RENDERER_BOOLEAN, "type", type,
- "data_handler", dh, NULL);
+ "data-handler", dh, NULL);
return GTK_CELL_RENDERER (obj);
}
diff --git a/libgda-ui/data-entries/gdaui-data-cell-renderer-combo.c b/libgda-ui/data-entries/gdaui-data-cell-renderer-combo.c
index 6fc6e0d..3698e7d 100644
--- a/libgda-ui/data-entries/gdaui-data-cell-renderer-combo.c
+++ b/libgda-ui/data-entries/gdaui-data-cell-renderer-combo.c
@@ -162,36 +162,36 @@ gdaui_data_cell_renderer_combo_class_init (GdauiDataCellRendererComboClass *clas
g_object_class_install_property (object_class,
PROP_VALUES_DISPLAY,
- g_param_spec_pointer ("values_display",
+ g_param_spec_pointer ("values-display",
_("Values"),
_("GList of GValue to render, not limited to PK fields "),
G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_VALUE_ATTRIBUTES,
- g_param_spec_flags ("value_attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
+ g_param_spec_flags ("value-attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
GDA_VALUE_ATTR_NONE, G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_TO_BE_DELETED,
- g_param_spec_boolean ("to_be_deleted", NULL, NULL, FALSE,
+ g_param_spec_boolean ("to-be-deleted", NULL, NULL, FALSE,
G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_SHOW_EXPANDER,
- g_param_spec_boolean ("show_expander", NULL, NULL, FALSE,
+ g_param_spec_boolean ("show-expander", NULL, NULL, FALSE,
G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_SET_DEFAULT_IF_INVALID,
- g_param_spec_boolean ("set_default_if_invalid", NULL, NULL, FALSE,
+ g_param_spec_boolean ("set-default-if-invalid", NULL, NULL, FALSE,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property (object_class, PROP_PARAMLIST,
- g_param_spec_object ("param_list", NULL, NULL, GDAUI_TYPE_SET,
+ g_param_spec_object ("data-set", NULL, NULL, GDAUI_TYPE_SET,
(G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE)));
/* Ideally, GdaSetSource would be a boxed type, but it is not yet, so we use g_param_spec_pointer(). */
g_object_class_install_property (object_class, PROP_PARAMLISTSOURCE,
- g_param_spec_pointer ("param_list_source", NULL, NULL,
+ g_param_spec_pointer ("data-set-source", NULL, NULL,
(G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE)));
text_cell_renderer_combo_signals [CHANGED] =
@@ -350,7 +350,7 @@ gdaui_data_cell_renderer_combo_set_property (GObject *object,
else
g_object_set (G_OBJECT (object), "text", "", NULL);
- g_object_notify (object, "values_display");
+ g_object_notify (object, "values-display");
break;
case PROP_VALUE_ATTRIBUTES:
datacell->priv->attributes = g_value_get_flags (value);
@@ -441,8 +441,8 @@ gdaui_data_cell_renderer_combo_new (GdauiSet *paramlist, GdauiSetSource *source)
g_return_val_if_fail (source, NULL);
g_return_val_if_fail (g_slist_find (paramlist->sources_list, source), NULL);
- obj = g_object_new (GDAUI_TYPE_DATA_CELL_RENDERER_COMBO, "param_list", paramlist,
- "param_list_source", source, NULL);
+ obj = g_object_new (GDAUI_TYPE_DATA_CELL_RENDERER_COMBO, "data-set", paramlist,
+ "data-set-source", source, NULL);
return GTK_CELL_RENDERER (obj);
}
@@ -468,7 +468,7 @@ gdaui_data_cell_renderer_combo_get_size (GtkCellRenderer *cell,
guint xpad, ypad;
g_object_get ((GObject*) cell, "xpad", &xpad, "ypad", &ypad, NULL);
gint expander_size;
- gtk_widget_style_get (widget, "expander_size", &expander_size, NULL);
+ gtk_widget_style_get (widget, "expander-size", &expander_size, NULL);
calc_width = (gint) xpad * 2 + expander_size;
calc_height = (gint) ypad * 2 + expander_size;
}
@@ -520,7 +520,7 @@ gdaui_data_cell_renderer_combo_render (GtkCellRenderer *cell,
GtkStyle *style;
guint xpad, ypad;
- gtk_widget_style_get (widget, "expander_size", &expander_size, NULL);
+ gtk_widget_style_get (widget, "expander-size", &expander_size, NULL);
g_object_get ((GObject*) widget, "style", &style, NULL);
g_object_get ((GObject*) cell, "xpad", &xpad, "ypad", &ypad, NULL);
@@ -579,7 +579,7 @@ gdaui_data_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
datacell->priv->source->shown_n_cols,
datacell->priv->source->shown_cols_index);
- g_object_set (combo, "has_frame", FALSE, NULL);
+ g_object_set (combo, "has-frame", FALSE, NULL);
g_object_set_data_full (G_OBJECT (combo),
GDAUI_DATA_CELL_RENDERER_COMBO_PATH,
g_strdup (path), g_free);
@@ -587,9 +587,9 @@ gdaui_data_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
(datacell->priv->attributes & GDA_VALUE_ATTR_CAN_BE_NULL) ? TRUE : FALSE);
gtk_widget_show (combo);
- g_signal_connect (GTK_CELL_EDITABLE (combo), "editing_done",
+ g_signal_connect (GTK_CELL_EDITABLE (combo), "editing-done",
G_CALLBACK (gdaui_data_cell_renderer_combo_editing_done), datacell);
- datacell->priv->focus_out_id = g_signal_connect (combo, "focus_out_event",
+ datacell->priv->focus_out_id = g_signal_connect (combo, "focus-out-event",
G_CALLBACK (gdaui_data_cell_renderer_combo_focus_out_event),
datacell);
diff --git a/libgda-ui/data-entries/gdaui-data-cell-renderer-info.c b/libgda-ui/data-entries/gdaui-data-cell-renderer-info.c
index 8a16391..a7008be 100644
--- a/libgda-ui/data-entries/gdaui-data-cell-renderer-info.c
+++ b/libgda-ui/data-entries/gdaui-data-cell-renderer-info.c
@@ -151,7 +151,7 @@ gdaui_data_cell_renderer_info_class_init (GdauiDataCellRendererInfoClass *class)
g_object_class_install_property (object_class,
PROP_VALUE_ATTRIBUTES,
- g_param_spec_flags ("value_attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
+ g_param_spec_flags ("value-attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
GDA_VALUE_ATTR_NONE, G_PARAM_READWRITE));
g_object_class_install_property (object_class,
@@ -162,7 +162,7 @@ gdaui_data_cell_renderer_info_class_init (GdauiDataCellRendererInfoClass *class)
TRUE,G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_TO_BE_DELETED,
- g_param_spec_boolean ("to_be_deleted", NULL, NULL, FALSE,
+ g_param_spec_boolean ("to-be-deleted", NULL, NULL, FALSE,
G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
@@ -180,7 +180,7 @@ gdaui_data_cell_renderer_info_class_init (GdauiDataCellRendererInfoClass *class)
g_param_spec_pointer ("group", NULL, NULL,
G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
info_cell_signals[STATUS_CHANGED] =
- g_signal_new ("status_changed",
+ g_signal_new ("status-changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdauiDataCellRendererInfoClass, status_changed),
diff --git a/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c b/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
index 0a8ade3..52cf28e 100644
--- a/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
+++ b/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
@@ -110,14 +110,14 @@ typedef struct
/* text renderer */
gulong focus_out_id;
} GdauiDataCellRendererTextualInfo;
-#define GDAUI_DATA_CELL_RENDERER_TEXTUAL_INFO_KEY "gdaui_data_cell_renderer_textual_info_key"
+#define GDAUI_DATA_CELL_RENDERER_TEXTUAL_INFO_KEY "__info_key"
static GObjectClass *parent_class = NULL;
static guint text_cell_renderer_textual_signals [LAST_SIGNAL];
-#define GDAUI_DATA_CELL_RENDERER_TEXTUAL_PATH "gdaui_data_cell_renderer_textual_path"
+#define GDAUI_DATA_CELL_RENDERER_TEXTUAL_PATH "__path"
GType
gdaui_data_cell_renderer_textual_get_type (void)
@@ -188,16 +188,16 @@ gdaui_data_cell_renderer_textual_class_init (GdauiDataCellRendererTextualClass *
g_object_class_install_property (object_class,
PROP_VALUE_ATTRIBUTES,
- g_param_spec_flags ("value_attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
+ g_param_spec_flags ("value-attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
GDA_VALUE_ATTR_NONE, G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_TO_BE_DELETED,
- g_param_spec_boolean ("to_be_deleted", NULL, NULL, FALSE,
+ g_param_spec_boolean ("to-be-deleted", NULL, NULL, FALSE,
G_PARAM_WRITABLE));
g_object_class_install_property(object_class,
PROP_DATA_HANDLER,
- g_param_spec_object("data_handler", NULL, NULL, GDA_TYPE_DATA_HANDLER,
+ g_param_spec_object("data-handler", NULL, NULL, GDA_TYPE_DATA_HANDLER,
G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(object_class,
PROP_TYPE,
@@ -567,7 +567,7 @@ gdaui_data_cell_renderer_textual_new (GdaDataHandler *dh, GType type, const gcha
g_return_val_if_fail (!dh || GDA_IS_DATA_HANDLER (dh), NULL);
obj = g_object_new (GDAUI_TYPE_DATA_CELL_RENDERER_TEXTUAL,
- "type", type, "data_handler", dh,
+ "type", type, "data-handler", dh,
"options", options, NULL);
return GTK_CELL_RENDERER (obj);
@@ -695,7 +695,7 @@ gdaui_data_cell_renderer_textual_start_editing (GtkCellRenderer *cell,
else
entry = gdaui_entry_string_new (datacell->priv->dh, datacell->priv->type, datacell->priv->options);
- g_object_set (G_OBJECT (entry), "is_cell_renderer", TRUE, "actions", FALSE, NULL);
+ g_object_set (G_OBJECT (entry), "is-cell-renderer", TRUE, "actions", FALSE, NULL);
if (OPTIMIZE){
GValue *orig;
@@ -713,9 +713,9 @@ gdaui_data_cell_renderer_textual_start_editing (GtkCellRenderer *cell,
g_object_set_data_full (G_OBJECT (entry), GDAUI_DATA_CELL_RENDERER_TEXTUAL_PATH, g_strdup (path), g_free);
g_object_set_data_full (G_OBJECT (cell), GDAUI_DATA_CELL_RENDERER_TEXTUAL_INFO_KEY, info, g_free);
- g_signal_connect (entry, "editing_done",
+ g_signal_connect (entry, "editing-done",
G_CALLBACK (gdaui_data_cell_renderer_textual_editing_done), datacell);
- info->focus_out_id = g_signal_connect (entry, "focus_out_event",
+ info->focus_out_id = g_signal_connect (entry, "focus-out-event",
G_CALLBACK (gdaui_data_cell_renderer_textual_focus_out_event),
datacell);
gtk_widget_show (entry);
diff --git a/libgda-ui/data-entries/gdaui-entry-combo.c b/libgda-ui/data-entries/gdaui-entry-combo.c
index 451ba64..6825e50 100644
--- a/libgda-ui/data-entries/gdaui-entry-combo.c
+++ b/libgda-ui/data-entries/gdaui-entry-combo.c
@@ -157,7 +157,7 @@ gdaui_entry_combo_class_init (GdauiEntryComboClass *class)
object_class->set_property = gdaui_entry_combo_set_property;
object_class->get_property = gdaui_entry_combo_get_property;
g_object_class_install_property (object_class, PROP_SET_DEFAULT_IF_INVALID,
- g_param_spec_boolean ("set_default_if_invalid", NULL, NULL, FALSE,
+ g_param_spec_boolean ("set-default-if-invalid", NULL, NULL, FALSE,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
/* RC setting */
@@ -188,7 +188,7 @@ gdaui_entry_combo_emit_signal (GdauiEntryCombo *combo)
#ifdef debug_signal
g_print (">> 'CONTENTS_MODIFIED' from %s\n", __FUNCTION__);
#endif
- g_signal_emit_by_name (G_OBJECT (combo), "contents_modified");
+ g_signal_emit_by_name (G_OBJECT (combo), "contents-modified");
#ifdef debug_signal
g_print ("<< 'CONTENTS_MODIFIED' from %s\n", __FUNCTION__);
#endif
@@ -419,7 +419,7 @@ combo_contents_changed_cb (GdauiCombo *entry, GdauiEntryCombo *combo)
list = g_slist_next (list);
}
- g_signal_emit_by_name (G_OBJECT (combo), "status_changed");
+ g_signal_emit_by_name (G_OBJECT (combo), "status-changed");
gdaui_entry_combo_emit_signal (combo);
}
}
@@ -513,7 +513,7 @@ gdaui_entry_combo_set_values (GdauiEntryCombo *combo, GSList *values)
}
combo->priv->data_valid = !err;
- g_signal_emit_by_name (G_OBJECT (combo), "status_changed");
+ g_signal_emit_by_name (G_OBJECT (combo), "status-changed");
if (!err)
/* notify the status and contents changed */
@@ -913,7 +913,7 @@ gdaui_entry_combo_set_attributes (GdauiDataEntry *iface, guint attrs, guint mask
if (mask & GDA_VALUE_ATTR_HAS_VALUE_ORIG)
g_warning ("Having an original value is not a write attribute on GdauiDataEntry!");
- g_signal_emit_by_name (G_OBJECT (combo), "status_changed");
+ g_signal_emit_by_name (G_OBJECT (combo), "status-changed");
}
static GdaValueAttribute
diff --git a/libgda-ui/data-entries/gdaui-entry-common-time.c b/libgda-ui/data-entries/gdaui-entry-common-time.c
index 988ce2d..560391f 100644
--- a/libgda-ui/data-entries/gdaui-entry-common-time.c
+++ b/libgda-ui/data-entries/gdaui-entry-common-time.c
@@ -600,11 +600,11 @@ create_entry_date (GdauiEntryCommonTime *mgtim)
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_events (window, gtk_widget_get_events (window) | GDK_KEY_PRESS_MASK);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- g_signal_connect (G_OBJECT (window), "delete_event",
+ g_signal_connect (G_OBJECT (window), "delete-event",
G_CALLBACK (date_delete_popup), mgtim);
- g_signal_connect (G_OBJECT (window), "key_press_event",
+ g_signal_connect (G_OBJECT (window), "key-press-event",
G_CALLBACK (date_key_press_popup), mgtim);
- g_signal_connect (G_OBJECT (window), "button_press_event",
+ g_signal_connect (G_OBJECT (window), "button-press-event",
G_CALLBACK (date_button_press_popup), mgtim);
mgtim->priv->window = window;
@@ -613,9 +613,9 @@ create_entry_date (GdauiEntryCommonTime *mgtim)
mgtim->priv->date = wid;
gtk_container_add (GTK_CONTAINER (window), wid);
gtk_widget_show (wid);
- g_signal_connect (G_OBJECT (wid), "day_selected",
+ g_signal_connect (G_OBJECT (wid), "day-selected",
G_CALLBACK (date_day_selected), mgtim);
- g_signal_connect (G_OBJECT (wid), "day_selected_double_click",
+ g_signal_connect (G_OBJECT (wid), "day-selected-double-click",
G_CALLBACK (date_day_selected_double_click), mgtim);
/* button to pop up the calendar */
@@ -763,7 +763,7 @@ date_key_press_popup (GtkWidget *widget, GdkEventKey *event, GdauiEntryCommonTim
if (event->keyval != GDK_Escape)
return FALSE;
- g_signal_stop_emission_by_name (widget, "key_press_event");
+ g_signal_stop_emission_by_name (widget, "key-press-event");
hide_popup (mgtim);
return TRUE;
@@ -1145,20 +1145,20 @@ gdaui_entry_common_time_start_editing (GtkCellEditable *iface, GdkEvent *event)
}
if (mgtim->priv->entry_date) {
- g_object_set (G_OBJECT (mgtim->priv->entry_date), "has_frame", FALSE, NULL);
+ g_object_set (G_OBJECT (mgtim->priv->entry_date), "has-frame", FALSE, NULL);
gtk_cell_editable_start_editing (GTK_CELL_EDITABLE (mgtim->priv->entry_date), event);
- g_signal_connect (G_OBJECT (mgtim->priv->entry_date), "editing_done",
+ g_signal_connect (G_OBJECT (mgtim->priv->entry_date), "editing-done",
G_CALLBACK (gtk_cell_editable_entry_editing_done_cb), mgtim);
- g_signal_connect (G_OBJECT (mgtim->priv->entry_date), "remove_widget",
+ g_signal_connect (G_OBJECT (mgtim->priv->entry_date), "remove-widget",
G_CALLBACK (gtk_cell_editable_entry_remove_widget_cb), mgtim);
}
if (mgtim->priv->entry_time) {
- g_object_set (G_OBJECT (mgtim->priv->entry_time), "has_frame", FALSE, NULL);
+ g_object_set (G_OBJECT (mgtim->priv->entry_time), "has-frame", FALSE, NULL);
gtk_cell_editable_start_editing (GTK_CELL_EDITABLE (mgtim->priv->entry_time), event);
- g_signal_connect (G_OBJECT (mgtim->priv->entry_time), "editing_done",
+ g_signal_connect (G_OBJECT (mgtim->priv->entry_time), "editing-done",
G_CALLBACK (gtk_cell_editable_entry_editing_done_cb), mgtim);
- g_signal_connect (G_OBJECT (mgtim->priv->entry_time), "remove_widget",
+ g_signal_connect (G_OBJECT (mgtim->priv->entry_time), "remove-widget",
G_CALLBACK (gtk_cell_editable_entry_remove_widget_cb), mgtim);
}
diff --git a/libgda-ui/data-entries/gdaui-entry-number.c b/libgda-ui/data-entries/gdaui-entry-number.c
index 1883ef7..dc77c68 100644
--- a/libgda-ui/data-entries/gdaui-entry-number.c
+++ b/libgda-ui/data-entries/gdaui-entry-number.c
@@ -435,12 +435,12 @@ gdaui_entry_number_start_editing (GtkCellEditable *iface, GdkEvent *event)
mgstr = GDAUI_ENTRY_NUMBER (iface);
mgstr->priv->editing_canceled = FALSE;
- g_object_set (G_OBJECT (mgstr->priv->entry), "has_frame", FALSE, "xalign", 0., NULL);
+ g_object_set (G_OBJECT (mgstr->priv->entry), "has-frame", FALSE, "xalign", 0., NULL);
gtk_cell_editable_start_editing (GTK_CELL_EDITABLE (mgstr->priv->entry), event);
- g_signal_connect (G_OBJECT (mgstr->priv->entry), "editing_done",
+ g_signal_connect (G_OBJECT (mgstr->priv->entry), "editing-done",
G_CALLBACK (gtk_cell_editable_entry_editing_done_cb), mgstr);
- g_signal_connect (G_OBJECT (mgstr->priv->entry), "remove_widget",
+ g_signal_connect (G_OBJECT (mgstr->priv->entry), "remove-widget",
G_CALLBACK (gtk_cell_editable_entry_remove_widget_cb), mgstr);
gdaui_entry_shell_refresh (GDAUI_ENTRY_SHELL (mgstr));
@@ -508,7 +508,7 @@ sync_entry_options (GdauiEntryNumber *mgstr)
g_object_set (G_OBJECT (mgstr->priv->entry),
"type", gdaui_data_entry_get_value_type (GDAUI_DATA_ENTRY (mgstr)),
- "n_decimals", mgstr->priv->nb_decimals,
+ "n-decimals", mgstr->priv->nb_decimals,
"thousands-sep", mgstr->priv->thousand_sep,
"prefix", mgstr->priv->currency,
NULL);
diff --git a/libgda-ui/data-entries/gdaui-entry-shell.c b/libgda-ui/data-entries/gdaui-entry-shell.c
index d6003df..20e981f 100644
--- a/libgda-ui/data-entries/gdaui-entry-shell.c
+++ b/libgda-ui/data-entries/gdaui-entry-shell.c
@@ -30,13 +30,13 @@ static void gdaui_entry_shell_init (GdauiEntryShell *wid);
static void gdaui_entry_shell_dispose (GObject *object);
static void gdaui_entry_shell_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void gdaui_entry_shell_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
static gint event_cb (GtkWidget *widget, GdkEvent *event, GdauiEntryShell *shell);
@@ -45,8 +45,7 @@ static void contents_modified_cb (GdauiEntryShell *shell, gpointer unused);
static void gdaui_entry_shell_refresh_status_display (GdauiEntryShell *shell);
/* properties */
-enum
-{
+enum {
PROP_0,
PROP_HANDLER,
PROP_ACTIONS,
@@ -74,9 +73,9 @@ static GObjectClass *parent_class = NULL;
/**
* gdaui_entry_shell_get_type
- *
+ *
* Register the GdauiEntryShell class on the GLib type system.
- *
+ *
* Returns: the GType identifying the class.
*/
GType
@@ -95,7 +94,7 @@ gdaui_entry_shell_get_type (void)
sizeof (GdauiEntryShell),
0,
(GInstanceInitFunc) gdaui_entry_shell_init
- };
+ };
type = g_type_register_static (GTK_TYPE_VIEWPORT, "GdauiEntryShell", &info, 0);
}
@@ -108,12 +107,12 @@ gdaui_entry_shell_class_init (GdauiEntryShellClass * class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
-
+
parent_class = g_type_class_peek_parent (class);
object_class->dispose = gdaui_entry_shell_dispose;
widget_class->show_all = show_all;
-
+
/* Properties */
object_class->set_property = gdaui_entry_shell_set_property;
object_class->get_property = gdaui_entry_shell_get_property;
@@ -125,7 +124,7 @@ gdaui_entry_shell_class_init (GdauiEntryShellClass * class)
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property (object_class, PROP_IS_CELL_RENDERER,
- g_param_spec_boolean ("is_cell_renderer", NULL, NULL, TRUE,
+ g_param_spec_boolean ("is-cell-renderer", NULL, NULL, TRUE,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
}
@@ -168,8 +167,8 @@ gdaui_entry_shell_init (GdauiEntryShell * shell)
shell->priv->hbox = hbox;
/* vbox to insert the real widget to edit data */
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
shell->priv->top_box = vbox;
gtk_widget_show (vbox);
@@ -177,7 +176,7 @@ gdaui_entry_shell_init (GdauiEntryShell * shell)
arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), arrow);
- gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, TRUE, 0);
shell->priv->button = button;
gtk_widget_show_all (button);
gtk_widget_set_size_request (button, 15, 15);
@@ -205,7 +204,7 @@ gdaui_entry_shell_dispose (GObject * object)
if (shell->priv) {
if (shell->priv->data_handler)
g_object_unref (shell->priv->data_handler);
-
+
g_free (shell->priv);
shell->priv = NULL;
}
@@ -216,9 +215,9 @@ gdaui_entry_shell_dispose (GObject * object)
static void
gdaui_entry_shell_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
gpointer ptr;
GdauiEntryShell *shell;
@@ -237,14 +236,14 @@ gdaui_entry_shell_set_property (GObject *object,
shell->priv->data_handler = GDA_DATA_HANDLER (ptr);
g_object_ref (G_OBJECT (shell->priv->data_handler));
}
- else
+ else
g_message (_("Widget of class '%s' does not have any associated GdaDataHandler, "
- "(to be set using the 'handler' property) expect some mis-behaviours"),
+ "(to be set using the 'handler' property) expect some mis-behaviours"),
G_OBJECT_TYPE_NAME (object));
break;
case PROP_ACTIONS:
shell->priv->show_actions = g_value_get_boolean (value);
- if (shell->priv->show_actions)
+ if (shell->priv->show_actions)
gtk_widget_show (shell->priv->button);
else
gtk_widget_hide (shell->priv->button);
@@ -264,9 +263,9 @@ gdaui_entry_shell_set_property (GObject *object,
static void
gdaui_entry_shell_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GdauiEntryShell *shell;
@@ -306,10 +305,10 @@ gdaui_entry_shell_pack_entry (GdauiEntryShell *shell, GtkWidget *main_widget)
gtk_box_pack_start (GTK_BOX (shell->priv->top_box), main_widget, TRUE, TRUE, 0);
/* signals */
- g_signal_connect (G_OBJECT (shell), "contents_modified",
+ g_signal_connect (G_OBJECT (shell), "contents-modified",
G_CALLBACK (contents_modified_cb), NULL);
- g_signal_connect (G_OBJECT (shell), "status_changed",
+ g_signal_connect (G_OBJECT (shell), "status-changed",
G_CALLBACK (contents_modified_cb), NULL);
}
@@ -330,11 +329,11 @@ event_cb (GtkWidget *widget, GdkEvent *event, GdauiEntryShell *shell)
return done;
if (event->type == GDK_BUTTON_PRESS) {
- GdkEventButton *bevent = (GdkEventButton *) event;
+ GdkEventButton *bevent = (GdkEventButton *) event;
if ((bevent->button == 1) || (bevent->button == 3)) {
GtkWidget *menu;
guint attributes;
-
+
attributes = gdaui_entry_shell_refresh_attributes (shell);
menu = _gdaui_utility_entry_build_actions_menu (G_OBJECT (shell), attributes,
G_CALLBACK (mitem_activated_cb));
@@ -350,7 +349,7 @@ event_cb (GtkWidget *widget, GdkEvent *event, GdauiEntryShell *shell)
if (kevent->keyval == GDK_space) {
guint attributes;
-
+
attributes = gdaui_entry_shell_refresh_attributes (shell);
menu = _gdaui_utility_entry_build_actions_menu (G_OBJECT (shell), attributes,
G_CALLBACK (mitem_activated_cb));
@@ -366,7 +365,7 @@ event_cb (GtkWidget *widget, GdkEvent *event, GdauiEntryShell *shell)
done = TRUE;
}
}
-
+
return done;
}
@@ -379,7 +378,7 @@ mitem_activated_cb (GtkWidget *mitem, GdauiEntryShell *shell)
gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (shell), action, action);
}
-static void
+static void
gdaui_entry_shell_refresh_status_display (GdauiEntryShell *shell)
{
static GdkColor **colors = NULL;
diff --git a/libgda-ui/data-entries/gdaui-entry-string.c b/libgda-ui/data-entries/gdaui-entry-string.c
index d3bf99f..eaf27cb 100644
--- a/libgda-ui/data-entries/gdaui-entry-string.c
+++ b/libgda-ui/data-entries/gdaui-entry-string.c
@@ -572,7 +572,7 @@ gdaui_entry_string_start_editing (GtkCellEditable *iface, GdkEvent *event)
g_return_if_fail (mgstr->priv);
mgstr->priv->editing_canceled = FALSE;
- g_object_set (G_OBJECT (mgstr->priv->entry), "has_frame", FALSE, "xalign", 0., NULL);
+ g_object_set (G_OBJECT (mgstr->priv->entry), "has-frame", FALSE, "xalign", 0., NULL);
gtk_text_view_set_border_window_size (GTK_TEXT_VIEW (mgstr->priv->view), GTK_TEXT_WINDOW_LEFT, 0);
gtk_text_view_set_border_window_size (GTK_TEXT_VIEW (mgstr->priv->view), GTK_TEXT_WINDOW_RIGHT, 0);
gtk_text_view_set_border_window_size (GTK_TEXT_VIEW (mgstr->priv->view), GTK_TEXT_WINDOW_TOP, 0);
@@ -581,9 +581,9 @@ gdaui_entry_string_start_editing (GtkCellEditable *iface, GdkEvent *event)
gtk_container_set_border_width (GTK_CONTAINER (mgstr->priv->sw), 0);
gtk_cell_editable_start_editing (GTK_CELL_EDITABLE (mgstr->priv->entry), event);
- g_signal_connect (mgstr->priv->entry, "editing_done",
+ g_signal_connect (mgstr->priv->entry, "editing-done",
G_CALLBACK (gtk_cell_editable_entry_editing_done_cb), mgstr);
- g_signal_connect (mgstr->priv->entry, "remove_widget",
+ g_signal_connect (mgstr->priv->entry, "remove-widget",
G_CALLBACK (gtk_cell_editable_entry_remove_widget_cb), mgstr);
gdaui_entry_shell_refresh (GDAUI_ENTRY_SHELL (mgstr));
diff --git a/libgda-ui/data-entries/gdaui-entry-wrapper.c b/libgda-ui/data-entries/gdaui-entry-wrapper.c
index ae5315e..49844a4 100644
--- a/libgda-ui/data-entries/gdaui-entry-wrapper.c
+++ b/libgda-ui/data-entries/gdaui-entry-wrapper.c
@@ -1,6 +1,6 @@
/* gdaui-entry-wrapper.c
*
- * Copyright (C) 2003 - 2006 Vivien Malerba
+ * Copyright (C) 2003 - 2009 Vivien Malerba
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
@@ -27,13 +27,13 @@ static void gdaui_entry_wrapper_init (GdauiEntryWrapper *wid);
static void gdaui_entry_wrapper_dispose (GObject *object);
static void gdaui_entry_wrapper_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void gdaui_entry_wrapper_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
static void contents_changed_cb (GtkWidget *entry, GdauiEntryWrapper *mgwrap);
static void contents_activated_cb (GtkWidget *entry, GdauiEntryWrapper *mgwrap);
@@ -51,17 +51,17 @@ static void gdaui_entry_wrapper_set_value_orig (GdauiDataEntry *de
static const GValue *gdaui_entry_wrapper_get_value_orig (GdauiDataEntry *de);
static void gdaui_entry_wrapper_set_value_default (GdauiDataEntry *de, const GValue *value);
static void gdaui_entry_wrapper_set_attributes (GdauiDataEntry *de, GdaValueAttribute attrs, guint mask);
-static GdaValueAttribute gdaui_entry_wrapper_get_attributes (GdauiDataEntry *de);
+static GdaValueAttribute gdaui_entry_wrapper_get_attributes (GdauiDataEntry *de);
static GdaDataHandler *gdaui_entry_wrapper_get_handler (GdauiDataEntry *de);
static gboolean gdaui_entry_wrapper_expand_in_layout (GdauiDataEntry *de);
static void gdaui_entry_wrapper_set_editable (GdauiDataEntry *de, gboolean editable);
+static gboolean gdaui_entry_wrapper_get_editable (GdauiDataEntry *de);
static void gdaui_entry_wrapper_grab_focus (GdauiDataEntry *de);
/* properties */
-enum
-{
- PROP_0,
- PROP_SET_DEFAULT_IF_INVALID
+enum {
+ PROP_0,
+ PROP_SET_DEFAULT_IF_INVALID
};
struct _GdauiEntryWrapperPriv {
@@ -105,7 +105,7 @@ gdaui_entry_wrapper_get_type (void)
sizeof (GdauiEntryWrapper),
0,
(GInstanceInitFunc) gdaui_entry_wrapper_init
- };
+ };
static const GInterfaceInfo data_entry_info = {
(GInterfaceInitFunc) gdaui_entry_wrapper_data_entry_init,
@@ -134,6 +134,7 @@ gdaui_entry_wrapper_data_entry_init (GdauiDataEntryIface *iface)
iface->get_handler = gdaui_entry_wrapper_get_handler;
iface->expand_in_layout = gdaui_entry_wrapper_expand_in_layout;
iface->set_editable = gdaui_entry_wrapper_set_editable;
+ iface->get_editable = gdaui_entry_wrapper_get_editable;
iface->grab_focus = gdaui_entry_wrapper_grab_focus;
}
@@ -142,7 +143,7 @@ static void
gdaui_entry_wrapper_class_init (GdauiEntryWrapperClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
+
parent_class = g_type_class_peek_parent (klass);
/* virtual functions */
@@ -154,7 +155,7 @@ gdaui_entry_wrapper_class_init (GdauiEntryWrapperClass *klass)
object_class->set_property = gdaui_entry_wrapper_set_property;
object_class->get_property = gdaui_entry_wrapper_get_property;
g_object_class_install_property (object_class, PROP_SET_DEFAULT_IF_INVALID,
- g_param_spec_boolean ("set_default_if_invalid", NULL, NULL, FALSE,
+ g_param_spec_boolean ("set-default-if-invalid", NULL, NULL, FALSE,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
object_class->dispose = gdaui_entry_wrapper_dispose;
@@ -167,7 +168,7 @@ check_correct_init (GdauiEntryWrapper *mgwrap)
GtkWidget *entry = NULL;
GdauiEntryWrapperClass *klass;
gboolean class_impl_error = FALSE;;
-
+
klass = GDAUI_ENTRY_WRAPPER_CLASS (G_OBJECT_GET_CLASS (mgwrap));
if (! klass->create_entry) {
g_warning ("create_entry () virtual function not implemented for object class %s\n",
@@ -199,18 +200,18 @@ check_correct_init (GdauiEntryWrapper *mgwrap)
mgwrap->priv->real_class = klass;
mgwrap->priv->impl_is_correct = TRUE;
entry = (*mgwrap->priv->real_class->create_entry) (mgwrap);
-
+
gdaui_entry_shell_pack_entry (GDAUI_ENTRY_SHELL (mgwrap), entry);
gtk_widget_show (entry);
mgwrap->priv->entry = entry;
-
+
(*mgwrap->priv->real_class->connect_signals) (mgwrap, G_CALLBACK (contents_changed_cb),
G_CALLBACK (contents_activated_cb));
}
else {
/* we need to exit because the program WILL BE unstable and WILL crash */
g_assert_not_reached ();
- }
+ }
}
}
@@ -277,26 +278,26 @@ gdaui_entry_wrapper_dispose (GObject *object)
}
-static void
+static void
gdaui_entry_wrapper_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GdauiEntryWrapper *mgwrap = GDAUI_ENTRY_WRAPPER (object);
if (mgwrap->priv) {
switch (param_id) {
case PROP_SET_DEFAULT_IF_INVALID: {
guint attrs;
-
+
mgwrap->priv->set_default_if_invalid = g_value_get_boolean (value);
attrs = gdaui_data_entry_get_attributes (GDAUI_DATA_ENTRY (mgwrap));
-
+
if (mgwrap->priv->set_default_if_invalid && (attrs & GDA_VALUE_ATTR_DATA_NON_VALID)) {
GValue *sane_value;
GdaDataHandler *dh;
GType type;
-
+
check_correct_init (mgwrap);
dh = gdaui_data_entry_get_handler (GDAUI_DATA_ENTRY (mgwrap));
type = gdaui_data_entry_get_value_type (GDAUI_DATA_ENTRY (mgwrap));
@@ -313,9 +314,9 @@ gdaui_entry_wrapper_set_property (GObject *object,
static void
gdaui_entry_wrapper_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GdauiEntryWrapper *mgwrap = GDAUI_ENTRY_WRAPPER (object);
if (mgwrap->priv) {
@@ -337,7 +338,6 @@ void
gdaui_entry_wrapper_contents_changed (GdauiEntryWrapper *mgwrap)
{
g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (mgwrap));
- g_return_if_fail (((GdauiEntryWrapper *) mgwrap)->priv);
contents_changed_cb (NULL, mgwrap);
}
@@ -353,7 +353,6 @@ void
gdaui_entry_wrapper_contents_activated (GdauiEntryWrapper *mgwrap)
{
g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (mgwrap));
- g_return_if_fail (((GdauiEntryWrapper *) mgwrap)->priv);
contents_activated_cb (NULL, mgwrap);
}
@@ -381,7 +380,7 @@ contents_activated_cb (GtkWidget *entry, GdauiEntryWrapper *mgwrap)
#ifdef debug_signal
g_print (">> 'CONTENTS_ACTIVATED' from %s\n", __FUNCTION__);
#endif
- g_signal_emit_by_name (G_OBJECT (mgwrap), "contents_activated");
+ g_signal_emit_by_name (G_OBJECT (mgwrap), "contents-activated");
#ifdef debug_signal
g_print ("<< 'CONTENTS_ACTIVATED' from %s\n", __FUNCTION__);
#endif
@@ -395,7 +394,7 @@ gdaui_entry_wrapper_emit_signal (GdauiEntryWrapper *mgwrap)
#ifdef debug_signal
g_print (">> 'CONTENTS_MODIFIED' from %s\n", __FUNCTION__);
#endif
- g_signal_emit_by_name (G_OBJECT (mgwrap), "contents_modified");
+ g_signal_emit_by_name (G_OBJECT (mgwrap), "contents-modified");
#ifdef debug_signal
g_print ("<< 'CONTENTS_MODIFIED' from %s\n", __FUNCTION__);
#endif
@@ -411,9 +410,8 @@ gdaui_entry_wrapper_set_value_type (GdauiDataEntry *iface, GType type)
GdauiEntryWrapper *mgwrap;
g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface));
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_if_fail (mgwrap->priv);
-
+ mgwrap = (GdauiEntryWrapper*) iface;
+
if (mgwrap->priv->type != type) {
GValue *value;
GdaDataHandler *dh;
@@ -444,8 +442,7 @@ gdaui_entry_wrapper_get_value_type (GdauiDataEntry *iface)
GdauiEntryWrapper *mgwrap;
g_return_val_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface), G_TYPE_INVALID);
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_val_if_fail (mgwrap->priv, G_TYPE_INVALID);
+ mgwrap = (GdauiEntryWrapper*) iface;
return mgwrap->priv->type;
}
@@ -457,18 +454,17 @@ gdaui_entry_wrapper_set_value (GdauiDataEntry *iface, const GValue *value)
GdauiEntryWrapper *mgwrap;
g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface));
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_if_fail (mgwrap->priv);
+ mgwrap = (GdauiEntryWrapper*) iface;
check_correct_init (mgwrap);
-
+
block_signals (mgwrap);
if (value) {
- g_return_if_fail ((G_VALUE_TYPE ((GValue *) value) == mgwrap->priv->type) ||
+ g_return_if_fail ((G_VALUE_TYPE ((GValue *) value) == mgwrap->priv->type) ||
(G_VALUE_TYPE ((GValue *) value) == GDA_TYPE_NULL));
(*mgwrap->priv->real_class->real_set_value) (mgwrap, value);
if (gda_value_is_null ((GValue *) value))
mgwrap->priv->null_forced = TRUE;
- else
+ else
mgwrap->priv->null_forced = FALSE;
}
else {
@@ -489,8 +485,7 @@ gdaui_entry_wrapper_get_value (GdauiDataEntry *iface)
GdaDataHandler *dh;
g_return_val_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface), NULL);
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_val_if_fail (mgwrap->priv, NULL);
+ mgwrap = (GdauiEntryWrapper*) iface;
dh = gdaui_entry_wrapper_get_handler (GDAUI_DATA_ENTRY (mgwrap));
@@ -518,10 +513,9 @@ gdaui_entry_wrapper_set_value_orig (GdauiDataEntry *iface, const GValue *value)
GdauiEntryWrapper *mgwrap;
gboolean changed = TRUE;
GValue *evalue;
-
+
g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface));
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_if_fail (mgwrap->priv);
+ mgwrap = (GdauiEntryWrapper*) iface;
check_correct_init (mgwrap);
/* compare existing value and the one provided as argument */
@@ -539,7 +533,7 @@ gdaui_entry_wrapper_set_value_orig (GdauiDataEntry *iface, const GValue *value)
}
/* get rid on any existing orig value */
- if (mgwrap->priv->value_orig) {
+ if (mgwrap->priv->value_orig) {
gda_value_free (mgwrap->priv->value_orig);
mgwrap->priv->value_orig = NULL;
}
@@ -552,7 +546,7 @@ gdaui_entry_wrapper_set_value_orig (GdauiDataEntry *iface, const GValue *value)
}
if (value) {
- g_return_if_fail ((G_VALUE_TYPE ((GValue *) value) == mgwrap->priv->type) ||
+ g_return_if_fail ((G_VALUE_TYPE ((GValue *) value) == mgwrap->priv->type) ||
(G_VALUE_TYPE ((GValue *) value) == GDA_TYPE_NULL));
mgwrap->priv->value_orig = gda_value_copy ((GValue *) value);
}
@@ -579,15 +573,14 @@ gdaui_entry_wrapper_set_value_default (GdauiDataEntry *iface, const GValue *valu
GdauiEntryWrapper *mgwrap;
g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface));
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_if_fail (mgwrap->priv);
+ mgwrap = (GdauiEntryWrapper*) iface;
if (mgwrap->priv->value_default)
gda_value_free (mgwrap->priv->value_default);
- if (value)
+ if (value)
mgwrap->priv->value_default = gda_value_copy ((GValue *) value);
- else
+ else
mgwrap->priv->value_default = gda_value_new_null ();
if (mgwrap->priv->default_forced) {
@@ -613,8 +606,7 @@ gdaui_entry_wrapper_set_attributes (GdauiDataEntry *iface, guint attrs, guint ma
GdauiEntryWrapper *mgwrap;
g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface));
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_if_fail (mgwrap->priv);
+ mgwrap = (GdauiEntryWrapper*) iface;
check_correct_init (mgwrap);
/* Setting to NULL */
@@ -627,10 +619,10 @@ gdaui_entry_wrapper_set_attributes (GdauiDataEntry *iface, guint attrs, guint ma
gdaui_entry_wrapper_set_value (iface, NULL);
unblock_signals (mgwrap);
mgwrap->priv->null_forced = TRUE;
-
+
/* if default is set, see if we can keep it that way */
if (mgwrap->priv->default_forced) {
- if (G_VALUE_TYPE (mgwrap->priv->value_default) !=
+ if (G_VALUE_TYPE (mgwrap->priv->value_default) !=
GDA_TYPE_NULL)
mgwrap->priv->default_forced = FALSE;
}
@@ -657,7 +649,7 @@ gdaui_entry_wrapper_set_attributes (GdauiDataEntry *iface, guint attrs, guint ma
if (mgwrap->priv->value_default) {
if (G_VALUE_TYPE (mgwrap->priv->value_default) == mgwrap->priv->type)
gdaui_entry_wrapper_set_value (iface, mgwrap->priv->value_default);
- else
+ else
(*mgwrap->priv->real_class->real_set_value) (mgwrap, NULL);
}
else
@@ -666,7 +658,7 @@ gdaui_entry_wrapper_set_attributes (GdauiDataEntry *iface, guint attrs, guint ma
/* if NULL is set, see if we can keep it that way */
if (mgwrap->priv->null_forced) {
- if (G_VALUE_TYPE (mgwrap->priv->value_default) !=
+ if (G_VALUE_TYPE (mgwrap->priv->value_default) !=
GDA_TYPE_NULL)
mgwrap->priv->null_forced = FALSE;
}
@@ -683,7 +675,7 @@ gdaui_entry_wrapper_set_attributes (GdauiDataEntry *iface, guint attrs, guint ma
/* Can be DEFAULT ? */
if (mask & GDA_VALUE_ATTR_CAN_BE_DEFAULT)
mgwrap->priv->default_possible = (attrs & GDA_VALUE_ATTR_CAN_BE_DEFAULT) ? TRUE : FALSE;
-
+
/* Modified ? */
if (mask & GDA_VALUE_ATTR_IS_UNCHANGED) {
if (attrs & GDA_VALUE_ATTR_IS_UNCHANGED) {
@@ -699,7 +691,7 @@ gdaui_entry_wrapper_set_attributes (GdauiDataEntry *iface, guint attrs, guint ma
if (mask & GDA_VALUE_ATTR_ACTIONS_SHOWN) {
GValue *gval;
mgwrap->priv->show_actions = (attrs & GDA_VALUE_ATTR_ACTIONS_SHOWN) ? TRUE : FALSE;
-
+
gval = g_new0 (GValue, 1);
g_value_init (gval, G_TYPE_BOOLEAN);
g_value_set_boolean (gval, mgwrap->priv->show_actions);
@@ -708,13 +700,13 @@ gdaui_entry_wrapper_set_attributes (GdauiDataEntry *iface, guint attrs, guint ma
}
/* NON WRITABLE attributes */
- if (mask & GDA_VALUE_ATTR_DATA_NON_VALID)
+ if (mask & GDA_VALUE_ATTR_DATA_NON_VALID)
g_warning ("Can't force a GdauiDataEntry to be invalid!");
if (mask & GDA_VALUE_ATTR_HAS_VALUE_ORIG)
g_warning ("Having an original value is not a write attribute on GdauiDataEntry!");
- g_signal_emit_by_name (G_OBJECT (mgwrap), "status_changed");
+ g_signal_emit_by_name (G_OBJECT (mgwrap), "status-changed");
}
static GdaValueAttribute
@@ -727,18 +719,17 @@ gdaui_entry_wrapper_get_attributes (GdauiDataEntry *iface)
gboolean value_is_null = FALSE;
g_return_val_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface), 0);
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_val_if_fail (mgwrap->priv, 0);
+ mgwrap = (GdauiEntryWrapper*) iface;
check_correct_init (mgwrap);
- if (!mgwrap->priv->real_class->value_is_equal_to ||
+ if (!mgwrap->priv->real_class->value_is_equal_to ||
!mgwrap->priv->real_class->value_is_null) {
value = gdaui_entry_wrapper_get_value (iface);
has_current_value = TRUE;
}
else
has_current_value = FALSE;
-
+
/* NULL? */
if (has_current_value) {
if ((value && (G_VALUE_TYPE (value) == GDA_TYPE_NULL)) || !value) {
@@ -758,22 +749,22 @@ gdaui_entry_wrapper_get_attributes (GdauiDataEntry *iface)
retval = retval | GDA_VALUE_ATTR_IS_NULL;
/* can be NULL? */
- if (mgwrap->priv->null_possible)
+ if (mgwrap->priv->null_possible)
retval = retval | GDA_VALUE_ATTR_CAN_BE_NULL;
-
+
/* is default */
- if (mgwrap->priv->default_forced)
+ if (mgwrap->priv->default_forced)
retval = retval | GDA_VALUE_ATTR_IS_DEFAULT;
-
+
/* can be default? */
if (mgwrap->priv->default_possible)
retval = retval | GDA_VALUE_ATTR_CAN_BE_DEFAULT;
-
+
/* is unchanged */
if (has_current_value) {
- if (mgwrap->priv->value_orig &&
+ if (mgwrap->priv->value_orig &&
(G_VALUE_TYPE (value) == G_VALUE_TYPE (mgwrap->priv->value_orig))) {
- if (gda_value_is_null (value))
+ if (gda_value_is_null (value))
retval = retval | GDA_VALUE_ATTR_IS_UNCHANGED;
else {
if (! gda_value_compare (value, mgwrap->priv->value_orig))
@@ -798,9 +789,9 @@ gdaui_entry_wrapper_get_attributes (GdauiDataEntry *iface)
}
/* has original value? */
- if (mgwrap->priv->value_orig)
+ if (mgwrap->priv->value_orig)
retval = retval | GDA_VALUE_ATTR_HAS_VALUE_ORIG;
-
+
if (has_current_value)
gda_value_free (value);
@@ -817,7 +808,6 @@ gdaui_entry_wrapper_get_handler (GdauiDataEntry *iface)
GdaDataHandler *dh;
g_return_val_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface), NULL);
- g_return_val_if_fail (GDAUI_ENTRY_WRAPPER (iface)->priv, NULL);
g_object_get (G_OBJECT (iface), "handler", &dh, NULL);
if (dh) /* loose the reference before returning the object */
@@ -832,8 +822,7 @@ gdaui_entry_wrapper_expand_in_layout (GdauiDataEntry *iface)
GdauiEntryWrapper *mgwrap;
g_return_val_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface), FALSE);
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_val_if_fail (mgwrap->priv, FALSE);
+ mgwrap = (GdauiEntryWrapper*) iface;
check_correct_init (mgwrap);
return (mgwrap->priv->real_class->expand_in_layout) (mgwrap);
@@ -845,8 +834,7 @@ gdaui_entry_wrapper_set_editable (GdauiDataEntry *iface, gboolean editable)
GdauiEntryWrapper *mgwrap;
g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface));
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_if_fail (mgwrap->priv);
+ mgwrap = (GdauiEntryWrapper*) iface;
check_correct_init (mgwrap);
mgwrap->priv->editable = editable;
@@ -856,14 +844,24 @@ gdaui_entry_wrapper_set_editable (GdauiDataEntry *iface, gboolean editable)
gtk_widget_set_sensitive (GTK_WIDGET (iface), editable);
}
+static gboolean
+gdaui_entry_wrapper_get_editable (GdauiDataEntry *iface)
+{
+ GdauiEntryWrapper *mgwrap;
+
+ g_return_val_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface), FALSE);
+ mgwrap = (GdauiEntryWrapper*) iface;
+
+ return mgwrap->priv->editable;
+}
+
static void
gdaui_entry_wrapper_grab_focus (GdauiDataEntry *iface)
{
GdauiEntryWrapper *mgwrap;
g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface));
- mgwrap = GDAUI_ENTRY_WRAPPER (iface);
- g_return_if_fail (mgwrap->priv);
+ mgwrap = (GdauiEntryWrapper*) iface;
check_correct_init (mgwrap);
if (mgwrap->priv->real_class->grab_focus)
diff --git a/libgda-ui/data-entries/gdaui-numeric-entry.c b/libgda-ui/data-entries/gdaui-numeric-entry.c
index 3de9b57..9c0a0fa 100644
--- a/libgda-ui/data-entries/gdaui-numeric-entry.c
+++ b/libgda-ui/data-entries/gdaui-numeric-entry.c
@@ -126,7 +126,7 @@ gdaui_numeric_entry_class_init (GdauiNumericEntryClass *klass)
0, 127, '.',
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_THOUSANDS_SEP,
- g_param_spec_char ("thousands_sep", NULL, NULL,
+ g_param_spec_char ("thousands-sep", NULL, NULL,
0, 127, ',',
G_PARAM_READABLE | G_PARAM_WRITABLE));
}
diff --git a/libgda-ui/data-entries/plugins/common-pict.c b/libgda-ui/data-entries/plugins/common-pict.c
index 85afcc5..256bcbc 100644
--- a/libgda-ui/data-entries/plugins/common-pict.c
+++ b/libgda-ui/data-entries/plugins/common-pict.c
@@ -36,7 +36,7 @@ common_pict_load_data (PictOptions *options, const GValue *value, PictBinData *b
if (value) {
if (gda_value_is_null ((GValue *) value)) {
*stock = GTK_STOCK_MISSING_IMAGE;
- g_set_error (error, 0, 0, _("No data to display"));
+ g_set_error (error, 0, 0, _("No data"));
allok = FALSE;
}
else {
@@ -67,7 +67,7 @@ common_pict_load_data (PictOptions *options, const GValue *value, PictBinData *b
else {
*stock = GTK_STOCK_DIALOG_ERROR;
g_set_error (error, 0, 0,
- _("No data to display"));
+ _("No data"));
allok = FALSE;
}
}
@@ -555,6 +555,8 @@ compute_hash (guchar *data, glong data_length)
guint result = 0;
guchar *ptr;
+ if (!data)
+ return 0;
for (ptr = data; ptr <= data + data_length - 1; ptr++)
result += *ptr;
@@ -567,19 +569,32 @@ compute_hash (guchar *data, glong data_length)
void
common_pict_add_cached_pixbuf (PictOptions *options, const GValue *value, GdkPixbuf *pixbuf)
{
- const GdaBinary *bin;
guint hash;
+ g_return_if_fail (pixbuf);
- if (!options->pixbuf_hash)
+ if (!options->pixbuf_hash || !value)
return;
- if (!value || ! GDA_VALUE_HOLDS_BINARY (value))
- return;
- g_return_if_fail (pixbuf);
- bin = gda_value_get_binary (value);
- hash = compute_hash (bin->data, bin->binary_length);
- g_hash_table_insert (options->pixbuf_hash, GUINT_TO_POINTER (hash), pixbuf);
- g_object_ref (pixbuf);
+ else if (GDA_VALUE_HOLDS_BINARY (value)) {
+ const GdaBinary *bin;
+ bin = gda_value_get_binary (value);
+ hash = compute_hash (bin->data, bin->binary_length);
+ g_hash_table_insert (options->pixbuf_hash, GUINT_TO_POINTER (hash), pixbuf);
+ g_object_ref (pixbuf);
+ }
+ else if (GDA_VALUE_HOLDS_BLOB (value)) {
+ const GdaBinary *bin;
+ const GdaBlob *blob;
+ blob = gda_value_get_blob (value);
+ bin = (GdaBinary *) blob;
+ if (bin) {
+ if (!bin->data && blob->op)
+ gda_blob_op_read_all (blob->op, blob);
+ hash = compute_hash (bin->data, bin->binary_length);
+ g_hash_table_insert (options->pixbuf_hash, GUINT_TO_POINTER (hash), pixbuf);
+ g_object_ref (pixbuf);
+ }
+ }
}
/*
@@ -589,18 +604,31 @@ GdkPixbuf *
common_pict_fetch_cached_pixbuf (PictOptions *options, const GValue *value)
{
GdkPixbuf *pixbuf = NULL;
- const GdaBinary *bin;
guint hash;
if (!options->pixbuf_hash)
return NULL;
- if (!value || ! GDA_VALUE_HOLDS_BINARY (value))
+ if (!value)
return NULL;
-
- bin = gda_value_get_binary (value);
- if (bin) {
- hash = compute_hash (bin->data, bin->binary_length);
- pixbuf = g_hash_table_lookup (options->pixbuf_hash, GUINT_TO_POINTER (hash));
+ else if (GDA_VALUE_HOLDS_BINARY (value)) {
+ const GdaBinary *bin;
+ bin = gda_value_get_binary (value);
+ if (bin) {
+ hash = compute_hash (bin->data, bin->binary_length);
+ pixbuf = g_hash_table_lookup (options->pixbuf_hash, GUINT_TO_POINTER (hash));
+ }
+ }
+ else if (GDA_VALUE_HOLDS_BLOB (value)) {
+ const GdaBinary *bin;
+ const GdaBlob *blob;
+ blob = gda_value_get_blob (value);
+ bin = (GdaBinary *) blob;
+ if (bin) {
+ if (!bin->data && blob->op)
+ gda_blob_op_read_all (blob->op, blob);
+ hash = compute_hash (bin->data, bin->binary_length);
+ pixbuf = g_hash_table_lookup (options->pixbuf_hash, GUINT_TO_POINTER (hash));
+ }
}
return pixbuf;
diff --git a/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-cgrid.c b/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-cgrid.c
index d2e7e0b..b32427e 100644
--- a/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-cgrid.c
+++ b/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-cgrid.c
@@ -71,7 +71,7 @@ gdaui_data_cell_renderer_cgrid_new (GdaDataHandler *data_handler,
const gchar *options)
{
return (GdauiDataCellRendererCGrid *) g_object_new (GDAUI_TYPE_DATA_CELL_RENDERER_CGRID,
- "data_handler", data_handler,
+ "data-handler", data_handler,
"gtype", gtype,
"options", g_strdup (options),
NULL);
@@ -500,14 +500,14 @@ gdaui_data_cell_renderer_cgrid_start_editing (GtkCellRenderer *renderer,
cgrid->priv->options);
g_object_set (G_OBJECT(entry),
- "is_cell_renderer", TRUE,
+ "is-cell-renderer", TRUE,
"actions", FALSE,
NULL);
gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY(entry),
cgrid->priv->value);
- g_signal_connect (G_OBJECT(entry), "editing_done",
+ g_signal_connect (G_OBJECT(entry), "editing-done",
G_CALLBACK(gdaui_data_cell_renderer_cgrid_editing_done),
cgrid);
diff --git a/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-password.c b/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-password.c
index 352ca70..8c895ac 100644
--- a/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-password.c
+++ b/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-password.c
@@ -92,14 +92,14 @@ typedef struct
/* text renderer */
gulong focus_out_id;
} GdauiDataCellRendererPasswordInfo;
-#define GDAUI_DATA_CELL_RENDERER_PASSWORD_INFO_KEY "gdaui_data_cell_renderer_password_info_key"
+#define GDAUI_DATA_CELL_RENDERER_PASSWORD_INFO_KEY "__info_key_P"
static GObjectClass *parent_class = NULL;
static guint text_cell_renderer_password_signals [LAST_SIGNAL];
-#define GDAUI_DATA_CELL_RENDERER_PASSWORD_PATH "gdaui_data_cell_renderer_password_path"
+#define GDAUI_DATA_CELL_RENDERER_PASSWORD_PATH "__path_P"
GType
gdaui_data_cell_renderer_password_get_type (void)
@@ -168,16 +168,16 @@ gdaui_data_cell_renderer_password_class_init (GdauiDataCellRendererPasswordClass
g_object_class_install_property (object_class,
PROP_VALUE_ATTRIBUTES,
- g_param_spec_flags ("value_attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
+ g_param_spec_flags ("value-attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
GDA_VALUE_ATTR_NONE, G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_TO_BE_DELETED,
- g_param_spec_boolean ("to_be_deleted", NULL, NULL, FALSE,
+ g_param_spec_boolean ("to-be-deleted", NULL, NULL, FALSE,
G_PARAM_WRITABLE));
g_object_class_install_property(object_class,
PROP_DATA_HANDLER,
- g_param_spec_object("data_handler", NULL, NULL, GDA_TYPE_DATA_HANDLER,
+ g_param_spec_object("data-handler", NULL, NULL, GDA_TYPE_DATA_HANDLER,
G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property(object_class,
PROP_TYPE,
@@ -343,7 +343,7 @@ gdaui_data_cell_renderer_password_new (GdaDataHandler *dh, GType type, const gch
g_return_val_if_fail (!dh || GDA_IS_DATA_HANDLER (dh), NULL);
obj = g_object_new (GDAUI_TYPE_DATA_CELL_RENDERER_PASSWORD,
- "type", type, "data_handler", dh, NULL);
+ "type", type, "data-handler", dh, NULL);
if (options)
GDAUI_DATA_CELL_RENDERER_PASSWORD (obj)->priv->options = g_strdup (options);
@@ -464,7 +464,7 @@ gdaui_data_cell_renderer_password_start_editing (GtkCellRenderer *cell,
entry = gdaui_entry_password_new (datacell->priv->dh, datacell->priv->type, datacell->priv->options);
- g_object_set (G_OBJECT (entry), "is_cell_renderer", TRUE, "actions", FALSE, NULL);
+ g_object_set (G_OBJECT (entry), "is-cell-renderer", TRUE, "actions", FALSE, NULL);
gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY (entry), datacell->priv->value);
@@ -472,9 +472,9 @@ gdaui_data_cell_renderer_password_start_editing (GtkCellRenderer *cell,
g_object_set_data_full (G_OBJECT (entry), GDAUI_DATA_CELL_RENDERER_PASSWORD_PATH, g_strdup (path), g_free);
g_object_set_data_full (G_OBJECT (cell), GDAUI_DATA_CELL_RENDERER_PASSWORD_INFO_KEY, info, g_free);
- g_signal_connect (entry, "editing_done",
+ g_signal_connect (entry, "editing-done",
G_CALLBACK (gdaui_data_cell_renderer_password_editing_done), datacell);
- info->focus_out_id = g_signal_connect (entry, "focus_out_event",
+ info->focus_out_id = g_signal_connect (entry, "focus-out-event",
G_CALLBACK (gdaui_data_cell_renderer_password_focus_out_event),
datacell);
gtk_widget_show (entry);
diff --git a/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-pict.c b/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-pict.c
index dd1d8a0..deda2c8 100644
--- a/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-pict.c
+++ b/libgda-ui/data-entries/plugins/gdaui-data-cell-renderer-pict.c
@@ -185,7 +185,7 @@ gdaui_data_cell_renderer_pict_class_init (GdauiDataCellRendererPictClass *class)
g_object_class_install_property (object_class,
PROP_VALUE_ATTRIBUTES,
- g_param_spec_flags ("value_attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
+ g_param_spec_flags ("value-attributes", NULL, NULL, GDA_TYPE_VALUE_ATTRIBUTE,
GDA_VALUE_ATTR_NONE, G_PARAM_READWRITE));
g_object_class_install_property (object_class,
@@ -199,7 +199,7 @@ gdaui_data_cell_renderer_pict_class_init (GdauiDataCellRendererPictClass *class)
g_object_class_install_property (object_class,
PROP_TO_BE_DELETED,
- g_param_spec_boolean ("to_be_deleted", NULL, NULL, FALSE,
+ g_param_spec_boolean ("to-be-deleted", NULL, NULL, FALSE,
G_PARAM_WRITABLE));
pixbuf_cell_signals[CHANGED] = g_signal_new ("changed",
@@ -423,7 +423,7 @@ pict_data_changed_cb (GdauiDataCellRendererPict *pictcell)
value = common_pict_get_value (&(pictcell->priv->bindata), &(pictcell->priv->options),
pictcell->priv->type);
g_signal_emit (G_OBJECT (pictcell), pixbuf_cell_signals[CHANGED], 0,
- g_object_get_data (G_OBJECT (pictcell), "last_path"), value);
+ g_object_get_data (G_OBJECT (pictcell), "last-path"), value);
gda_value_free (value);
}
@@ -442,7 +442,7 @@ gdaui_data_cell_renderer_pict_activate (GtkCellRenderer *cell,
if (pictcell->priv->editable) {
int event_time;
- g_object_set_data_full (G_OBJECT (pictcell), "last_path", g_strdup (path), g_free);
+ g_object_set_data_full (G_OBJECT (pictcell), "last-path", g_strdup (path), g_free);
if (!pictcell->priv->popup_menu.menu)
common_pict_create_menu (&(pictcell->priv->popup_menu), widget, &(pictcell->priv->bindata),
&(pictcell->priv->options),
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-cgrid.c b/libgda-ui/data-entries/plugins/gdaui-entry-cgrid.c
index 77455ef..cf82d07 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-cgrid.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-cgrid.c
@@ -344,7 +344,7 @@ window_popup_on_key_press_event (GtkToggleButton *window_popup,
return FALSE;
}
- g_signal_stop_emission_by_name (G_OBJECT(window_popup), "key_press_event");
+ g_signal_stop_emission_by_name (G_OBJECT(window_popup), "key-press-event");
hide_window_popup ((GtkWidget *) data);
gtk_widget_grab_focus (GDAUI_ENTRY_CGRID(data)->priv->entry);
@@ -786,13 +786,13 @@ connect_signals (GdauiEntryWrapper *entry_wrapper,
g_signal_connect (G_OBJECT(cgrid->priv->toggle_button), "toggled",
G_CALLBACK(toggle_button_on_toggled), (gpointer) cgrid);
- g_signal_connect (G_OBJECT(cgrid->priv->window_popup), "delete_event",
+ g_signal_connect (G_OBJECT(cgrid->priv->window_popup), "delete-event",
G_CALLBACK(window_popup_on_delete_event), (gpointer) cgrid);
- g_signal_connect (G_OBJECT(cgrid->priv->window_popup), "key_press_event",
+ g_signal_connect (G_OBJECT(cgrid->priv->window_popup), "key-press-event",
G_CALLBACK(window_popup_on_key_press_event), (gpointer) cgrid);
- g_signal_connect (G_OBJECT(cgrid->priv->window_popup), "button_press_event",
+ g_signal_connect (G_OBJECT(cgrid->priv->window_popup), "button-press-event",
G_CALLBACK(window_popup_on_button_press_event), (gpointer) cgrid);
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-pict.c b/libgda-ui/data-entries/plugins/gdaui-entry-pict.c
index 0e4a338..f44619a 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-pict.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-pict.c
@@ -58,7 +58,6 @@ struct _GdauiEntryPictPrivate
{
GtkWidget *sw;
GtkWidget *pict;
- GtkWidget *notice;
gboolean editable;
PictBinData bindata;
@@ -223,7 +222,7 @@ create_entry (GdauiEntryWrapper *mgwrap)
GtkWidget *vbox, *wid;
GdauiEntryPict *mgpict;
- g_return_val_if_fail (mgwrap && GDAUI_IS_ENTRY_PICT (mgwrap), NULL);
+ g_return_val_if_fail (GDAUI_IS_ENTRY_PICT (mgwrap), NULL);
mgpict = GDAUI_ENTRY_PICT (mgwrap);
g_return_val_if_fail (mgpict->priv, NULL);
@@ -250,12 +249,6 @@ create_entry (GdauiEntryWrapper *mgwrap)
wid = gtk_bin_get_child (GTK_BIN (mgpict->priv->sw));
gtk_viewport_set_shadow_type (GTK_VIEWPORT (wid), GTK_SHADOW_NONE);
- /* notice, not shown */
- wid = gtk_label_new ("");
- mgpict->priv->notice = wid;
- gtk_misc_set_alignment (GTK_MISC (wid), 0., .5);
- gtk_box_pack_start (GTK_BOX (vbox), wid, TRUE, TRUE, 0);
-
/* connect signals for popup menu */
g_signal_connect (G_OBJECT (mgpict), "popup-menu",
G_CALLBACK (popup_menu_cb), mgpict);
@@ -278,6 +271,7 @@ size_allocate_cb (GtkWidget *wid, GtkAllocation *allocation, GdauiEntryPict *mgp
mgpict->priv->size.width = allocation->width;
mgpict->priv->size.height = allocation->height;
common_pict_clear_pixbuf_cache (&(mgpict->priv->options));
+ display_image (mgpict, NULL, NULL, NULL);
}
}
@@ -329,15 +323,18 @@ event_cb (GtkWidget *widget, GdkEvent *event, GdauiEntryPict *mgpict)
return TRUE;
}
if ((event->type == GDK_2BUTTON_PRESS) && (((GdkEventButton *) event)->button == 1)) {
- if (!mgpict->priv->popup_menu.menu)
- common_pict_create_menu (&(mgpict->priv->popup_menu), widget, &(mgpict->priv->bindata),
- &(mgpict->priv->options),
- (PictCallback) pict_data_changed_cb, mgpict);
-
- common_pict_adjust_menu_sensitiveness (&(mgpict->priv->popup_menu), mgpict->priv->editable,
- &(mgpict->priv->bindata));
-
- gtk_menu_item_activate (GTK_MENU_ITEM (mgpict->priv->popup_menu.load_mitem));
+ if (mgpict->priv->editable) {
+ if (!mgpict->priv->popup_menu.menu)
+ common_pict_create_menu (&(mgpict->priv->popup_menu), widget, &(mgpict->priv->bindata),
+ &(mgpict->priv->options),
+ (PictCallback) pict_data_changed_cb, mgpict);
+
+ common_pict_adjust_menu_sensitiveness (&(mgpict->priv->popup_menu), mgpict->priv->editable,
+ &(mgpict->priv->bindata));
+
+ gtk_menu_item_activate (GTK_MENU_ITEM (mgpict->priv->popup_menu.load_mitem));
+ return TRUE;
+ }
}
return FALSE;
@@ -351,7 +348,7 @@ real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value)
gchar *notice_msg = NULL;
GError *error = NULL;
- g_return_if_fail (mgwrap && GDAUI_IS_ENTRY_PICT (mgwrap));
+ g_return_if_fail (GDAUI_IS_ENTRY_PICT (mgwrap));
mgpict = GDAUI_ENTRY_PICT (mgwrap);
g_return_if_fail (mgpict->priv);
@@ -390,7 +387,10 @@ display_image (GdauiEntryPict *mgpict, const GValue *value, const gchar *error_s
alloc.width = mgpict->priv->sw->allocation.width;
alloc.height = mgpict->priv->sw->allocation.height;
#endif
-
+
+ alloc.width = MAX (alloc.width, 10);
+ alloc.height = MAX (alloc.height, 10);
+
pixbuf = common_pict_fetch_cached_pixbuf (&(mgpict->priv->options), value);
if (pixbuf)
g_object_ref (pixbuf);
@@ -419,13 +419,8 @@ display_image (GdauiEntryPict *mgpict, const GValue *value, const gchar *error_s
if (stock)
gtk_image_set_from_stock (GTK_IMAGE (mgpict->priv->pict),
stock, GTK_ICON_SIZE_DIALOG);
- if (notice || notice_msg) {
- gtk_label_set_text (GTK_LABEL (mgpict->priv->notice), notice ? notice : notice_msg);
- gtk_widget_show (mgpict->priv->notice);
- g_free (notice_msg);
- }
- else
- gtk_widget_hide (mgpict->priv->notice);
+ gtk_widget_set_tooltip_text (mgpict->priv->pict, notice ? notice : notice_msg);
+ g_free (notice_msg);
common_pict_adjust_menu_sensitiveness (&(mgpict->priv->popup_menu), mgpict->priv->editable, &(mgpict->priv->bindata));
gtk_widget_queue_resize ((GtkWidget *) mgpict);
@@ -436,7 +431,7 @@ real_get_value (GdauiEntryWrapper *mgwrap)
{
GdauiEntryPict *mgpict;
- g_return_val_if_fail (mgwrap && GDAUI_IS_ENTRY_PICT (mgwrap), NULL);
+ g_return_val_if_fail (GDAUI_IS_ENTRY_PICT (mgwrap), NULL);
mgpict = GDAUI_ENTRY_PICT (mgwrap);
g_return_val_if_fail (mgpict->priv, NULL);
@@ -461,12 +456,13 @@ set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
{
GdauiEntryPict *mgpict;
- g_return_if_fail (mgwrap && GDAUI_IS_ENTRY_PICT (mgwrap));
+ g_return_if_fail (GDAUI_IS_ENTRY_PICT (mgwrap));
mgpict = GDAUI_ENTRY_PICT (mgwrap);
g_return_if_fail (mgpict->priv);
mgpict->priv->editable = editable;
- common_pict_adjust_menu_sensitiveness (&(mgpict->priv->popup_menu), mgpict->priv->editable, &(mgpict->priv->bindata));
+ common_pict_adjust_menu_sensitiveness (&(mgpict->priv->popup_menu),
+ mgpict->priv->editable, &(mgpict->priv->bindata));
}
static gboolean
@@ -474,7 +470,7 @@ value_is_equal_to (GdauiEntryWrapper *mgwrap, const GValue *value)
{
GdauiEntryPict *mgpict;
- g_return_val_if_fail (mgwrap && GDAUI_IS_ENTRY_PICT (mgwrap), FALSE);
+ g_return_val_if_fail (GDAUI_IS_ENTRY_PICT (mgwrap), FALSE);
mgpict = GDAUI_ENTRY_PICT (mgwrap);
g_return_val_if_fail (mgpict->priv, FALSE);
@@ -547,7 +543,7 @@ value_is_null (GdauiEntryWrapper *mgwrap)
{
GdauiEntryPict *mgpict;
- g_return_val_if_fail (mgwrap && GDAUI_IS_ENTRY_PICT (mgwrap), TRUE);
+ g_return_val_if_fail (GDAUI_IS_ENTRY_PICT (mgwrap), TRUE);
mgpict = GDAUI_ENTRY_PICT (mgwrap);
g_return_val_if_fail (mgpict->priv, TRUE);
diff --git a/libgda-ui/data-entries/plugins/gdaui-entry-text.c b/libgda-ui/data-entries/plugins/gdaui-entry-text.c
index a0285b7..5be6306 100644
--- a/libgda-ui/data-entries/plugins/gdaui-entry-text.c
+++ b/libgda-ui/data-entries/plugins/gdaui-entry-text.c
@@ -35,6 +35,7 @@ static void real_set_value (GdauiEntryWrapper *mgwrap, const GValue *value
static GValue *real_get_value (GdauiEntryWrapper *mgwrap);
static void connect_signals(GdauiEntryWrapper *mgwrap, GCallback modify_cb, GCallback activate_cb);
static gboolean expand_in_layout (GdauiEntryWrapper *mgwrap);
+static void set_editable (GdauiEntryWrapper *mgwrap, gboolean editable);
/* get a pointer to the parents to be able to call their destructor */
static GObjectClass *parent_class = NULL;
@@ -85,6 +86,7 @@ gdaui_entry_text_class_init (GdauiEntryTextClass * class)
GDAUI_ENTRY_WRAPPER_CLASS (class)->real_get_value = real_get_value;
GDAUI_ENTRY_WRAPPER_CLASS (class)->connect_signals = connect_signals;
GDAUI_ENTRY_WRAPPER_CLASS (class)->expand_in_layout = expand_in_layout;
+ GDAUI_ENTRY_WRAPPER_CLASS (class)->set_editable = set_editable;
}
static void
@@ -269,3 +271,14 @@ expand_in_layout (GdauiEntryWrapper *mgwrap)
{
return TRUE;
}
+
+static void
+set_editable (GdauiEntryWrapper *mgwrap, gboolean editable)
+{
+ GdauiEntryText *mgtxt;
+
+ g_return_if_fail (mgwrap && GDAUI_IS_ENTRY_TEXT (mgwrap));
+ mgtxt = GDAUI_ENTRY_TEXT (mgwrap);
+
+ gtk_widget_set_sensitive (mgtxt->priv->view, editable);
+}
diff --git a/libgda-ui/demos/Makefile.am b/libgda-ui/demos/Makefile.am
index 5074db4..80b9d2c 100644
--- a/libgda-ui/demos/Makefile.am
+++ b/libgda-ui/demos/Makefile.am
@@ -10,7 +10,8 @@ endif
## These should be in the order you want them to appear in the
## demo app, which means alphabetized by demo title, not filename
-demos = \
+demos = \
+ basic_form.c \
data_model_dir.c \
form.c \
form_rw.c \
@@ -29,7 +30,7 @@ demos = \
cloud.c \
combo.c
-demofiles = demo_db.db example_automatic_layout.xml
+demofiles = demo_db.db custom_layout.xml
AM_CPPFLAGS = \
-I$(top_srcdir) \
diff --git a/libgda-ui/demos/basic_form.c b/libgda-ui/demos/basic_form.c
new file mode 100644
index 0000000..1630efc
--- /dev/null
+++ b/libgda-ui/demos/basic_form.c
@@ -0,0 +1,83 @@
+/* Forms/Basic form
+ *
+ * The GdauiBasicForm widget allows the user to modify values
+ * stored in individual GdaHolder objects grouped in a GdaSet
+ */
+
+#include <libgda-ui/libgda-ui.h>
+#include "demo-common.h"
+
+static GtkWidget *window = NULL;
+
+GtkWidget *
+do_basic_form (GtkWidget *do_widget)
+{
+ if (!window) {
+ GtkWidget *vbox;
+ GtkWidget *label;
+ GtkWidget *form;
+
+ window = gtk_dialog_new_with_buttons ("GdauiBasicForm",
+ GTK_WINDOW (do_widget),
+ 0,
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_NONE,
+ NULL);
+
+ g_signal_connect (window, "response",
+ G_CALLBACK (gtk_widget_destroy), NULL);
+ g_signal_connect (window, "destroy",
+ G_CALLBACK (gtk_widget_destroyed), &window);
+
+ vbox = gtk_vbox_new (FALSE, 5);
+#if GTK_CHECK_VERSION(2,18,0)
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (window))),
+ vbox, TRUE, TRUE, 0);
+#else
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
+#endif
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
+
+ label = gtk_label_new ("This example shows 2 GdauiBasicForm widgets operating on the\n"
+ "same GdaSet. When a value is modified in one form, then it is\n"
+ "automatically updated in the other form.\n\n"
+ "Also the top form uses the default layout, while the bottom one\n"
+ "uses a custom (2 columns) layout.");
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+
+ /* Create the demo widget */
+ GdaSet *set;
+ gchar *filename;
+ set = gda_set_new_inline (3,
+ "a string", G_TYPE_STRING, "A string Value",
+ "an int", G_TYPE_INT, 12,
+ "a picture", GDA_TYPE_BINARY, NULL);
+ form = gdaui_basic_form_new (set);
+ gtk_box_pack_start (GTK_BOX (vbox), form, TRUE, TRUE, 0);
+
+ label = gtk_label_new ("2nd form is below:");
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+
+ form = gdaui_basic_form_new (set);
+ gtk_box_pack_start (GTK_BOX (vbox), form, TRUE, TRUE, 0);
+
+ filename = demo_find_file ("example_automatic_layout.xml", NULL);
+ gdaui_basic_form_set_layout_from_file (GDAUI_BASIC_FORM (form), filename, "simple");
+ g_free (filename);
+
+ g_object_unref (set);
+ }
+
+ gboolean visible;
+ g_object_get (G_OBJECT (window), "visible", &visible, NULL);
+ if (!visible)
+ gtk_widget_show_all (window);
+ else {
+ gtk_widget_destroy (window);
+ window = NULL;
+ }
+
+ return window;
+}
+
+
diff --git a/libgda-ui/demos/custom_layout.xml b/libgda-ui/demos/custom_layout.xml
new file mode 100644
index 0000000..742d129
--- /dev/null
+++ b/libgda-ui/demos/custom_layout.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gdaui_layouts>
+ <gdaui_form name="customers" container="hpaned">
+ <gdaui_section title="Summary">
+ <gdaui_column>
+ <gdaui_entry name="id"/>
+ <gdaui_entry name="name" label="Customer name"/>
+ <gdaui_entry name="comments" label="Comments" plugin="text"/>
+ <gdaui_entry name="total_orders" label="Total ordered" plugin="number:NB_DECIMALS=2;CURRENCY=â?¬"/>
+ </gdaui_column>
+ </gdaui_section>
+ <gdaui_section title="Photo">
+ <gdaui_column>
+ <gdaui_entry name="photo" plugin="picture"/>
+ </gdaui_column>
+ </gdaui_section>
+ </gdaui_form>
+
+ <gdaui_form name="products" container="columns">
+ <gdaui_column>
+ <gdaui_entry name="ref"/>
+ <gdaui_entry name="name" editable="true"/>
+ </gdaui_column>
+ <gdaui_column>
+ <gdaui_entry name="country"/>
+ <gdaui_entry name="city"/>
+ </gdaui_column>
+ </gdaui_form>
+
+ <gdaui_form>
+ <gdaui_box title="Orders">
+ <gdaui_notebook>
+ <gdaui_box>
+ <gdaui_placeholder id="current_orders"/>
+ <gdaui_placeholder id="past_orders"/>
+ </gdaui_box>
+ </gdaui_notebook>
+ </gdaui_box>
+ </gdaui_form>
+
+ <gdaui_form name="simple">
+ <gdaui_column>
+ <gdaui_entry name="a string" editable="no"/>
+ <gdaui_entry name="an int"/>
+ </gdaui_column>
+ <gdaui_column>
+ <gdaui_entry name="a picture" plugin="picture"/>
+ </gdaui_column>
+ </gdaui_form>
+
+
+ <gdaui_grid name="picture">
+ <gdaui_entry name="pict" plugin="picture"/>
+ </gdaui_grid>
+</gdaui_layouts>
diff --git a/libgda-ui/demos/demo_db.db b/libgda-ui/demos/demo_db.db
index ea5f08c..39f1592 100644
Binary files a/libgda-ui/demos/demo_db.db and b/libgda-ui/demos/demo_db.db differ
diff --git a/libgda-ui/demos/form_data_layout.c b/libgda-ui/demos/form_data_layout.c
index c58cda8..ec7a19e 100644
--- a/libgda-ui/demos/form_data_layout.c
+++ b/libgda-ui/demos/form_data_layout.c
@@ -1,7 +1,6 @@
-/* Forms/Automatic data_layout
+/* Forms/Custom layout
*
- * A GdauiForm widget where automatic 'data_layout' is used to display
- *
+ * A GdauiForm widget where the layout is customized
*/
#include <libgda-ui/libgda-ui.h>
@@ -23,7 +22,7 @@ do_form_data_layout (GtkWidget *do_widget)
GtkWidget *form;
GdauiRawForm *raw_form;
- window = gtk_dialog_new_with_buttons ("Form with automatic 'data_layout'",
+ window = gtk_dialog_new_with_buttons ("Form with custom data layout",
GTK_WINDOW (do_widget),
0,
GTK_STOCK_CLOSE,
@@ -44,34 +43,52 @@ do_form_data_layout (GtkWidget *do_widget)
#endif
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
- label = gtk_label_new ("The following GdauiForm widget displays data from the 'products' table.\n\n"
- "\n "
- ".");
+ label = gtk_label_new ("The following GdauiForm widget displays information about customers,\n"
+ "using a paned container where the right part is used to display\n"
+ "a picture of the customer.\n");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
- /* Create the demo widget */
+ /* Create the demo widget: select all the customers and computes the total amount of orders they have spent */
stmt = gda_sql_parser_parse_string (demo_parser,
- "SELECT ref, category, name, price, wh_stored FROM products",
+ "select c.id, c.name, c.country, c.city, c.photo, c.comments, sum (od.quantity * (1 - od.discount/100) * p.price) as total_orders from customers c left join orders o on (c.id=o.customer) left join order_contents od on (od.order_id=o.id) left join products p on (p.ref = od.product_ref) group by c.id order by total_orders desc",
NULL, NULL);
model = gda_connection_statement_execute_select (demo_cnc, stmt, NULL, NULL);
- g_object_unref (stmt)
-;
- GError *error = NULL;
- if (!gda_data_select_compute_modification_statements (GDA_DATA_SELECT (model), &error)) {
- g_print ("===> %s\n", error && error->message ? error->message : "No detail");
- }
+ g_object_unref (stmt);
form = gdaui_form_new (model);
g_object_unref (model);
+ /* hide the ID data entry */
g_object_get (G_OBJECT (form), "raw-form", &raw_form, NULL);
+ gdaui_basic_form_entry_set_visible (GDAUI_BASIC_FORM (raw_form),
+ gda_set_get_holder (gdaui_basic_form_get_data_set (GDAUI_BASIC_FORM (raw_form)),
+ "id"), FALSE);
+
+ /* request custom layout:
+ <gdaui_form name="customers" container="hpaned">
+ <gdaui_section title="Summary">
+ <gdaui_column>
+ <gdaui_entry name="id"/>
+ <gdaui_entry name="name" label="Customer name"/>
+ <gdaui_entry name="comments" label="Comments" plugin="text"/>
+ <gdaui_entry name="total_orders" label="Total ordered" plugin="number:NB_DECIMALS=2;CURRENCY=â?¬"/>
+ </gdaui_column>
+ </gdaui_section>
+ <gdaui_section title="Photo">
+ <gdaui_column>
+ <gdaui_entry name="photo" plugin="picture"/>
+ </gdaui_column>
+ </gdaui_section>
+ </gdaui_form>
+ */
gchar *filename;
- filename = demo_find_file ("example_automatic_layout.xml", NULL);
- gdaui_basic_form_set_data_layout_from_file (GDAUI_BASIC_FORM (raw_form), filename, "products");
+ filename = demo_find_file ("custom_layout.xml", NULL);
+ gdaui_basic_form_set_layout_from_file (GDAUI_BASIC_FORM (raw_form), filename, "customers");
g_free (filename);
- gtk_box_pack_start (GTK_BOX (vbox), form, TRUE, TRUE, 0);
+ /* we don't need the raw_form's reference anymore */
+ g_object_unref (G_OBJECT (raw_form));
- gtk_widget_set_size_request (window, 500, 500);
+ gtk_box_pack_start (GTK_BOX (vbox), form, TRUE, TRUE, 0);
}
gboolean visible;
diff --git a/libgda-ui/demos/grid_data_layout.c b/libgda-ui/demos/grid_data_layout.c
index c8f0891..3fa927a 100644
--- a/libgda-ui/demos/grid_data_layout.c
+++ b/libgda-ui/demos/grid_data_layout.c
@@ -1,6 +1,6 @@
-/* Grids/Automatic data_layout
+/* Grids/Custom layout
*
- * A GdauiGrid widget where automatic 'data_layout' is used to display
+ * A GdauiGrid widget where the layout is customized
*
*/
@@ -44,10 +44,7 @@ do_grid_data_layout (GtkWidget *do_widget)
#endif
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
- label = gtk_label_new ("The following GdauiGrid widget displays data from the 'products' table.\n\n"
- "\n"
- "\n"
- ".");
+ label = gtk_label_new ("The following GdauiGrid widget displays data from the 'products' table.\n.\n");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
/* Create the demo widget */
@@ -64,7 +61,7 @@ do_grid_data_layout (GtkWidget *do_widget)
/* data_set = GDA_SET (gdaui_data_widget_get_current_data (GDAUI_DATA_WIDGET (raw_grid))); */
/* param = gda_set_get_holder (data_set, "pict"); */
- /* value = gda_value_new_from_string ("data_layout", G_TYPE_STRING); */
+ /* value = gda_value_new_from_string ("data-layout", G_TYPE_STRING); */
/* gda_holder_set_attribute (param, GDAUI_ATTRIBUTE_PLUGIN, value); */
/* gda_value_free (value); */
//
@@ -72,7 +69,7 @@ do_grid_data_layout (GtkWidget *do_widget)
//d[0] = "./example_automatic_layout_full.xml";
//d[1] = "products";
- //g_object_set (G_OBJECT (raw_grid), "data_layout", d, NULL);
+ //g_object_set (G_OBJECT (raw_grid), "data-layout", d, NULL);
//
gchar *filename;
filename = demo_find_file ("example_automatic_layout.xml", NULL);
diff --git a/libgda-ui/demos/linked_grid_form.c b/libgda-ui/demos/linked_grid_form.c
index df1eb8f..4cae576 100644
--- a/libgda-ui/demos/linked_grid_form.c
+++ b/libgda-ui/demos/linked_grid_form.c
@@ -130,7 +130,7 @@ do_linked_grid_form (GtkWidget *do_widget)
/* restrict the c.default_served_by field in the grid to be within the sr_model */
restrict_default_served_by_field (GDAUI_DATA_SELECTOR (grid), sr_model, 0);
data->grid_iter = gdaui_data_selector_get_data_set (GDAUI_DATA_SELECTOR (grid));
- g_signal_connect (data->grid_iter, "row_changed",
+ g_signal_connect (data->grid_iter, "row-changed",
G_CALLBACK (iter_row_changed_cb), data);
/* create form widget which uses the same data model as the grid */
@@ -148,7 +148,7 @@ do_linked_grid_form (GtkWidget *do_widget)
/* restrict the c.default_served_by field in the form to be within the sr_model */
restrict_default_served_by_field (GDAUI_DATA_SELECTOR (form), sr_model, 0);
data->form_iter = gdaui_data_selector_get_data_set (GDAUI_DATA_SELECTOR (form));
- g_signal_connect (data->form_iter, "row_changed",
+ g_signal_connect (data->form_iter, "row-changed",
G_CALLBACK (iter_row_changed_cb), data);
g_object_unref (cust_model);
diff --git a/libgda-ui/demos/main.c b/libgda-ui/demos/main.c
index 7fea550..fb6102e 100644
--- a/libgda-ui/demos/main.c
+++ b/libgda-ui/demos/main.c
@@ -706,7 +706,7 @@ create_tree (void)
gtk_tree_selection_select_iter (GTK_TREE_SELECTION (selection), &iter);
g_signal_connect (selection, "changed", G_CALLBACK (selection_cb), model);
- g_signal_connect (tree_view, "row_activated", G_CALLBACK (row_activated_cb), model);
+ g_signal_connect (tree_view, "row-activated", G_CALLBACK (row_activated_cb), model);
gtk_tree_view_expand_all (GTK_TREE_VIEW (tree_view));
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
diff --git a/libgda-ui/gdaui-basic-form.c b/libgda-ui/gdaui-basic-form.c
index 8abaa02..406fa2e 100644
--- a/libgda-ui/gdaui-basic-form.c
+++ b/libgda-ui/gdaui-basic-form.c
@@ -33,6 +33,7 @@
#include <libgda-ui/gdaui-easy.h>
#include <libgda/binreloc/gda-binreloc.h>
+#define SPACING 3
static void gdaui_basic_form_class_init (GdauiBasicFormClass * class);
static void gdaui_basic_form_init (GdauiBasicForm *wid);
static void gdaui_basic_form_dispose (GObject *object);
@@ -46,8 +47,58 @@ static void gdaui_basic_form_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gdaui_basic_form_fill (GdauiBasicForm *form);
-static void gdaui_basic_form_clean (GdauiBasicForm *form);
+typedef struct {
+ GdaHolder *holder;
+ gulong signal_id;
+} SignalData;
+
+typedef enum {
+ PACKING_TABLE,
+} PackingType;
+
+typedef struct {
+ GtkWidget *table;
+ gint top;
+} PackingTable;
+
+typedef struct {
+ GdauiBasicForm *form;
+ GdauiDataEntry *entry; /* ref held here */
+ GtkWidget *label; /* ref held here */
+ gchar *label_title;
+ gboolean hidden;
+ gboolean not_null; /* TRUE if @entry's contents can't be NULL */
+ gboolean can_expand; /* tells if @entry can expand */
+
+ gulong entry_shown_id; /* signal ID */
+ gulong label_shown_id; /* signal ID */
+
+ gulong entry_contents_modified_id; /* signal ID */
+ gulong entry_contents_activated_id; /* signal ID */
+
+ GdaHolder *single_param;
+ SignalData single_signal;
+
+ GdauiSetGroup *group;
+ GArray *group_signals; /* array of SignalData */
+
+ /* entry packing function */
+ PackingType packing_type;
+ union {
+ PackingTable table;
+ } pack;
+
+} SingleEntry;
+static SingleEntry *get_single_entry_for_holder (GdauiBasicForm *form, GdaHolder *param);
+static SingleEntry *get_single_entry_for_id (GdauiBasicForm *form, const gchar *id);
+static void create_entry_widget (SingleEntry *sentry);
+static void create_entries (GdauiBasicForm *form);
+static void pack_entry_widget (SingleEntry *sentry);
+static void pack_entries_in_table (GdauiBasicForm *form);
+static void pack_entries_in_xml_layout (GdauiBasicForm *form, xmlNodePtr form_node);
+static void unpack_entries (GdauiBasicForm *form);
+static void destroy_entries (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);
@@ -56,9 +107,9 @@ static void paramlist_public_data_changed_cb (GdauiSet *paramlist, GdauiBasicFor
static void paramlist_param_attr_changed_cb (GdaSet *paramlist, GdaHolder *param,
const gchar *att_name, const GValue *att_value, GdauiBasicForm *form);
-static void entry_contents_modified (GdauiDataEntry *entry, GdauiBasicForm *form);
+static void entry_contents_modified (GdauiDataEntry *entry, SingleEntry *sentry);
static void entry_contents_activated (GdauiDataEntry *entry, GdauiBasicForm *form);
-static void parameter_changed_cb (GdaHolder *param, GdauiDataEntry *entry);
+static void parameter_changed_cb (GdaHolder *param, SingleEntry *sentry);
static void mark_not_null_entry_labels (GdauiBasicForm *form, gboolean show_mark);
enum {
@@ -71,7 +122,7 @@ enum {
/* properties */
enum {
PROP_0,
- PROP_DATA_LAYOUT,
+ PROP_XML_LAYOUT,
PROP_PARAMLIST,
PROP_HEADERS_SENSITIVE,
PROP_SHOW_ACTIONS,
@@ -79,25 +130,14 @@ enum {
PROP_CAN_EXPAND
};
-typedef struct {
- GdaHolder *holder;
- gulong signal_id;
-} SignalData;
-
struct _GdauiBasicFormPriv
{
GdaSet *set;
GdauiSet *set_info;
- 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 */
- gboolean can_expand; /* ORed among the data entrie's expand requests */
+ GSList *s_entries;/* list of SingleEntry pointers */
+ GHashTable *place_holders; /* key = place holder ID, value = a GtkWidget pointer */
- GtkWidget *entries_table;
- GtkWidget *entries_glade;
- GSList *hidden_entries;
- GtkScrolledWindow *scrolled_window; /* Window child. */
+ GtkWidget *top_container;
gboolean headers_sensitive;
gboolean forward_param_updates; /* forward them to the GdauiDataEntry widgets ? */
@@ -197,8 +237,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_DATA_LAYOUT,
- g_param_spec_pointer ("data-layout",
+ g_object_class_install_property (object_class, PROP_XML_LAYOUT,
+ g_param_spec_pointer ("xml-layout",
_("Pointer to an XML data layout specification"), NULL,
G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_PARAMLIST,
@@ -233,13 +273,9 @@ gdaui_basic_form_init (GdauiBasicForm * wid)
{
wid->priv = g_new0 (GdauiBasicFormPriv, 1);
wid->priv->set = NULL;
- wid->priv->entries = NULL;
- wid->priv->can_expand = FALSE;
- wid->priv->not_null_labels = NULL;
- wid->priv->entries_glade = NULL;
- wid->priv->entries_table = NULL;
- wid->priv->hidden_entries = NULL;
- wid->priv->signal_data = NULL;
+ wid->priv->s_entries = NULL;
+ wid->priv->place_holders = NULL;
+ wid->priv->top_container = NULL;
wid->priv->headers_sensitive = FALSE;
wid->priv->show_actions = FALSE;
@@ -248,8 +284,6 @@ gdaui_basic_form_init (GdauiBasicForm * wid)
wid->priv->forward_param_updates = TRUE;
}
-static void widget_shown_cb (GtkWidget *wid, GdauiBasicForm *form);
-
/**
* gdaui_basic_form_new
* @paramlist: a #GdaSet structure
@@ -274,12 +308,16 @@ gdaui_basic_form_new (GdaSet *paramlist)
}
static void
-widget_shown_cb (GtkWidget *wid, GdauiBasicForm *form)
+widget_shown_cb (GtkWidget *wid, SingleEntry *sentry)
{
- if (g_slist_find (form->priv->hidden_entries, wid)) {
- if (form->priv->entries_table && g_slist_find (form->priv->entries, wid)) {
- gint row = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (wid), "row_no"));
- gtk_table_set_row_spacing (GTK_TABLE (form->priv->entries_table), row, 0);
+ g_assert ((wid == (GtkWidget*) sentry->entry) || (wid == sentry->label));
+ if (sentry->hidden) {
+ GtkWidget *parent;
+ parent = gtk_widget_get_parent (wid);
+ if (parent && GTK_IS_TABLE (parent)) {
+ gint row;
+ gtk_container_child_get (GTK_CONTAINER (parent), wid, "top-attach", &row, NULL);
+ gtk_table_set_row_spacing (GTK_TABLE (parent), row, 0);
}
gtk_widget_hide (wid);
@@ -290,19 +328,9 @@ static void
get_rid_of_set (GdaSet *paramlist, GdauiBasicForm *form)
{
GSList *list;
- gint i;
g_assert (paramlist == form->priv->set);
- /* disconnect from parameters */
- for (i = 0; i < form->priv->signal_data->len; i++) {
- SignalData *sd = &(g_array_index (form->priv->signal_data, SignalData, i));
- g_signal_handler_disconnect (sd->holder, sd->signal_id);
- g_object_unref ((GObject*) sd->holder);
- }
- g_array_free (form->priv->signal_data, TRUE);
- form->priv->signal_data = NULL;
-
/* unref the paramlist */
g_signal_handlers_disconnect_by_func (form->priv->set_info,
G_CALLBACK (paramlist_public_data_changed_cb), form);
@@ -318,16 +346,17 @@ get_rid_of_set (GdaSet *paramlist, GdauiBasicForm *form)
}
/* render all the entries non sensitive */
- for (list = form->priv->entries; list; list = list->next)
- gdaui_data_entry_set_editable (GDAUI_DATA_ENTRY (list->data), FALSE);
+ for (list = form->priv->s_entries; list; list = list->next)
+ gdaui_data_entry_set_editable (GDAUI_DATA_ENTRY (((SingleEntry*)list->data)->entry), FALSE);
}
static void
paramlist_public_data_changed_cb (GdauiSet *paramlist, GdauiBasicForm *form)
{
/* here we want to re-define all the data entry widgets */
- gdaui_basic_form_clean (form);
- gdaui_basic_form_fill (form);
+ destroy_entries (form);
+ create_entries (form);
+ pack_entries_in_table (form);
g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[LAYOUT_CHANGED], 0);
}
@@ -335,10 +364,14 @@ static void
paramlist_param_attr_changed_cb (GdaSet *paramlist, GdaHolder *param,
const gchar *att_name, const GValue *att_value, GdauiBasicForm *form)
{
- GtkWidget *entry;
+ SingleEntry *sentry;
+
+ sentry = get_single_entry_for_holder (form, param);
if (!strcmp (att_name, GDA_ATTRIBUTE_IS_DEFAULT)) {
- entry = gdaui_basic_form_get_entry_widget (form, param);
+ GtkWidget *entry = NULL;
+ if (sentry)
+ entry = (GtkWidget*) sentry->entry;
if (entry) {
guint attrs = 0;
guint mask = 0;
@@ -360,36 +393,24 @@ paramlist_param_attr_changed_cb (GdaSet *paramlist, GdaHolder *param,
}
g_signal_handlers_block_by_func (G_OBJECT (entry),
- G_CALLBACK (entry_contents_modified), form);
+ G_CALLBACK (entry_contents_modified), sentry);
gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (entry), attrs, mask);
g_signal_handlers_unblock_by_func (G_OBJECT (entry),
- G_CALLBACK (entry_contents_modified), form);
+ G_CALLBACK (entry_contents_modified), sentry);
}
}
else if (!strcmp (att_name, GDAUI_ATTRIBUTE_PLUGIN)) {
- /* TODO: be more specific and change only the cell renderer corresponding to @param */
-
- /* keep a list of hidden columns */
- GSList *list, *hidden_params = NULL;
- for (list = form->priv->hidden_entries; list; list = list->next) {
- GdaHolder *param = g_object_get_data (G_OBJECT (list->data), "param");
- if (param)
- hidden_params = g_slist_prepend (hidden_params, param);
- else {
- /* multiple parameters, take the 1st param */
- GdauiSetGroup *group;
- group = g_object_get_data (G_OBJECT (list->data), "__gdaui_group");
- hidden_params = g_slist_prepend (hidden_params, GDA_SET_NODE (group->group->nodes->data)->holder);
- }
+ if (sentry) {
+ /* recreate an entry widget */
+ create_entry_widget (sentry);
+ gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (sentry->entry),
+ form->priv->show_actions ? GDA_VALUE_ATTR_ACTIONS_SHOWN : 0,
+ GDA_VALUE_ATTR_ACTIONS_SHOWN);
+ pack_entry_widget (sentry);
+ gdaui_basic_form_entry_set_visible (form, param, !sentry->hidden);
}
-
- /* re-create entries */
- paramlist_public_data_changed_cb (form->priv->set_info, form);
-
- /* hide entries which were hidden */
- for (list = hidden_params; list; list = list->next)
- gdaui_basic_form_entry_set_visible (form, GDA_HOLDER (list->data), FALSE);
- g_slist_free (hidden_params);
+ else
+ paramlist_public_data_changed_cb (form->priv->set_info, form);
}
}
@@ -407,7 +428,7 @@ gdaui_basic_form_dispose (GObject *object)
if (form->priv->set)
get_rid_of_set (form->priv->set, form);
- gdaui_basic_form_clean (form);
+ destroy_entries (form);
/* the private area itself */
g_free (form->priv);
@@ -418,756 +439,6 @@ gdaui_basic_form_dispose (GObject *object)
parent_class->dispose (object);
}
-static void
-load_xml_data_layout_button (GdauiBasicForm *form,
- xmlNodePtr node,
- gpointer data)
-{
- g_print ("%s:\n", __func__);
- g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
- g_return_if_fail (data && GTK_IS_TABLE(data));
-
- gchar *title = NULL;
- gchar *script = NULL;
- gint sequence = 0;
-
- xmlChar *str;
- str = xmlGetProp (node, BAD_CAST "title");
- if (str) {
- title = g_strdup ((gchar*) str);
- g_print ("title: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "script");
- if (str) {
- script = g_strdup ((gchar*) str);
- g_print ("script: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "sequence");
- if (str) {
- sequence = atoi ((gchar*) str);
- g_print ("sequence: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- GtkButton *button = (GtkButton *) gtk_button_new_with_mnemonic (title);
- gtk_widget_show (GTK_WIDGET(button));
-
- 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;
-
- gtk_table_attach (GTK_TABLE(data), GTK_WIDGET(button),
- col, col + 2, row, row + 1,
- (GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
- (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), 0, 0);
-
- xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "script")) {
- // load_data_layout_button_script (table, child);
- }
- }
-
- g_free (script);
-}
-
-static void
-load_xml_data_layout_item (GdauiBasicForm *form,
- xmlNodePtr node,
- gpointer data)
-{
- g_print ("%s:\n", __func__);
- g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
- g_return_if_fail (data && GTK_IS_TABLE(data));
-
- gchar *name = NULL;
- gint sequence = 0;
- gboolean editable = FALSE;
- gboolean sort_ascending = FALSE;
-
- xmlChar *str;
- str = xmlGetProp (node, BAD_CAST "name");
- if (str) {
- name = g_strdup ((gchar*) str);
- g_print ("name: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- /* str = xmlGetProp (node, "relationship"); */
- /* if (str) { */
- /* g_print ("relationship: %s\n", str); */
- /* xmlFree (str); */
- /* } */
-
- /* str = xmlGetProp (node, "related_relationship"); */
- /* if (str) { */
- /* g_print ("related_relationship: %s\n", str); */
- /* xmlFree (str); */
- /* } */
-
- str = xmlGetProp (node, BAD_CAST "sequence");
- if (str) {
- sequence = atoi ((gchar*) str);
- g_print ("sequence: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "editable");
- if (str) {
- editable = (*str == 't' || *str == 'T') ? TRUE : FALSE;
- g_print ("editable: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "sort_ascending");
- if (str) {
- sort_ascending = (*str == 't' || *str == 'T') ? TRUE : FALSE;
- g_print ("sort_ascending: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- /* GSList *slist = form->priv->set->holders; */
- /* while (slist != NULL) { */
- /* GdaHolder *holder = slist->data; */
- /* g_print ("SET HOLDER=%s\n", gda_holder_get_id (holder)); */
- /* slist = g_slist_next (slist); */
- /* } */
-
- 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;
-
- GdaHolder *holder = gda_set_get_holder (form->priv->set, name);
- g_return_if_fail (holder != NULL);
-
- /* const gchar *id = gda_holder_get_id (holder); */
-
- /* const gchar *text; */
- /* const GValue *value = gda_holder_get_attribute (holder, GDA_ATTRIBUTE_DESCRIPTION); */
- /* if (value != NULL && G_VALUE_HOLDS(value, G_TYPE_STRING)) */
- /* text = g_value_get_string (value); */
- /* else */
- /* text = id; */
- const gchar *text = NULL;
- if (GDAUI_IS_DATA_SELECTOR (form)) {
- GdaDataModel *model = gdaui_data_selector_get_model (GDAUI_DATA_SELECTOR (form));
- if (model && GDA_IS_DATA_SELECT (model))
- text = gda_utility_data_model_find_column_description (GDA_DATA_SELECT (model), name);
- }
- if (! text)
- text = gda_holder_get_id (holder);
-
- GtkLabel *label = GTK_LABEL(gtk_label_new (text));
- gtk_widget_show (GTK_WIDGET(label));
- gtk_table_attach (GTK_TABLE(data), GTK_WIDGET(label),
- col, col + 1, row, row + 1,
- (GtkAttachOptions) GTK_FILL,
- (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), 0, 0);
- gtk_misc_set_alignment (GTK_MISC(label), 0, /* 0 */ 0.5);
-
- GtkAlignment *alignment = GTK_ALIGNMENT (gtk_alignment_new (0.5, 0.5, 1, 1));
- gtk_widget_show (GTK_WIDGET (alignment));
- gtk_table_attach (GTK_TABLE (data), GTK_WIDGET (alignment),
- col + 1, col + 2, row, row + 1,
- (GtkAttachOptions) (GTK_EXPAND|GTK_FILL),
- (GtkAttachOptions) (GTK_EXPAND|GTK_FILL), 0, 0);
- gtk_alignment_set_padding (GTK_ALIGNMENT(alignment), 0, 0, 12, 0);
-
- GtkHBox *hbox = GTK_HBOX (gtk_hbox_new (FALSE, /* 0 */ 6));
- gtk_widget_show (GTK_WIDGET (hbox));
- gtk_container_add (GTK_CONTAINER (alignment), GTK_WIDGET (hbox));
-
- // name hbox (both name and id are equals)
- gtk_widget_set_name (GTK_WIDGET (hbox), name);
-
- g_free (name);
-
- xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
-
- /* if (child->type == XML_ELEMENT_NODE && */
- /* !xmlStrcmp (child->name, (const xmlChar *) "formatting")) { */
- /* } */
-
- /* if (child->type == XML_ELEMENT_NODE && */
- /* !xmlStrcmp (child->name, (const xmlChar *) "title_custom")) { */
- /* } */
- }
-}
-
-static gint
-count_items (xmlNodePtr node)
-{
- gint n = 0;
-
- g_return_val_if_fail (node->type == XML_ELEMENT_NODE &&
- (!xmlStrcmp (node->name, (const xmlChar *) "data_layout_group") ||
- !xmlStrcmp (node->name, (const xmlChar *) "data_layout_portal") ||
- !xmlStrcmp (node->name, (const xmlChar *) "data_layout_notebook")), -1);
-
- if (node->children) {
- xmlNodePtr child;
- child = node->children;
- while (child) {
- if (child->type == XML_ELEMENT_NODE &&
- (!xmlStrcmp (child->name, (const xmlChar *) "data_layout_group") ||
- !xmlStrcmp (child->name, (const xmlChar *) "data_layout_item") ||
- !xmlStrcmp (child->name, (const xmlChar *) "data_layout_portal") ||
- !xmlStrcmp (node->name, (const xmlChar *) "data_layout_notebook") ||
- !xmlStrcmp (child->name, (const xmlChar *) "data_layout_button"))) {
- n++;
- }
- child = child->next;
- }
- }
-
- return n;
-}
-
-static void
-load_xml_data_layout_portal (GdauiBasicForm *form,
- xmlNodePtr node,
- gpointer data)
-{
- g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
-
- gchar *name = NULL;
- gchar *relationship = NULL;
- gint sequence = 0;
- gboolean hidden = FALSE;
- gint columns_count = 1;
-
- xmlChar *str;
- str = xmlGetProp (node, BAD_CAST "name");
- if (str) {
- name = g_strdup ((gchar*) str);
- g_print ("name: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "relationship");
- if (str) {
- relationship = g_strdup ((gchar*) str);
- g_print ("relationship: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "sequence");
- if (str) {
- sequence = atoi ((gchar*) str);
- g_print ("sequence: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "hidden");
- if (str) {
- hidden = *str == 't' || *str == 'T' ? TRUE : FALSE;
- g_print ("hidden: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "columns_count");
- if (str) {
- columns_count = atoi ((gchar*) str);
- g_print ("columns_count: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- GtkWidget *vbox;
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (vbox);
-
- 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;
-
- gtk_table_attach (GTK_TABLE (data), vbox,
- col, col + 2, row, row + 1,
- (GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
- (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), 0, 0);
-
- gtk_widget_set_name (vbox, name);
-
- if (!xmlStrcmp (node->parent->name, BAD_CAST "data_layout_group")) {
-
-
- 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;
-
- gtk_table_attach (GTK_TABLE(data), GTK_WIDGET(vbox),
- 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")) {
-
- 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_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);
-}
-
-static void
-load_xml_data_layout_group (GdauiBasicForm *form,
- xmlNodePtr node,
- gpointer data);
-
-static void
-load_xml_data_layout_notebook (GdauiBasicForm *form,
- xmlNodePtr node,
- gpointer data)
-{
- g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
-
- gchar *name = NULL;
- gint sequence = 0;
- gchar *title = NULL;
-
- xmlChar *str;
- str = xmlGetProp (node, BAD_CAST "name");
- if (str) {
- g_print ("name: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "title");
- if (str) {
- g_print ("title: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "sequence");
- if (str) {
- sequence = atoi ((gchar*) str);
- g_print ("sequence: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "columns_count");
- if (str) {
- g_print ("columns_count: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- /* GtkLabel *label; */
- /* gchar *markup = g_strdup_printf ("<b>%s</b>", (title != NULL) ? title : ""); */
- /* label = GTK_LABEL(gtk_label_new (markup)); */
- /* g_free (markup); */
- /* gtk_widget_show (GTK_WIDGET(label)); */
- /* gtk_label_set_use_markup (label, TRUE); */
-
- GtkWidget *notebook;
- notebook = gtk_notebook_new ();
- gtk_widget_show (notebook);
-
- 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;
-
- gtk_table_attach (GTK_TABLE(data), notebook,
- col, col + 2, row, row + 1,
- (GtkAttachOptions) (GTK_FILL|GTK_EXPAND),
- (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), 0, 0);
-
- xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, (const xmlChar *) "data_layout_group")) {
- load_xml_data_layout_group (form, child, /* data */ notebook);
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, (const xmlChar *) "data_layout_portal")) {
- load_xml_data_layout_portal (form, child, /* data */ notebook);
- }
- }
-
- g_free (name);
- g_free (title);
-}
-
-static void
-load_xml_data_layout_group (GdauiBasicForm *form,
- xmlNodePtr node,
- gpointer data)
-{
- g_print ("%s:\n", __func__);
- g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
- g_return_if_fail (form->priv->scrolled_window != NULL);
-
- gchar *name = NULL;
- gint sequence = 0;
- gint columns_count = 1;
- gchar *title = NULL;
-
- xmlChar *str;
- str = xmlGetProp (node, BAD_CAST "name");
- if (str) {
- name = g_strdup ((gchar*) str);
- g_print ("name: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "sequence");
- if (str) {
- sequence = atoi ((gchar*) str);
- g_print ("sequence: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "columns_count");
- if (str) {
- columns_count = atoi ((gchar*) str);
- g_print ("columns_count: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "title");
- if (str) {
- title = g_strdup ((gchar*) str);
- g_print ("title: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- GtkLabel *label;
- label = GTK_LABEL(gtk_label_new (NULL));
- gtk_widget_show (GTK_WIDGET(label));
-
- gint n = count_items (node);
-
- gint cols, rows;
- cols = 2 * columns_count;
- rows = n / columns_count + n % columns_count;
-
- GtkTable *table;
- table = GTK_TABLE(gtk_table_new (rows, cols, FALSE));
- gtk_widget_show (GTK_WIDGET(table));
-
- gtk_container_set_border_width (GTK_CONTAINER(table), 6);
- gtk_table_set_row_spacings (table, 3);
- gtk_table_set_col_spacings (table, 3);
-
- if (!xmlStrcmp (node->parent->name, BAD_CAST "data_layout_groups")) {
-
- 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);
-
- 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);
-
- gtk_frame_set_label_widget (frame, GTK_WIDGET(label));
-
-
- gtk_box_pack_start (GTK_BOX(data), GTK_WIDGET(frame), FALSE, TRUE, 0);
- } else
- 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);
-
- 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));
-
- 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));
-
-
- 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;
-
- 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);
-
- 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));
- }
-
- xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_group")) {
- load_xml_data_layout_group (form, child, /* data */ table);
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_item")) {
- load_xml_data_layout_item (form, child, /* data */ table);
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_portal")) {
- load_xml_data_layout_portal (form, child, /* data */ table);
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_notebook")) {
- load_xml_data_layout_notebook (form, child, /* data */ table);
- }
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "trans_set")) {
- /* load_data_layout_group_trans_set (form, child, data); */
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_button")) {
- load_xml_data_layout_button (form, child, /* data */ table);
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_item_groupby")) {
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_item_header")) {
- }
- }
-
- g_free (name);
- g_free (title);
-}
-
-static void
-load_xml_data_layout_groups (GdauiBasicForm *form,
- xmlNodePtr node,
- gpointer data)
-{
- g_print ("%s:\n", __func__);
- g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
- g_return_if_fail (form->priv->scrolled_window == NULL);
-
- form->priv->scrolled_window = GTK_SCROLLED_WINDOW
- (gtk_scrolled_window_new (NULL, NULL));
- gtk_scrolled_window_set_policy (form->priv->scrolled_window,
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_container_border_width (GTK_CONTAINER(form->priv->scrolled_window), 6);
- gtk_widget_show (GTK_WIDGET(form->priv->scrolled_window));
-
- GtkVBox *vbox = GTK_VBOX(gtk_vbox_new (FALSE, 0));
- gtk_widget_show (GTK_WIDGET(vbox));
-
- gtk_scrolled_window_add_with_viewport (form->priv->scrolled_window,
- (GtkWidget *) vbox);
-
- xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_group")) {
- load_xml_data_layout_group (form, child, /* data */ vbox);
- }
- }
-
-}
-
-static void
-load_xml_data_layout (GdauiBasicForm *form,
- xmlNodePtr node,
- gpointer data)
-{
- g_print ("%s:\n", __func__);
- g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
-
- gchar *parent_table = NULL;
- gchar *name = NULL;
-
- xmlChar *str;
- str = xmlGetProp (node, BAD_CAST "parent_table");
- if (str) {
- parent_table = g_strdup ((gchar*) str);
- g_print ("parent_table: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- str = xmlGetProp (node, BAD_CAST "name");
- if (str) {
- name = g_strdup ((gchar*) str);
- g_print ("name: %s\n", (gchar*) str);
- xmlFree (str);
- }
-
- // Don't recurse unnecessarily
- gboolean retval = FALSE;
- if (strcmp ((const gchar *) data, parent_table) != 0 ||
- strcmp ("details", name) != 0) {
- retval = TRUE;
- }
- g_free (parent_table);
- g_free (name);
- if (retval)
- return;
-
- xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_groups")) {
- load_xml_data_layout_groups (form, child, data);
- }
- }
-
-}
-
-static void
-load_xml_data_layouts (GdauiBasicForm *form, xmlNodePtr node, gpointer data)
-{
- g_print ("%s:\n", __func__);
- g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
-
- xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout")) {
- load_xml_data_layout (form, child, data);
- }
- }
-}
-
-/* static void */
-/* load_xml_table (GdauiBasicForm *form, */
-/* xmlNodePtr node, */
-/* gpointer data) */
-/* { */
-/* g_print ("%s:\n", __func__); */
-
-/* xmlChar *str; */
-/* str = xmlGetProp (node, "name"); */
-/* if (str) { */
-/* g_print ("name: %s\n", str); */
-/* xmlFree (str); */
-/* } */
-
-/* /\* str = xmlGetProp (node, "title"); *\/ */
-/* /\* if (str) { *\/ */
-/* /\* g_print ("title: %s\n", str); *\/ */
-/* /\* xmlFree (str); *\/ */
-/* /\* } *\/ */
-
-/* /\* str = xmlGetProp (node, "hidden"); *\/ */
-/* /\* if (str) { *\/ */
-/* /\* g_print ("hidden: %s\n", str); *\/ */
-/* /\* xmlFree (str); *\/ */
-/* /\* } *\/ */
-
-/* /\* str = xmlGetProp (node, "default"); *\/ */
-/* /\* if (str) { *\/ */
-/* /\* g_print ("default: %s\n", str); *\/ */
-/* /\* xmlFree (str); *\/ */
-/* /\* } *\/ */
-
-/* xmlNodePtr child; */
-/* for (child = node->children; child != NULL; child = child->next) { */
-
-/* /\* if (child->type == XML_ELEMENT_NODE && *\/ */
-/* /\* !xmlStrcmp (child->name, BAD_CAST "fields")) { *\/ */
-
-/* /\* load_xml_fields (table, child, data); *\/ */
-/* /\* } *\/ */
-
-/* /\* if (child->type == XML_ELEMENT_NODE && *\/ */
-/* /\* !xmlStrcmp (child->name, BAD_CAST "relationships")) { *\/ */
-
-/* /\* load_xml_relationships (table, child, data); *\/ */
-/* /\* } *\/ */
-
-/* if (child->type == XML_ELEMENT_NODE && */
-/* !xmlStrcmp (child->name, BAD_CAST "data_layouts")) { */
-
-/* load_xml_data_layouts (form, child, data); */
-/* } */
-
-/* /\* if (child->type == XML_ELEMENT_NODE && *\/ */
-/* /\* !xmlStrcmp (child->name, BAD_CAST "reports")) { *\/ */
-
-/* /\* load_xml_reports (table, child, data); *\/ */
-/* /\* } *\/ */
-
-/* /\* if (child->type == XML_ELEMENT_NODE && *\/ */
-/* /\* !xmlStrcmp (child->name, BAD_CAST "trans_set")) { *\/ */
-
-/* /\* load_xml_table_trans_set (table, child, data); *\/ */
-/* /\* } *\/ */
-/* } */
-
-/* } */
static void
gdaui_basic_form_set_property (GObject *object,
@@ -1180,31 +451,25 @@ gdaui_basic_form_set_property (GObject *object,
form = GDAUI_BASIC_FORM (object);
if (form->priv) {
switch (param_id) {
- case PROP_DATA_LAYOUT: {
+ case PROP_XML_LAYOUT: {
+ /* node should be a "gdaui_form" node */
xmlNodePtr node = g_value_get_pointer (value);
-
- gdaui_basic_form_clean (form);
-
- xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
+ if (node) {
+ g_return_if_fail (node);
+ g_return_if_fail (!strcmp ((gchar*) node->name, "gdaui_form"));
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_groups")) {
- load_xml_data_layout_groups (form, child, NULL);
- }
+ pack_entries_in_xml_layout (form, node);
}
-
- if (form->priv->scrolled_window != NULL) {
- g_print ("Loaded XML file, reinit interface\n");
- }
- gdaui_basic_form_fill (form);
+ else
+ pack_entries_in_table (form);
+
g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[LAYOUT_CHANGED], 0);
break;
}
case PROP_PARAMLIST:
if (form->priv->set) {
get_rid_of_set (form->priv->set, form);
- gdaui_basic_form_clean (form);
+ destroy_entries (form);
}
form->priv->set = g_value_get_pointer (value);
@@ -1214,12 +479,13 @@ gdaui_basic_form_set_property (GObject *object,
g_object_ref (form->priv->set);
form->priv->set_info = _gdaui_set_new (GDA_SET (form->priv->set));
- g_signal_connect (form->priv->set_info, "public_data_changed",
+ g_signal_connect (form->priv->set_info, "public-data-changed",
G_CALLBACK (paramlist_public_data_changed_cb), form);
g_signal_connect (form->priv->set, "holder-attr-changed",
G_CALLBACK (paramlist_param_attr_changed_cb), form);
- gdaui_basic_form_fill (form);
+ create_entries (form);
+ pack_entries_in_table (form);
g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[LAYOUT_CHANGED], 0);
}
break;
@@ -1227,10 +493,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);
@@ -1262,9 +528,18 @@ gdaui_basic_form_get_property (GObject *object,
case PROP_ENTRIES_AUTO_DEFAULT:
g_value_set_boolean (value, form->priv->entries_auto_default);
break;
- case PROP_CAN_EXPAND:
- g_value_set_boolean (value, form->priv->can_expand);
+ case PROP_CAN_EXPAND: {
+ gboolean can_expand = FALSE;
+ GSList *list;
+ for (list = form->priv->s_entries; list; list = list->next) {
+ if (((SingleEntry*) list->data)->can_expand) {
+ can_expand = TRUE;
+ break;
+ }
+ }
+ g_value_set_boolean (value, can_expand);
break;
+ }
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
break;
@@ -1273,387 +548,630 @@ gdaui_basic_form_get_property (GObject *object,
}
static void
-gdaui_basic_form_clean (GdauiBasicForm *form)
+disconnect_single_entry_signals (SingleEntry *sentry)
{
- if (form->priv->set && form->priv->signal_data) {
+ if (sentry->entry)
+ g_signal_handler_disconnect (sentry->entry, sentry->entry_contents_modified_id);
+ sentry->entry_contents_modified_id = 0;
+ if (sentry->entry)
+ g_signal_handler_disconnect (sentry->entry, sentry->entry_contents_activated_id);
+ sentry->entry_contents_activated_id = 0;
+
+ if (sentry->single_signal.signal_id > 0) {
+ SignalData *sd = &(sentry->single_signal);
+ g_signal_handler_disconnect (sd->holder, sd->signal_id);
+ g_object_unref ((GObject*) sd->holder);
+ sd->signal_id = 0;
+ sd->holder = NULL;
+ }
+ if (sentry->group_signals) {
gint i;
- for (i = 0; i < form->priv->signal_data->len; i++) {
- SignalData *sd = &(g_array_index (form->priv->signal_data, SignalData, i));
- g_signal_handler_disconnect (sd->holder, sd->signal_id);
- g_object_unref ((GObject*) sd->holder);
+ for (i = 0; i < sentry->group_signals->len; i++) {
+ SignalData sd = g_array_index (sentry->group_signals, SignalData,
+ i);
+ g_signal_handler_disconnect (sd.holder, sd.signal_id);
+ g_object_unref ((GObject*) sd.holder);
}
- g_array_free (form->priv->signal_data, TRUE);
- form->priv->signal_data = NULL;
+ g_array_free (sentry->group_signals, TRUE);
+ sentry->group_signals = NULL;
}
+}
- /* destroy all the widgets */
- while (form->priv->entries)
- /* destroy any remaining widget */
- gtk_widget_destroy (GTK_WIDGET (form->priv->entries->data));
-
- if (form->priv->entries_table) {
- gtk_widget_destroy (form->priv->entries_table);
- form->priv->entries_table = NULL;
- }
- if (form->priv->entries_glade) {
- gtk_widget_destroy (form->priv->entries_glade);
- form->priv->entries_glade = NULL;
- }
-
- g_slist_free (form->priv->not_null_labels);
- form->priv->not_null_labels = NULL;
-
- g_slist_free (form->priv->hidden_entries);
- form->priv->hidden_entries = NULL;
-
- if (form->priv->scrolled_window) {
- gtk_widget_destroy (GTK_WIDGET(form->priv->scrolled_window));
- form->priv->scrolled_window = NULL;
+/*
+ * unpack_entries
+ *
+ * Remove entries from the GTK container in which they are
+ */
+static void
+unpack_entries (GdauiBasicForm *form)
+{
+ GSList *list;
+ for (list = form->priv->s_entries; list; list = list->next) {
+ SingleEntry *sentry = (SingleEntry *) list->data;
+ if (sentry->entry) {
+ GtkWidget *parent;
+ parent = gtk_widget_get_parent ((GtkWidget*) sentry->entry);
+ if (parent)
+ gtk_container_remove (GTK_CONTAINER (parent), (GtkWidget*) sentry->entry);
+ }
+ if (sentry->label) {
+ GtkWidget *parent;
+ parent = gtk_widget_get_parent (sentry->label);
+ if (parent)
+ gtk_container_remove (GTK_CONTAINER (parent), sentry->label);
+ }
}
}
-static void entry_destroyed_cb (GtkWidget *entry, GdauiBasicForm *form);
-static void label_destroyed_cb (GtkWidget *label, GdauiBasicForm *form);
-
static void
-find_hbox (GtkWidget *widget,
- gpointer data)
+destroy_entries (GdauiBasicForm *form)
{
- gpointer *d = data;
+ /* destroy all the widgets */
+ if (form->priv->s_entries) {
+ GSList *list;
+ for (list = form->priv->s_entries; list; list = list->next) {
+ SingleEntry *sentry = (SingleEntry *) list->data;
- if (GTK_IS_CONTAINER(widget)) {
- const gchar *name = gtk_widget_get_name (widget);
- if (GTK_IS_HBOX(widget) &&
- strcmp (name, (gchar *) *d) == 0)
- *(++d) = widget;
- else
- gtk_container_foreach (GTK_CONTAINER(widget),
- (GtkCallback) find_hbox, data);
+ disconnect_single_entry_signals (sentry);
+
+ g_object_unref ((GObject *) sentry->entry);
+ g_object_unref ((GObject *) sentry->label);
+ g_free (sentry->label_title);
+ g_free (sentry);
+ }
+ g_slist_free (form->priv->s_entries);
+ form->priv->s_entries = NULL;
+ }
+
+ if (form->priv->top_container) {
+ gtk_widget_destroy (form->priv->top_container);
+ form->priv->top_container = NULL;
+ if (form->priv->place_holders) {
+ g_hash_table_destroy (form->priv->place_holders);
+ form->priv->place_holders = NULL;
+ }
}
}
-/*
- * create the entries in the widget
- */
static void
-gdaui_basic_form_fill (GdauiBasicForm *form)
+create_entry_widget (SingleEntry *sentry)
{
- GSList *list;
- gboolean form_expand = FALSE;
+ GdauiSetGroup *group;
+ GtkWidget *entry;
+ gboolean editable = TRUE;
+
+ disconnect_single_entry_signals (sentry);
+ if (sentry->entry) {
+ GtkWidget *parent;
+ parent = gtk_widget_get_parent ((GtkWidget*) sentry->entry);
+ if (parent)
+ gtk_container_remove (GTK_CONTAINER (parent), (GtkWidget*) sentry->entry);
+
+ if (sentry->entry_shown_id) {
+ g_signal_handler_disconnect (sentry->entry, sentry->entry_shown_id);
+ sentry->entry_shown_id = 0;
+ }
- /* parameters list management */
- if (!form->priv->set || !form->priv->set_info->groups_list)
- /* nothing to do */
- return;
+ editable = gdaui_data_entry_get_editable (sentry->entry);
+ g_object_unref ((GObject *) sentry->entry);
+ sentry->entry = NULL;
+ }
+ if (sentry->label) {
+ GtkWidget *parent;
+ parent = gtk_widget_get_parent (sentry->label);
+ if (parent)
+ gtk_container_remove (GTK_CONTAINER (parent), sentry->label);
+
+ if (sentry->label_shown_id) {
+ g_signal_handler_disconnect (sentry->label, sentry->label_shown_id);
+ sentry->label_shown_id = 0;
+ }
- /* allocating space for the signal ids and connect to the parameter's changes */
- form->priv->signal_data = g_array_sized_new (FALSE, TRUE, sizeof (SignalData),
- g_slist_length (form->priv->set->holders));
+ g_object_unref ((GObject *) sentry->label);
+ sentry->label = NULL;
+ }
- /* creating all the data entries, and putting them into the form->priv->entries list */
- for (list = form->priv->set_info->groups_list; list; list = list->next) {
- GdauiSetGroup *group;
- GtkWidget *entry = NULL;
+ group = sentry->group;
+ if (! group->group->nodes_source) {
+ /* there is only one non-constrained parameter */
+ GdaHolder *param;
+ GType type;
+ const GValue *val, *default_val, *value;
+ gboolean nnul;
+ const gchar *plugin = NULL;
+ const GValue *plugin_val;
- group = GDAUI_SET_GROUP (list->data);
- if (! group->group->nodes_source) {
- /* there is only one non-constrained parameter */
- GdaHolder *param;
- GType type;
- const GValue *val, *default_val, *value;
- gboolean nnul;
- const gchar *plugin = NULL;
- const GValue *plugin_val;
-
- g_assert (g_slist_length (group->group->nodes) == 1);
-
- param = GDA_HOLDER (GDA_SET_NODE (group->group->nodes->data)->holder);
-
- val = gda_holder_get_value (param);
- default_val = gda_holder_get_default_value (param);
- nnul = gda_holder_get_not_null (param);
-
- /* determine initial value */
- type = gda_holder_get_g_type (param);
- value = val;
- if (!value && default_val &&
- (G_VALUE_TYPE ((GValue *) default_val) == type))
- value = default_val;
-
- /* create entry */
- plugin_val = gda_holder_get_attribute (param, GDAUI_ATTRIBUTE_PLUGIN);
- if (plugin_val) {
- if (G_VALUE_TYPE (plugin_val) == G_TYPE_STRING)
- plugin = g_value_get_string (plugin_val);
- else
- g_warning (_("The '%s' attribute should be a G_TYPE_STRING value"),
- GDAUI_ATTRIBUTE_PLUGIN);
- }
- entry = GTK_WIDGET (gdaui_new_data_entry (type, plugin));
+ g_assert (! group->group->nodes->next); /* only 1 item in the list */
- /* set current value */
- gdaui_data_entry_set_value (GDAUI_DATA_ENTRY (entry), val);
+ param = GDA_HOLDER (GDA_SET_NODE (group->group->nodes->data)->holder);
+ sentry->single_param = param;
+
+ val = gda_holder_get_value (param);
+ default_val = gda_holder_get_default_value (param);
+ nnul = gda_holder_get_not_null (param);
+ sentry->not_null = nnul;
+
+ /* determine initial value */
+ type = gda_holder_get_g_type (param);
+ value = val;
+ if (!value && default_val &&
+ (G_VALUE_TYPE ((GValue *) default_val) == type))
+ value = default_val;
+
+ /* create entry */
+ plugin_val = gda_holder_get_attribute (param, GDAUI_ATTRIBUTE_PLUGIN);
+ if (plugin_val) {
+ if (G_VALUE_TYPE (plugin_val) == G_TYPE_STRING)
+ plugin = g_value_get_string (plugin_val);
+ else
+ g_warning (_("The '%s' attribute should be a G_TYPE_STRING value"),
+ GDAUI_ATTRIBUTE_PLUGIN);
+ }
+ entry = GTK_WIDGET (gdaui_new_data_entry (type, plugin));
- if (!nnul ||
- (nnul && value &&
- (G_VALUE_TYPE ((GValue *) value) != GDA_TYPE_NULL)))
- gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY (entry), value);
+ /* set current value */
+ gdaui_data_entry_set_value (GDAUI_DATA_ENTRY (entry), val);
- 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);
- }
+ if (!nnul ||
+ (nnul && value &&
+ (G_VALUE_TYPE ((GValue *) value) != GDA_TYPE_NULL)))
+ gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY (entry), value);
+ if (default_val) {
+ gdaui_data_entry_set_value_default (GDAUI_DATA_ENTRY (entry), default_val);
gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (entry),
- nnul ? 0 : GDA_VALUE_ATTR_CAN_BE_NULL,
- GDA_VALUE_ATTR_CAN_BE_NULL);
+ 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);
+
+ /* connect to the parameter's changes */
+ sentry->single_signal.holder = g_object_ref (param);
+ sentry->single_signal.signal_id = g_signal_connect (G_OBJECT (param), "changed",
+ G_CALLBACK (parameter_changed_cb),
+ sentry);
+
+ /* label */
+ gchar *title;
+ gchar *str;
+ g_object_get (G_OBJECT (param), "name", &title, NULL);
+ if (!title)
+ title = g_strdup (_("Value"));
+ str = g_strdup_printf ("%s:", title);
+ sentry->label = gtk_label_new (str);
+ g_free (str);
+ g_object_ref_sink (sentry->label);
+ sentry->label_title = title;
+ gtk_misc_set_alignment (GTK_MISC (sentry->label), 0., 0.);
+ gtk_widget_show (sentry->label);
+
+ g_object_get (G_OBJECT (param), "description", &title, NULL);
+ if (title && *title)
+ gtk_widget_set_tooltip_text (sentry->label, title);
+ g_free (title);
+ }
+ else {
+ /* several parameters depending on the values of a GdaDataModel object */
+ GSList *plist;
+ gboolean nnul = TRUE;
+
+ entry = gdaui_entry_combo_new (sentry->form->priv->set_info, group->source);
- g_object_set_data (G_OBJECT (entry), "param", param);
- g_object_set_data (G_OBJECT (entry), "form", form);
- form->priv->entries = g_slist_append (form->priv->entries, entry);
- g_signal_connect (entry, "destroy", G_CALLBACK (entry_destroyed_cb), form);
+ /* connect to the parameter's changes */
+ sentry->group_signals = g_array_new (FALSE, FALSE, sizeof (SignalData));
+ for (plist = group->group->nodes; plist; plist = plist->next) {
+ GdaHolder *param;
+
+ param = GDA_SET_NODE (plist->data)->holder;
+ if (!gda_holder_get_not_null (param))
+ nnul = FALSE;
- /* connect to the parameter's changes */
SignalData sd;
sd.holder = g_object_ref (param);
sd.signal_id = g_signal_connect (G_OBJECT (param), "changed",
G_CALLBACK (parameter_changed_cb),
- entry);
- g_array_prepend_val (form->priv->signal_data, sd);
+ sentry);
+ g_array_append_val (sentry->group_signals, sd);
}
- else {
- /* several parameters depending on the values of a GdaDataModel object */
- GSList *plist;
- gboolean nnul = TRUE;
-
- entry = gdaui_entry_combo_new (form->priv->set_info, group->source);
- g_object_set_data (G_OBJECT (entry), "__gdaui_group", group);
- g_object_set_data (G_OBJECT (entry), "form", form);
- form->priv->entries = g_slist_append (form->priv->entries, entry);
- g_signal_connect (entry, "destroy", G_CALLBACK (entry_destroyed_cb), form);
-
- /* connect to the parameter's changes */
- for (plist = group->group->nodes; plist; plist = plist->next) {
- GdaHolder *param;
-
- param = GDA_SET_NODE (plist->data)->holder;
- if (!gda_holder_get_not_null (param))
- nnul = FALSE;
-
- SignalData sd;
- sd.holder = g_object_ref (param);
- sd.signal_id = g_signal_connect (G_OBJECT (param), "changed",
- G_CALLBACK (parameter_changed_cb),
- entry);
- 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);
+ gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (entry),
+ nnul ? 0 : GDA_VALUE_ATTR_CAN_BE_NULL,
+ GDA_VALUE_ATTR_CAN_BE_NULL);
+ sentry->not_null = nnul;
+
+ /* label */
+ /* FIXME: find a better label and tooltip and improve data entry attributes */
+ gchar *title = NULL;
+ gchar *str;
+ GSList *params;
+
+ for (params = sentry->group->group->nodes; params; params = params->next) {
+ g_object_get (G_OBJECT (GDA_SET_NODE (params->data)->holder),
+ "name", &title, NULL);
+ if (title)
+ break;
}
+
+ if (!title) {
+ str = g_object_get_data (G_OBJECT (group->group->nodes_source->data_model),
+ "name");
+ if (str)
+ title = g_strdup (str);
+ }
+ if (!title)
+ title = g_strdup (_("Value"));
+ str = g_strdup_printf ("%s:", title);
+ sentry->label = gtk_label_new (str);
+ g_free (str);
+ g_object_ref_sink (sentry->label);
+ sentry->label_title = title;
+ gtk_misc_set_alignment (GTK_MISC (sentry->label), 0., 0.);
+ gtk_widget_show (sentry->label);
+
+ title = g_object_get_data (G_OBJECT (group->group->nodes_source->data_model),
+ "descr");
+ if (title && *title)
+ gtk_widget_set_tooltip_text (sentry->label, title);
- /* connect the entry's changes */
- g_signal_connect (G_OBJECT (entry), "contents_modified",
- G_CALLBACK (entry_contents_modified), form);
- g_signal_connect (G_OBJECT (entry), "contents_activated",
- G_CALLBACK (entry_contents_activated), form);
}
+ sentry->entry = GDAUI_DATA_ENTRY (entry);
+ g_object_ref_sink (sentry->entry);
+ gdaui_data_entry_set_editable (sentry->entry, editable);
+
+ /* connect the entry's changes */
+ sentry->entry_contents_modified_id = g_signal_connect (G_OBJECT (entry), "contents-modified",
+ G_CALLBACK (entry_contents_modified),
+ sentry);
+ sentry->entry_contents_activated_id = g_signal_connect (G_OBJECT (entry), "contents-activated",
+ G_CALLBACK (entry_contents_activated),
+ sentry->form);
+}
- if (form->priv->scrolled_window != NULL) {
- gtk_box_pack_start (GTK_BOX(form),
- (GtkWidget *) form->priv->scrolled_window,
- TRUE, TRUE, 0);
+/*
+ * create the entries in the widget
+ */
+static void
+create_entries (GdauiBasicForm *form)
+{
+ GSList *list;
- GSList *holders = form->priv->set->holders;
- GSList *entries = form->priv->entries;
- while (holders && entries) {
- GdaHolder *holder = holders->data;
- GdauiDataEntry *entry = entries->data;
+ /* parameters list management */
+ if (!form->priv->set || !form->priv->set_info->groups_list)
+ /* nothing to do */
+ return;
- const gchar *id = gda_holder_get_id (holder);
+ /* creating all the data entries, and putting them into the form->priv->entries list */
+ for (list = form->priv->set_info->groups_list; list; list = list->next) {
+ SingleEntry *sentry;
- gpointer d[2];
- d[0] = (gchar *) id;
- d[1] = NULL;
+ sentry = g_new0 (SingleEntry, 1);
+ sentry->form = form;
+ form->priv->s_entries = g_slist_append (form->priv->s_entries, sentry);
- gtk_container_foreach (GTK_CONTAINER(form->priv->scrolled_window),
- (GtkCallback) find_hbox, d);
+ sentry->group = GDAUI_SET_GROUP (list->data);
+ create_entry_widget (sentry);
+ }
+
+ /* Set the Show actions in the entries */
+ gdaui_basic_form_show_entry_actions (form, form->priv->show_actions);
+ /* Set the Auto entries default in the entries */
+ gdaui_basic_form_set_entries_auto_default (form, form->priv->entries_auto_default);
+}
- GtkHBox *hbox = d[1];
- g_print ("Hbox for: %s -- %p\n", id, hbox);
+static void
+pack_entry_widget (SingleEntry *sentry)
+{
+ gboolean expand;
+ expand = gdaui_data_entry_expand_in_layout (GDAUI_DATA_ENTRY (sentry->entry));
+ sentry->can_expand = expand;
+
+ switch (sentry->packing_type) {
+ case PACKING_TABLE: {
+ /* label for the entry */
+ gint i = sentry->pack.table.top;
+ GtkTable *table = GTK_TABLE (sentry->pack.table.table);
+ GtkWidget *parent;
+
+ if (sentry->label) {
+ parent = gtk_widget_get_parent (sentry->label);
+ if (parent)
+ gtk_container_remove (GTK_CONTAINER (parent), sentry->label);
+ gtk_table_attach (table, sentry->label, 0, 1, i, i+1,
+ GTK_FILL | GTK_SHRINK, GTK_SHRINK, 0, 0);
+ }
+
+ /* add the entry itself to the table */
+ parent = gtk_widget_get_parent ((GtkWidget*) sentry->entry);
+ if (parent)
+ gtk_container_remove (GTK_CONTAINER (parent), (GtkWidget*) sentry->entry);
+ gtk_table_attach (table, (GtkWidget*) sentry->entry, 1, 2, i, i+1,
+ GTK_FILL | GTK_EXPAND,
+ expand ? (GTK_FILL | GTK_EXPAND) : GTK_SHRINK, 0, 0);
+
+ gtk_widget_show ((GtkWidget*) sentry->entry);
+ if (sentry->label)
+ g_object_set (G_OBJECT (sentry->label), "can-focus", FALSE, NULL);
+ break;
+ }
+ default:
+ TO_IMPLEMENT;
+ }
+}
- if (hbox != NULL) {
- gboolean expand = gdaui_data_entry_expand_in_layout (GDAUI_DATA_ENTRY (entry));
- form_expand = form_expand || expand;
+/*
+ * create the entries in the widget
+ */
+static void
+pack_entries_in_table (GdauiBasicForm *form)
+{
+ GtkWidget *table;
+ gint i;
+ GSList *list;
+
+ unpack_entries (form);
+ if (form->priv->top_container) {
+ gtk_widget_destroy (form->priv->top_container);
+ form->priv->top_container = NULL;
+ if (form->priv->place_holders) {
+ g_hash_table_destroy (form->priv->place_holders);
+ form->priv->place_holders = NULL;
+ }
+ }
- gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (entry), expand, TRUE, 0);
- gtk_widget_show (GTK_WIDGET (entry));
+ /* creating a table for all the entries */
+ table = gtk_table_new (g_slist_length (form->priv->s_entries), 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), SPACING);
+ gtk_table_set_col_spacings (GTK_TABLE (table), SPACING);
+ form->priv->top_container = table;
+ gtk_box_pack_start (GTK_BOX (form), table, TRUE, TRUE, 0);
+ for (list = form->priv->s_entries, i = 0;
+ list;
+ list = list->next, i++) {
+ SingleEntry *sentry = (SingleEntry *) list->data;
+
+ sentry->packing_type = PACKING_TABLE;
+ sentry->pack.table.table = table;
+ sentry->pack.table.top = i;
+
+ pack_entry_widget (sentry);
+ }
+ mark_not_null_entry_labels (form, TRUE);
+ gtk_widget_show (table);
+}
- if (!g_object_get_data (G_OBJECT(hbox), "show_actions"))
- gdaui_data_entry_set_attributes
- (GDAUI_DATA_ENTRY(entry),
- 0, GDA_VALUE_ATTR_ACTIONS_SHOWN);
- }
+static GtkWidget *load_xml_layout_children (GdauiBasicForm *form, xmlNodePtr parent_node);
+static GtkWidget *load_xml_layout_column (GdauiBasicForm *form, xmlNodePtr box_node);
+static GtkWidget *load_xml_layout_section (GdauiBasicForm *form, xmlNodePtr section_node);
- holders = g_slist_next (holders);
- entries = g_slist_next (entries);
+static void
+pack_entries_in_xml_layout (GdauiBasicForm *form, xmlNodePtr form_node)
+{
+ GtkWidget *top;
+
+ unpack_entries (form);
+ if (form->priv->top_container) {
+ gtk_widget_destroy (form->priv->top_container);
+ form->priv->top_container = NULL;
+ if (form->priv->place_holders) {
+ g_hash_table_destroy (form->priv->place_holders);
+ form->priv->place_holders = NULL;
}
+ }
- g_assert (holders == NULL && entries == NULL);
- gtk_widget_show (GTK_WIDGET(form->priv->scrolled_window));
+ top = load_xml_layout_children (form, form_node);
+ gtk_box_pack_start (GTK_BOX (form), top, TRUE, TRUE, 0);
+ gtk_widget_show_all (top);
+ mark_not_null_entry_labels (form, TRUE);
+}
+
+/*
+ * Loads all @parent_node's children and returns the corresponding widget
+ * @parent_node can be a "gdaui_form", "gdaui_section",
+ * it _CANNOT_ be a "gdaui_entry"
+ */
+static GtkWidget *
+load_xml_layout_children (GdauiBasicForm *form, xmlNodePtr parent_node)
+{
+ GtkWidget *top = NULL;
+ xmlChar *prop;
+ typedef enum {
+ TOP_BOX,
+ TOP_PANED
+ } TopContainerType;
+ TopContainerType ctype = TOP_BOX;
+ gint pos = 0;
+
+ prop = xmlGetProp (parent_node, BAD_CAST "container");
+ if (prop) {
+ if (xmlStrEqual (prop, BAD_CAST "columns")) {
+ top = gtk_hbox_new (FALSE, 0);
+ ctype = TOP_BOX;
+ }
+ if (xmlStrEqual (prop, BAD_CAST "rows")) {
+ top = gtk_vbox_new (FALSE, 0);
+ ctype = TOP_BOX;
+ }
+ else if (xmlStrEqual (prop, BAD_CAST "hpaned")) {
+ top = gtk_hpaned_new ();
+ ctype = TOP_PANED;
+ }
+ else if (xmlStrEqual (prop, BAD_CAST "vpaned")) {
+ top = gtk_vpaned_new ();
+ ctype = TOP_PANED;
+ }
+ else
+ g_warning ("Unknown container type '%s', ignoring", (gchar*) prop);
+ xmlFree (prop);
}
+ if (!top)
+ top = gtk_hbox_new (FALSE, 0);
- /*
- * There is no layout spec (or the provided one could not be used),
- * so use the default tables arrangment
- */
- if (form->priv->scrolled_window == NULL) {
- GtkWidget *table, *label;
- gint i;
+ xmlNodePtr child;
+ for (child = parent_node->children; child; child = child->next) {
+ if (child->type != XML_ELEMENT_NODE)
+ continue;
- /* creating a table for all the entries */
- table = gtk_table_new (g_slist_length (form->priv->entries), 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 5);
- gtk_table_set_col_spacings (GTK_TABLE (table), 5);
- form->priv->entries_table = table;
- gtk_box_pack_start (GTK_BOX (form), table, TRUE, TRUE, 0);
- for (list = form->priv->entries, i = 0;
- list;
- list = list->next, i++) {
- gboolean expand;
- GtkWidget *entry_label;
- GdaHolder *param;
+ GtkWidget *wid = NULL;
- /* label for the entry */
- param = g_object_get_data (G_OBJECT (list->data), "param");
- if (param) {
- gchar *title;
- gchar *str;
-
- g_object_get (G_OBJECT (param), "name", &title, NULL);
- if (!title)
- title = g_strdup (_("Value"));
- str = g_strdup_printf ("%s:", title);
- label = gtk_label_new (str);
- g_free (str);
- g_object_set_data_full (G_OBJECT (label), "_gda_title", title, g_free);
- if (gda_holder_get_not_null (param))
- form->priv->not_null_labels = g_slist_prepend (form->priv->not_null_labels,
- label);
-
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
-
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i+1,
- GTK_FILL | GTK_SHRINK, GTK_SHRINK, 0, 0);
- gtk_widget_show (label);
- entry_label = label;
-
- g_object_get (G_OBJECT (param), "description", &title, NULL);
- if (title && *title)
- gtk_widget_set_tooltip_text (label, title);
- g_free (title);
+ if (xmlStrEqual (child->name, BAD_CAST "gdaui_column"))
+ wid = load_xml_layout_column (form, child);
+ else if (xmlStrEqual (child->name, BAD_CAST "gdaui_section"))
+ wid = load_xml_layout_section (form, child);
+ else
+ g_warning ("Unknown node type '%s', ignoring", (gchar*) child->name);
+
+ if (wid) {
+ switch (ctype) {
+ case TOP_BOX:
+ gtk_box_pack_start (GTK_BOX (top), wid, TRUE, TRUE, SPACING);
+ break;
+ case TOP_PANED:
+ if (pos == 0)
+ gtk_paned_add1 (GTK_PANED (top), wid);
+ else if (pos == 1)
+ gtk_paned_add2 (GTK_PANED (top), wid);
+ else
+ g_warning ("Paned container can't have more than two children");
+ break;
+ default:
+ g_assert_not_reached ();
}
- else {
- /* FIXME: find a better label and tooltip and improve data entry attributes */
- gchar *title = NULL;
- gchar *str;
- gboolean nullok = TRUE;
- GSList *params;
- GdauiSetGroup *group;
-
- group = g_object_get_data (G_OBJECT (list->data), "__gdaui_group");
- for (params = group->group->nodes; params; params = params->next) {
- if (nullok && gda_holder_get_not_null (GDA_SET_NODE (params->data)->holder))
- nullok = FALSE;
- if (!title)
- g_object_get (G_OBJECT (GDA_SET_NODE (params->data)->holder),
- "name", &title, NULL);
- }
+ pos++;
+ }
+ }
+
+ return top;
+}
- if (!title) {
- str = g_object_get_data (G_OBJECT (group->group->nodes_source->data_model),
- "name");
- if (str)
- title = g_strdup (str);
+static GtkWidget *
+load_xml_layout_column (GdauiBasicForm *form, xmlNodePtr box_node)
+{
+ GtkWidget *table;
+ table = gtk_table_new (1, 2, FALSE);
+
+ xmlNodePtr child;
+ gint i;
+ for (i = 0, child = box_node->children; child; i++, child = child->next) {
+ if (child->type != XML_ELEMENT_NODE)
+ continue;
+
+ if (xmlStrEqual (child->name, BAD_CAST "gdaui_entry")) {
+ xmlChar *name;
+ name = xmlGetProp (child, BAD_CAST "name");
+ if (name) {
+ SingleEntry *sentry;
+ sentry = get_single_entry_for_id (form, (gchar*) name);
+ if (sentry) {
+ sentry->packing_type = PACKING_TABLE;
+ sentry->pack.table.table = table;
+ sentry->pack.table.top = i;
+
+ xmlChar *plugin;
+ plugin = xmlGetProp (child, BAD_CAST "plugin");
+ if (plugin && sentry->single_param) {
+ GValue *value;
+ value = gda_value_new_from_string ((gchar*) plugin, G_TYPE_STRING);
+ gda_holder_set_attribute_static (sentry->single_param,
+ GDAUI_ATTRIBUTE_PLUGIN, value);
+ gda_value_free (value);
+ }
+ if (plugin)
+ xmlFree (plugin);
+
+ xmlChar *label;
+ label = xmlGetProp (child, BAD_CAST "label");
+ if (label) {
+ g_free (sentry->label_title);
+ sentry->label_title = g_strdup ((gchar*) label);
+ if (sentry->label) {
+ gtk_widget_destroy (sentry->label);
+ g_object_unref (sentry->label);
+ }
+ sentry->label = gtk_label_new ((gchar*) label);
+ g_object_ref_sink (sentry->label);
+ gtk_misc_set_alignment (GTK_MISC (sentry->label), 0., 0.);
+
+ xmlFree (label);
+ }
+
+ pack_entry_widget (sentry);
}
- if (!title)
- title = g_strdup (_("Value"));
- str = g_strdup_printf ("%s:", title);
- label = gtk_label_new (str);
- g_free (str);
- g_object_set_data_full (G_OBJECT (label), "_gda_title", title, g_free);
- if (!nullok)
- form->priv->not_null_labels = g_slist_prepend (form->priv->not_null_labels, label);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
-
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, i, i+1,
- GTK_FILL | GTK_SHRINK, GTK_SHRINK, 0, 0);
- gtk_widget_show (label);
- entry_label = label;
-
- title = g_object_get_data (G_OBJECT (group->group->nodes_source->data_model),
- "descr");
- if (title && *title)
- gtk_widget_set_tooltip_text (label, title);
+ else
+ g_warning ("Could not find entry named '%s', ignoring",
+ (gchar*) name);
+ xmlFree (name);
}
+ }
+ else if (xmlStrEqual (child->name, BAD_CAST "gdaui_placeholder")) {
+ xmlChar *id;
+ id = xmlGetProp (child, BAD_CAST "id");
+ if (id) {
+ GtkWidget *ph;
+ xmlChar *label;
+ label = xmlGetProp (child, BAD_CAST "label");
+
+ if (label) {
+ GtkWidget *wid;
+ wid = gtk_label_new ((gchar*) label);
+ gtk_table_attach (GTK_TABLE (table), wid, 0, 1, i, i+1, GTK_SHRINK, 0, 0, 0);
+ xmlFree (label);
+ }
- /* add the entry itself to the table */
- expand = gdaui_data_entry_expand_in_layout (GDAUI_DATA_ENTRY (list->data));
- form_expand = form_expand || expand;
- gtk_table_attach (GTK_TABLE (table), GTK_WIDGET (list->data), 1, 2, i, i+1,
- GTK_FILL | GTK_EXPAND,
- expand ? (GTK_FILL | GTK_EXPAND) : GTK_SHRINK, 0, 0);
- gtk_widget_show (GTK_WIDGET (list->data));
- g_object_set_data (G_OBJECT (list->data), "entry_label", entry_label);
- if (entry_label) {
- g_signal_connect (entry_label, "destroy",
- G_CALLBACK (label_destroyed_cb), form);
- g_object_set (G_OBJECT (entry_label), "can-focus", FALSE, NULL);
+ if (! form->priv->place_holders)
+ form->priv->place_holders = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, g_object_unref);
+ ph = gtk_vbox_new (FALSE, 0);
+ g_hash_table_insert (form->priv->place_holders, g_strdup ((gchar*) id),
+ g_object_ref_sink ((GObject*)ph));
+ gtk_table_attach_defaults (GTK_TABLE (table), ph, 1, 2, i, i+1);
+ xmlFree (id);
}
- g_object_set_data (G_OBJECT (list->data), "row_no", GINT_TO_POINTER (i));
}
- mark_not_null_entry_labels (form, TRUE);
- gtk_widget_show (table);
+ else
+ g_warning ("Unknown node type '%s', ignoring", (gchar*) child->name);
}
- form->priv->can_expand = form_expand;
-
- /* Set the Show actions in the entries */
- gdaui_basic_form_show_entry_actions (form, form->priv->show_actions);
- /* Set the Auto entries default in the entries */
- gdaui_basic_form_set_entries_auto_default (form, form->priv->entries_auto_default);
+ gtk_table_set_row_spacings (GTK_TABLE (table), SPACING);
+ gtk_table_set_col_spacings (GTK_TABLE (table), SPACING);
+ return table;
}
-static void
-entry_destroyed_cb (GtkWidget *entry, GdauiBasicForm *form)
+static GtkWidget *
+load_xml_layout_section (GdauiBasicForm *form, xmlNodePtr section_node)
{
- GtkWidget *label_entry;
-
- form->priv->entries = g_slist_remove (form->priv->entries, entry);
- label_entry = g_object_get_data (G_OBJECT (entry), "entry_label");
- if (label_entry) {
- /* don't take care of label_entry anymore */
- g_signal_handlers_disconnect_by_func (G_OBJECT (label_entry),
- G_CALLBACK (label_destroyed_cb), form);
- g_object_set_data (G_OBJECT (entry), "entry_label", NULL);
- }
-}
+ xmlChar *title;
+ GtkWidget *hbox, *label, *sub, *retval;
-static void
-label_destroyed_cb (GtkWidget *label, GdauiBasicForm *form)
-{
- GSList *list = form->priv->entries;
+ hbox = gtk_hbox_new (FALSE, 0); /* HIG */
+ title = xmlGetProp (section_node, BAD_CAST "title");
+ if (title) {
+ gchar *str;
+ str = g_markup_printf_escaped ("<b>%s</b>", (gchar*) title);
+ xmlFree (title);
- while (list) {
- if (g_object_get_data (G_OBJECT (list->data), "entry_label") == label) {
- g_object_set_data (G_OBJECT (list->data), "entry_label", NULL);
- list = NULL;
- }
- else
- list = list->next;
+ label = gtk_label_new ("");
+ gtk_label_set_markup (GTK_LABEL (label), str);
+ g_free (str);
+ gtk_misc_set_alignment (GTK_MISC (label), 0., -1);
+
+ GtkWidget *vbox;
+ vbox = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+ retval = vbox;
}
+ else
+ retval = hbox;
+
+ label = gtk_label_new (" ");
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+ sub = load_xml_layout_children (form, section_node);
+ gtk_box_pack_start (GTK_BOX (hbox), sub, TRUE, TRUE, 0);
+
+ return retval;
}
/*
@@ -1664,16 +1182,15 @@ mark_not_null_entry_labels (GdauiBasicForm *form, gboolean show_mark)
{
GSList *list;
- for (list = form->priv->not_null_labels; list; list = list->next) {
- const gchar *title;
+ for (list = form->priv->s_entries; list; list = list->next) {
+ SingleEntry *sentry = (SingleEntry*) list->data;
gchar *str;
- title = g_object_get_data (G_OBJECT (list->data), "_gda_title");
- str = _gdaui_utility_markup_title (title, !show_mark);
- if (show_mark)
- gtk_label_set_markup (GTK_LABEL (list->data), str);
+ str = _gdaui_utility_markup_title (sentry->label_title, !show_mark || !sentry->not_null);
+ if (show_mark && sentry->not_null)
+ gtk_label_set_markup (GTK_LABEL (sentry->label), str);
else
- gtk_label_set_text (GTK_LABEL (list->data), str);
+ gtk_label_set_text (GTK_LABEL (sentry->label), str);
g_free (str);
}
}
@@ -1681,27 +1198,21 @@ mark_not_null_entry_labels (GdauiBasicForm *form, gboolean show_mark)
static void
entry_contents_activated (GdauiDataEntry *entry, GdauiBasicForm *form)
{
-#ifdef debug_signal
- g_print (">> 'ACTIVATED' from %s\n", __FUNCTION__);
-#endif
g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[ACTIVATED], 0);
-#ifdef debug_signal
- g_print ("<< 'ACTIVATED' from %s\n", __FUNCTION__);
-#endif
}
static void
-entry_contents_modified (GdauiDataEntry *entry, GdauiBasicForm *form)
+entry_contents_modified (GdauiDataEntry *entry, SingleEntry *sentry)
{
GdaHolder *param;
GdaValueAttribute attr;
attr = gdaui_data_entry_get_attributes (entry);
- param = g_object_get_data (G_OBJECT (entry), "param");
+ param = sentry->single_param;
if (param) { /* single parameter */
GValue *value;
- form->priv->forward_param_updates = FALSE;
+ sentry->form->priv->forward_param_updates = FALSE;
/* parameter's value */
value = gdaui_data_entry_get_value (entry);
@@ -1709,24 +1220,25 @@ 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[HOLDER_CHANGED], 0, param, TRUE);
+ g_signal_emit (G_OBJECT (sentry->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),
- G_CALLBACK (entry_contents_modified), form);
+ g_signal_handler_block (G_OBJECT (entry),
+ sentry->entry_contents_modified_id);
gdaui_data_entry_set_value (entry, gda_holder_get_value (param));
- g_signal_handlers_unblock_by_func (G_OBJECT (entry),
- G_CALLBACK (entry_contents_modified), form);
+ g_signal_handler_unblock (G_OBJECT (entry),
+ sentry->entry_contents_modified_id);
}
gda_value_free (value);
- form->priv->forward_param_updates = TRUE;
+ sentry->form->priv->forward_param_updates = TRUE;
}
else { /* multiple parameters */
GSList *params;
GSList *values, *list;
GdauiSetGroup *group;
- group = g_object_get_data (G_OBJECT (entry), "__gdaui_group");
+ group = sentry->group;
params = group->group->nodes;
values = gdaui_entry_combo_get_values (GDAUI_ENTRY_COMBO (entry));
g_assert (g_slist_length (params) == g_slist_length (values));
@@ -1742,26 +1254,26 @@ entry_contents_modified (GdauiDataEntry *entry, GdauiBasicForm *form)
* and emit only one signal.
*/
GdaHolder *param;
- form->priv->forward_param_updates = FALSE;
+ sentry->form->priv->forward_param_updates = FALSE;
/* parameter's value */
param = GDA_SET_NODE (params->data)->holder;
gda_holder_set_value (param, (GValue *)(list->data), NULL);
- g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[HOLDER_CHANGED],
+ g_signal_emit (G_OBJECT (sentry->form), gdaui_basic_form_signals[HOLDER_CHANGED],
0, param, TRUE);
- form->priv->forward_param_updates = TRUE;
+ sentry->form->priv->forward_param_updates = TRUE;
}
g_slist_free (values);
#ifdef PROXY_STORE_EXTRA_VALUES
/* updating the GdaDataProxy if there is one */
- if (GDA_IS_DATA_MODEL_ITER (form->priv->set)) {
+ if (GDA_IS_DATA_MODEL_ITER (sentry->form->priv->set)) {
GdaDataProxy *proxy;
gint proxy_row;
- proxy_row = gda_data_model_iter_get_row ((GdaDataModelIter *) form->priv->set);
+ proxy_row = gda_data_model_iter_get_row ((GdaDataModelIter *) sentry->form->priv->set);
- g_object_get (G_OBJECT (form->priv->set), "data_model", &proxy, NULL);
+ g_object_get (G_OBJECT (sentry->form->priv->set), "data-model", &proxy, NULL);
if (GDA_IS_DATA_PROXY (proxy)) {
GSList *all_new_values;
gint i, col;
@@ -1791,44 +1303,47 @@ entry_contents_modified (GdauiDataEntry *entry, GdauiBasicForm *form)
* the param change does not come from a GdauiDataEntry change.
*/
static void
-parameter_changed_cb (GdaHolder *param, GdauiDataEntry *entry)
+parameter_changed_cb (GdaHolder *param, SingleEntry *sentry)
{
- GdauiBasicForm *form = g_object_get_data (G_OBJECT (entry), "form");
- GdauiSetGroup *group = g_object_get_data (G_OBJECT (entry), "__gdaui_group");
const GValue *value = gda_holder_get_value (param);
+ GdauiDataEntry *entry;
- if (form->priv->forward_param_updates) {
+ entry = sentry->entry;
+ if (sentry->form->priv->forward_param_updates) {
gboolean param_valid;
gboolean default_if_invalid = FALSE;
- /* There can be a feedback from the entry if the param is invalid and "set_default_if_invalid"
+ /* There can be a feedback from the entry if the param is invalid and "set-default-if-invalid"
exists and is TRUE */
param_valid = gda_holder_is_valid (param);
if (!param_valid)
- if (g_object_class_find_property (G_OBJECT_GET_CLASS (entry), "set_default_if_invalid"))
- g_object_get (G_OBJECT (entry), "set_default_if_invalid", &default_if_invalid, NULL);
+ if (g_object_class_find_property (G_OBJECT_GET_CLASS (entry),
+ "set-default-if-invalid"))
+ g_object_get (G_OBJECT (entry),
+ "set-default-if-invalid", &default_if_invalid, NULL);
/* updating the corresponding entry */
if (! default_if_invalid) {
- g_signal_handlers_block_by_func (G_OBJECT (entry),
- G_CALLBACK (entry_contents_modified), form);
- g_signal_handlers_block_by_func (G_OBJECT (entry),
- G_CALLBACK (entry_contents_activated), form);
+ g_signal_handler_block (G_OBJECT (entry),
+ sentry->entry_contents_modified_id);
+ g_signal_handler_block (G_OBJECT (entry),
+ sentry->entry_contents_activated_id);
}
- if (group) {
+
+ if (sentry->single_param)
+ gdaui_data_entry_set_value (entry, value);
+ else {
GSList *values = NULL;
- GSList *list = group->group->nodes;
+ GSList *list;
gboolean allnull = TRUE;
- while (list) {
+ for (list = sentry->group->group->nodes; list; list = list->next) {
const GValue *pvalue;
pvalue = gda_holder_get_value (GDA_SET_NODE (list->data)->holder);
values = g_slist_append (values, (GValue *) pvalue);
if (allnull && pvalue &&
(G_VALUE_TYPE ((GValue *) pvalue) != GDA_TYPE_NULL))
allnull = FALSE;
-
- list = g_slist_next (list);
}
if (!allnull)
@@ -1838,17 +1353,16 @@ parameter_changed_cb (GdaHolder *param, GdauiDataEntry *entry)
g_slist_free (values);
}
- else
- gdaui_data_entry_set_value (entry, value);
if (! default_if_invalid) {
- g_signal_handlers_unblock_by_func (G_OBJECT (entry),
- G_CALLBACK (entry_contents_modified), form);
- g_signal_handlers_unblock_by_func (G_OBJECT (entry),
- G_CALLBACK (entry_contents_activated), form);
+ g_signal_handler_unblock (G_OBJECT (entry),
+ sentry->entry_contents_modified_id);
+ g_signal_handler_unblock (G_OBJECT (entry),
+ sentry->entry_contents_activated_id);
}
- g_signal_emit (G_OBJECT (form), gdaui_basic_form_signals[HOLDER_CHANGED], 0, param, FALSE);
+ g_signal_emit (G_OBJECT (sentry->form), gdaui_basic_form_signals[HOLDER_CHANGED], 0,
+ param, FALSE);
}
}
@@ -1871,44 +1385,41 @@ gdaui_basic_form_set_as_reference (GdauiBasicForm *form)
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
- for (list = form->priv->entries; list; list = list->next) {
- GdauiSetGroup *group;
-
- group = g_object_get_data (G_OBJECT (list->data), "__gdaui_group");
+ for (list = form->priv->s_entries; list; list = list->next) {
+ SingleEntry *sentry = (SingleEntry*) list->data;
- if (group) {
+ if (sentry->single_param) {
+ /* non combo entry */
+ param = sentry->single_param;
+ g_signal_handler_block (G_OBJECT (sentry->entry),
+ sentry->entry_contents_modified_id);
+ gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY (sentry->entry),
+ gda_holder_get_value (param));
+ g_signal_handler_unblock (G_OBJECT (sentry->entry),
+ sentry->entry_contents_modified_id);
+ }
+ else {
/* Combo entry */
GSList *values = NULL;
- GSList *params = group->group->nodes;
+ GSList *params;
gboolean allnull = TRUE;
- while (params) {
+ for (params = sentry->group->group->nodes; params; params = params->next) {
const GValue *pvalue;
pvalue = gda_holder_get_value (GDA_SET_NODE (params->data)->holder);
values = g_slist_append (values, (GValue *) pvalue);
if (allnull && pvalue &&
(G_VALUE_TYPE ((GValue *) pvalue) != GDA_TYPE_NULL))
allnull = FALSE;
-
- params = g_slist_next (params);
}
if (!allnull)
- gdaui_entry_combo_set_values_orig (GDAUI_ENTRY_COMBO (list->data), values);
+ gdaui_entry_combo_set_values_orig (GDAUI_ENTRY_COMBO (sentry->entry), values);
else
- gdaui_entry_combo_set_values_orig (GDAUI_ENTRY_COMBO (list->data), NULL);
+ gdaui_entry_combo_set_values_orig (GDAUI_ENTRY_COMBO (sentry->entry), NULL);
g_slist_free (values);
}
- else {
- /* non combo entry */
- param = g_object_get_data (G_OBJECT (list->data), "param");
- g_signal_handlers_block_by_func (G_OBJECT (list->data),
- G_CALLBACK (entry_contents_modified), form);
- gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY (list->data), gda_holder_get_value (param));
- g_signal_handlers_unblock_by_func (G_OBJECT (list->data),
- G_CALLBACK (entry_contents_modified), form);
- }
}
}
@@ -1967,10 +1478,12 @@ gdaui_basic_form_has_changed (GdauiBasicForm *form)
g_return_val_if_fail (GDAUI_IS_BASIC_FORM (form), FALSE);
- for (list = form->priv->entries; list; list = list->next)
- if (! (gdaui_data_entry_get_attributes (GDAUI_DATA_ENTRY (list->data)) &
+ for (list = form->priv->s_entries; list; list = list->next) {
+ SingleEntry *sentry = (SingleEntry*) list->data;
+ if (! (gdaui_data_entry_get_attributes (GDAUI_DATA_ENTRY (sentry->entry)) &
GDA_VALUE_ATTR_IS_UNCHANGED))
return TRUE;
+ }
return FALSE;
}
@@ -1985,7 +1498,7 @@ gdaui_basic_form_has_changed (GdauiBasicForm *form)
static void
gdaui_basic_form_show_entry_actions (GdauiBasicForm *form, gboolean show_actions)
{
- GSList *entries;
+ GSList *list;
guint show;
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
@@ -1993,10 +1506,12 @@ 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;
- for (entries = form->priv->entries; entries; entries = entries->next)
- gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (entries->data), show,
+ for (list = form->priv->s_entries; list; list = list->next) {
+ SingleEntry *sentry = (SingleEntry*) list->data;
+ gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (sentry->entry), show,
GDA_VALUE_ATTR_ACTIONS_SHOWN);
- /* mark_not_null_entry_labels (form, show_actions); */
+ /* mark_not_null_entry_labels (form, show_actions); */
+ }
}
/**
@@ -2015,26 +1530,24 @@ gdaui_basic_form_reset (GdauiBasicForm *form)
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
- list = form->priv->entries;
- while (list) {
- GdaSetNode *node = g_object_get_data (G_OBJECT (list->data), "node");
+ for (list = form->priv->s_entries; list; list = list->next) {
+ SingleEntry *sentry = (SingleEntry*) list->data;
- if (node) {
+ if (sentry->group) {
/* Combo entry */
GSList *values = NULL;
- values = gdaui_entry_combo_get_values_orig (GDAUI_ENTRY_COMBO (list->data));
- gdaui_entry_combo_set_values (GDAUI_ENTRY_COMBO (list->data), values);
+ values = gdaui_entry_combo_get_values_orig (GDAUI_ENTRY_COMBO (sentry->entry));
+ gdaui_entry_combo_set_values (GDAUI_ENTRY_COMBO (sentry->entry), values);
g_slist_free (values);
}
else {
/* non combo entry */
const GValue *value;
- value = gdaui_data_entry_get_original_value (GDAUI_DATA_ENTRY (list->data));
- gdaui_data_entry_set_value (GDAUI_DATA_ENTRY (list->data), value);
+ value = gdaui_data_entry_get_original_value (GDAUI_DATA_ENTRY (sentry->entry));
+ gdaui_data_entry_set_value (GDAUI_DATA_ENTRY (sentry->entry), value);
}
- list = g_slist_next (list);
}
}
@@ -2053,58 +1566,51 @@ gdaui_basic_form_reset (GdauiBasicForm *form)
void
gdaui_basic_form_entry_set_visible (GdauiBasicForm *form, GdaHolder *param, gboolean show)
{
- GtkWidget *entry;
+ SingleEntry *sentry;
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
+ g_return_if_fail (GDA_IS_HOLDER (param));
- entry = gdaui_basic_form_get_entry_widget (form, param);
-
- if (entry) {
- gint row = -1;
- GtkWidget *entry_label = g_object_get_data (G_OBJECT (entry), "entry_label");
-
- if (form->priv->entries_table)
- row = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (entry), "row_no"));
+ sentry = get_single_entry_for_holder (form, param);
+ if (!sentry) {
+ g_warning (_("Can't find data entry for GdaHolder"));
+ return;
+ }
+ if (sentry->entry) {
if (show) {
- if (g_slist_find (form->priv->hidden_entries, entry)) {
- form->priv->hidden_entries = g_slist_remove (form->priv->hidden_entries, entry);
- g_signal_handlers_disconnect_by_func (G_OBJECT (entry),
- G_CALLBACK (widget_shown_cb), form);
+ if (sentry->entry_shown_id) {
+ g_signal_handler_disconnect (sentry->entry, sentry->entry_shown_id);
+ sentry->entry_shown_id = 0;
}
- gtk_widget_show (entry);
-
- if (entry_label) {
- if (g_slist_find (form->priv->hidden_entries, entry_label)) {
- form->priv->hidden_entries = g_slist_remove (form->priv->hidden_entries,
- entry_label);
- g_signal_handlers_disconnect_by_func (G_OBJECT (entry_label),
- G_CALLBACK (widget_shown_cb), form);
- }
- gtk_widget_show (entry_label);
+ if (sentry->label_shown_id) {
+ g_signal_handler_disconnect (sentry->label, sentry->label_shown_id);
+ sentry->label_shown_id = 0;
}
- if (row > -1)
- gtk_table_set_row_spacing (GTK_TABLE (form->priv->entries_table), row, 5);
+ gtk_widget_show ((GtkWidget*) sentry->entry);
+ if (sentry->label)
+ gtk_widget_show (sentry->label);
}
else {
- if (!g_slist_find (form->priv->hidden_entries, entry)) {
- form->priv->hidden_entries = g_slist_append (form->priv->hidden_entries, entry);
- g_signal_connect_after (G_OBJECT (entry), "show",
- G_CALLBACK (widget_shown_cb), form);
- }
- gtk_widget_hide (entry);
-
- if (entry_label) {
- if (!g_slist_find (form->priv->hidden_entries, entry_label)) {
- form->priv->hidden_entries = g_slist_append (form->priv->hidden_entries,
- entry_label);
- g_signal_connect_after (G_OBJECT (entry_label), "show",
- G_CALLBACK (widget_shown_cb), form);
- }
- gtk_widget_hide (entry_label);
- }
- if (row > -1)
- gtk_table_set_row_spacing (GTK_TABLE (form->priv->entries_table), row, 0);
+ if (! sentry->entry_shown_id)
+ sentry->entry_shown_id = g_signal_connect_after (sentry->entry, "show",
+ G_CALLBACK (widget_shown_cb), sentry);
+ if (sentry->label && !sentry->label_shown_id)
+ sentry->label_shown_id = g_signal_connect_after (sentry->label, "show",
+ G_CALLBACK (widget_shown_cb), sentry);
+ gtk_widget_hide ((GtkWidget*) sentry->entry);
+ if (sentry->label)
+ gtk_widget_hide (sentry->label);
+ }
+ sentry->hidden = !show;
+
+ GtkWidget *parent;
+ parent = gtk_widget_get_parent ((GtkWidget *) sentry->entry);
+ if (parent && GTK_IS_TABLE (parent)) {
+ gint row;
+ gtk_container_child_get (GTK_CONTAINER (parent), (GtkWidget *) sentry->entry, "top-attach",
+ &row, NULL);
+ gtk_table_set_row_spacing (GTK_TABLE (parent), row, show ? SPACING : 0);
}
}
}
@@ -2146,24 +1652,19 @@ gdaui_basic_form_entry_grab_focus (GdauiBasicForm *form, GdaHolder *param)
void
gdaui_basic_form_entry_set_editable (GdauiBasicForm *form, GdaHolder *param, gboolean editable)
{
- GtkWidget *entry;
-
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
if (param) {
- entry = gdaui_basic_form_get_entry_widget (form, param);
- if (entry) {
- /* GtkWidget *entry_label = g_object_get_data (G_OBJECT (entry), "entry_label"); */
-
- gdaui_data_entry_set_editable (GDAUI_DATA_ENTRY (entry), editable);
- /*if (entry_label)
- gtk_widget_set_sensitive (entry_label, editable || !form->priv->headers_sensitive);*/
- }
+ SingleEntry *sentry;
+ sentry = get_single_entry_for_holder (form, param);
+ if (sentry)
+ gdaui_data_entry_set_editable (sentry->entry, editable);
}
else {
GSList *list;
- for (list = form->priv->entries; list; list = list->next)
- gdaui_data_entry_set_editable (GDAUI_DATA_ENTRY (list->data), editable);
+ for (list = form->priv->s_entries; list; list = list->next)
+ gdaui_data_entry_set_editable (GDAUI_DATA_ENTRY (((SingleEntry*) list->data)->entry),
+ editable);
}
}
@@ -2183,14 +1684,16 @@ gdaui_basic_form_entry_set_editable (GdauiBasicForm *form, GdaHolder *param, gbo
static void
gdaui_basic_form_set_entries_auto_default (GdauiBasicForm *form, gboolean auto_default)
{
- GSList *entries;
+ GSList *list;
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
form->priv->entries_auto_default = auto_default;
- 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);
+ for (list = form->priv->s_entries; list; list = list->next) {
+ if (g_object_class_find_property (G_OBJECT_GET_CLASS (((SingleEntry*) list->data)->entry),
+ "set-default-if-invalid"))
+ g_object_set (G_OBJECT (((SingleEntry*) list->data)->entry),
+ "set-default-if-invalid", auto_default, NULL);
}
}
@@ -2205,21 +1708,63 @@ gdaui_basic_form_set_entries_auto_default (GdauiBasicForm *form, gboolean auto_d
void
gdaui_basic_form_set_entries_to_default (GdauiBasicForm *form)
{
- GSList *entries;
+ GSList *list;
guint attrs;
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
- for (entries = form->priv->entries; entries; entries = entries->next) {
- attrs = gdaui_data_entry_get_attributes (GDAUI_DATA_ENTRY (entries->data));
+ for (list = form->priv->s_entries; list; list = list->next) {
+ SingleEntry *sentry = (SingleEntry*) list->data;
+ attrs = gdaui_data_entry_get_attributes (GDAUI_DATA_ENTRY (sentry->entry));
if (attrs & GDA_VALUE_ATTR_CAN_BE_DEFAULT)
- gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (entries->data),
+ gdaui_data_entry_set_attributes (GDAUI_DATA_ENTRY (sentry->entry),
GDA_VALUE_ATTR_IS_DEFAULT, GDA_VALUE_ATTR_IS_DEFAULT);
}
}
static void form_holder_changed (GdauiBasicForm *form, GdaHolder *param, gboolean is_user_modif, GtkDialog *dlg);
+static SingleEntry *
+get_single_entry_for_holder (GdauiBasicForm *form, GdaHolder *param)
+{
+ GSList *list;
+ for (list = form->priv->s_entries; list; list = list->next) {
+ SingleEntry *sentry = (SingleEntry *) list->data;
+ if (sentry->single_param && (sentry->single_param == param))
+ return sentry;
+ else if (sentry->group) {
+ /* multiple parameters */
+ GSList *params;
+
+ for (params = sentry->group->group->nodes; params; params = params->next) {
+ if (GDA_SET_NODE (params->data)->holder == (gpointer) param)
+ return sentry;
+ }
+ }
+ }
+ return NULL;
+}
+
+static SingleEntry *
+get_single_entry_for_id (GdauiBasicForm *form, const gchar *id)
+{
+ GSList *list;
+ g_return_val_if_fail (id, NULL);
+
+ for (list = form->priv->s_entries; list; list = list->next) {
+ SingleEntry *sentry = (SingleEntry *) list->data;
+ if (sentry->label_title && !strcmp (sentry->label_title, id))
+ return sentry;
+ if (sentry->single_param) {
+ const gchar *hid;
+ hid = gda_holder_get_id (sentry->single_param);
+ if (hid && !strcmp (hid, id))
+ return sentry;
+ }
+ }
+ return NULL;
+}
+
/**
* gdaui_basic_form_get_entry_widget
* @form: a #GdauiBasicForm widget
@@ -2234,34 +1779,15 @@ static void form_holder_changed (GdauiBasicForm *form, GdaHolder *param, gboolea
GtkWidget *
gdaui_basic_form_get_entry_widget (GdauiBasicForm *form, GdaHolder *param)
{
- GSList *entries;
- GtkWidget *entry = NULL;
-
+ SingleEntry *sentry;
g_return_val_if_fail (GDAUI_IS_BASIC_FORM (form), NULL);
+ g_return_val_if_fail (GDA_IS_HOLDER (param), NULL);
- for (entries = form->priv->entries; entries && !entry; entries = entries->next) {
- GdaHolder *thisparam = g_object_get_data (G_OBJECT (entries->data), "param");
-
- if (thisparam) {
- if (thisparam == param)
- entry = GTK_WIDGET (entries->data);
- }
- else {
- /* multiple parameters */
- GSList *params;
- GdauiSetGroup *group;
-
- group = g_object_get_data (G_OBJECT (entries->data), "__gdaui_group");
- for (params = group->group->nodes; params; params = params->next) {
- if (GDA_SET_NODE (params->data)->holder == (gpointer) param) {
- entry = GTK_WIDGET (entries->data);
- break;
- }
- }
- }
- }
-
- return entry;
+ sentry = get_single_entry_for_holder (form, param);
+ if (sentry)
+ return GTK_WIDGET (sentry->entry);
+ else
+ return NULL;
}
/**
@@ -2278,18 +1804,17 @@ gdaui_basic_form_get_entry_widget (GdauiBasicForm *form, GdaHolder *param)
GtkWidget *
gdaui_basic_form_get_label_widget (GdauiBasicForm *form, GdaHolder *param)
{
- GtkWidget *entry;
-
+ SingleEntry *sentry;
g_return_val_if_fail (GDAUI_IS_BASIC_FORM (form), NULL);
+ g_return_val_if_fail (GDA_IS_HOLDER (param), NULL);
- entry = gdaui_basic_form_get_entry_widget (form, param);
- if (entry)
- return g_object_get_data (G_OBJECT (entry), "entry_label");
+ sentry = get_single_entry_for_holder (form, param);
+ if (sentry)
+ return sentry->label;
else
return NULL;
}
-
/**
* gdaui_basic_form_new_in_dialog
* @paramlist: a #GdaSet structure
@@ -2340,24 +1865,24 @@ gdaui_basic_form_new_in_dialog (GdaSet *paramlist, GtkWindow *parent,
g_free (str);
#if GTK_CHECK_VERSION(2,18,0)
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
- label, FALSE, FALSE, 5);
+ label, FALSE, FALSE, SPACING);
#else
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), label, FALSE, FALSE, 5);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), label, FALSE, FALSE, SPACING);
#endif
gtk_widget_show (label);
}
+ gboolean can_expand;
+ g_object_get ((GObject*) form, "can-expand", &can_expand, NULL);
#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);
+ can_expand, 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,
- GDAUI_BASIC_FORM (form)->priv->can_expand,
- GDAUI_BASIC_FORM (form)->priv->can_expand, 10);
+ can_expand, can_expand, 10);
#endif
g_signal_connect (G_OBJECT (form), "holder-changed",
@@ -2381,7 +1906,7 @@ form_holder_changed (GdauiBasicForm *form, GdaHolder *param, gboolean is_user_mo
}
/**
- * gdaui_basic_form_set_data_layout_from_file
+ * gdaui_basic_form_set_layout_from_file
* @form: a #GdauiBasicForm
* @file_name:
* @parent_table:
@@ -2391,22 +1916,22 @@ form_holder_changed (GdauiBasicForm *form, GdaHolder *param, gboolean is_user_mo
* Since: 4.2
*/
void
-gdaui_basic_form_set_data_layout_from_file (GdauiBasicForm *form, const gchar *file_name, const gchar *parent_table)
+gdaui_basic_form_set_layout_from_file (GdauiBasicForm *form, const gchar *file_name, const gchar *form_name)
{
g_return_if_fail (GDAUI_IS_BASIC_FORM (form));
g_return_if_fail (file_name);
- g_return_if_fail (parent_table);
+ g_return_if_fail (form_name);
xmlDocPtr doc;
doc = xmlParseFile (file_name);
if (doc == NULL) {
- g_warning (_("'%s' Document not parsed successfully\n"), file_name);
+ g_warning (_("'%s' document not parsed successfully"), file_name);
return;
}
xmlDtdPtr dtd = NULL;
- gchar *file = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, "dtd", "data-layout.dtd", NULL);
+ gchar *file = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, "dtd", "gdaui-layout.dtd", NULL);
if (g_file_test (file, G_FILE_TEST_EXISTS))
dtd = xmlParseDTD (NULL, BAD_CAST file);
if (dtd == NULL) {
@@ -2420,35 +1945,25 @@ gdaui_basic_form_set_data_layout_from_file (GdauiBasicForm *form, const gchar *f
xmlNodePtr root_node = NULL;
root_node = xmlDocGetRootElement (doc);
- /* Must have root element, a name and the name must be "data_layouts" */
- if (!root_node ||
- !root_node->name ||
- xmlStrcmp (root_node->name, BAD_CAST "data_layouts")) {
+ /* Must have root element, a name and the name must be "gdaui_layouts" */
+ if (!root_node || !root_node->name ||
+ ! xmlStrEqual (root_node->name, BAD_CAST "gdaui_layouts")) {
xmlFreeDoc (doc);
return;
}
xmlNodePtr node;
- for (node = root_node->children; node != NULL; node = node->next) {
-
- if (node->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (node->name, BAD_CAST "data_layout")) {
- gboolean retval = FALSE;
+ for (node = root_node->children; node; node = node->next) {
+ if ((node->type == XML_ELEMENT_NODE) &&
+ xmlStrEqual (node->name, BAD_CAST "gdaui_form")) {
xmlChar *str;
-
- str = xmlGetProp (node, BAD_CAST "parent_table");
- if (str) {
- if (strcmp ((gchar*) str, parent_table) == 0)
- retval = TRUE;
- //g_print ("parent_table: %s\n", str);
- xmlFree (str);
- }
-
str = xmlGetProp (node, BAD_CAST "name");
- if (str) {
- if (retval && !strcmp ((gchar*) str, "details")) // Now proceed
- g_object_set (G_OBJECT (form), "data-layout", node, NULL);
- //g_print ("name: %s\n", str);
+ if (str) {
+ if (!strcmp ((gchar*) str, form_name)) {
+ g_object_set (G_OBJECT (form), "xml-layout", node, NULL);
+ xmlFree (str);
+ break;
+ }
xmlFree (str);
}
}
@@ -2456,8 +1971,26 @@ gdaui_basic_form_set_data_layout_from_file (GdauiBasicForm *form, const gchar *f
/* Free the document */
xmlFreeDoc (doc);
+}
+
+/**
+ * gdaui_basic_form_get_place_holder
+ * @form: a #GdauiBasicForm
+ * @placeholder_id: the name of the requested place holder
+ *
+ * Retreives a pointer to a place holder widget
+ *
+ * Returns: a pointer to the requested place holder, or %NULL if not found
+ *
+ * Since: 4.2
+ */
+GtkWidget *
+gdaui_basic_form_get_place_holder (GdauiBasicForm *form, const gchar *placeholder_id)
+{
+ g_return_val_if_fail (GDAUI_IS_BASIC_FORM (form), NULL);
+ g_return_val_if_fail (placeholder_id, NULL);
- /* Free the global variables that may
- * have been allocated by the parser */
- xmlCleanupParser ();
+ if (! form->priv->place_holders)
+ return NULL;
+ return g_hash_table_lookup (form->priv->place_holders, placeholder_id);
}
diff --git a/libgda-ui/gdaui-basic-form.h b/libgda-ui/gdaui-basic-form.h
index 11cb16a..286df2f 100644
--- a/libgda-ui/gdaui-basic-form.h
+++ b/libgda-ui/gdaui-basic-form.h
@@ -78,8 +78,9 @@ void gdaui_basic_form_set_entries_to_default (GdauiBasicForm *for
GtkWidget *gdaui_basic_form_get_entry_widget (GdauiBasicForm *form, GdaHolder *holder);
GtkWidget *gdaui_basic_form_get_label_widget (GdauiBasicForm *form, GdaHolder *holder);
-void gdaui_basic_form_set_data_layout_from_file(GdauiBasicForm *form, const gchar *file_name,
- const gchar *parent_table);
+void gdaui_basic_form_set_layout_from_file (GdauiBasicForm *form, const gchar *file_name,
+ const gchar *form_name);
+GtkWidget *gdaui_basic_form_get_place_holder (GdauiBasicForm *form, const gchar *placeholder_id);
G_END_DECLS
diff --git a/libgda-ui/gdaui-combo.c b/libgda-ui/gdaui-combo.c
index fc8cbc1..1b5039b 100644
--- a/libgda-ui/gdaui-combo.c
+++ b/libgda-ui/gdaui-combo.c
@@ -459,7 +459,7 @@ gdaui_combo_set_model (GdauiCombo *combo, GdaDataModel *model, gint n_cols, gint
dh = gda_get_default_handler (type);
renderer = gtk_cell_renderer_text_new ();
- g_object_set_data (G_OBJECT (renderer), "data_handler", dh);
+ g_object_set_data (G_OBJECT (renderer), "data-handler", dh);
g_object_set_data (G_OBJECT (renderer), "colnum", GINT_TO_POINTER (index));
g_object_set ((GObject*) renderer, "width-chars",
combo->priv->cols_width [index], NULL);
@@ -484,7 +484,7 @@ cell_layout_data_func (GtkCellLayout *cell_layout, GtkCellRenderer *cell,
const GValue *value;
gchar *str;
- dh = g_object_get_data (G_OBJECT (cell), "data_handler");
+ dh = g_object_get_data (G_OBJECT (cell), "data-handler");
colnum = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "colnum"));
gtk_tree_model_get (tree_model, iter, colnum, &value, -1);
@@ -821,7 +821,7 @@ combo_selector_set_column_visible (GdauiDataSelector *iface, gint column, gboole
dh = gda_get_default_handler (type);
renderer = gtk_cell_renderer_text_new ();
- g_object_set_data (G_OBJECT (renderer), "data_handler", dh);
+ g_object_set_data (G_OBJECT (renderer), "data-handler", dh);
g_object_set_data (G_OBJECT (renderer), "colnum", GINT_TO_POINTER (column));
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
diff --git a/libgda-ui/gdaui-data-entry.c b/libgda-ui/gdaui-data-entry.c
index 83a7e86..dc77d44 100644
--- a/libgda-ui/gdaui-data-entry.c
+++ b/libgda-ui/gdaui-data-entry.c
@@ -83,7 +83,7 @@ gdaui_data_entry_iface_init (gpointer g_class)
if (! initialized) {
gdaui_data_entry_signals[CONTENTS_MODIFIED] =
- g_signal_new ("contents_modified",
+ g_signal_new ("contents-modified",
GDAUI_TYPE_DATA_ENTRY,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GdauiDataEntryIface, contents_modified),
@@ -91,7 +91,7 @@ gdaui_data_entry_iface_init (gpointer g_class)
_gdaui_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gdaui_data_entry_signals[CONTENTS_ACTIVATED] =
- g_signal_new ("contents_activated",
+ g_signal_new ("contents-activated",
GDAUI_TYPE_DATA_ENTRY,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GdauiDataEntryIface, contents_activated),
@@ -99,7 +99,7 @@ gdaui_data_entry_iface_init (gpointer g_class)
_gdaui_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gdaui_data_entry_signals[STATUS_CHANGED] =
- g_signal_new ("status_changed",
+ g_signal_new ("status-changed",
GDAUI_TYPE_DATA_ENTRY,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GdauiDataEntryIface, status_changed),
@@ -107,7 +107,7 @@ gdaui_data_entry_iface_init (gpointer g_class)
_gdaui_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gdaui_data_entry_signals[CONTENTS_VALID] =
- g_signal_new ("contents_valid",
+ g_signal_new ("contents-valid",
GDAUI_TYPE_DATA_ENTRY,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdauiDataEntryIface, contents_valid),
@@ -214,7 +214,7 @@ gdaui_data_entry_get_value (GdauiDataEntry *de)
* Tests the validity of @de's contents. The validity is a determined from:
* <itemizedlist>
* <listitem><para>the @de widget itself if it is capable of doing it (depending on the implementation)</para></listitem>
- * <listitem><para>the results of the "contents_valid" signal which can be connected from </para></listitem>
+ * <listitem><para>the results of the "contents-valid" signal which can be connected from </para></listitem>
* </itemizedlist>
*
* Returns: TRUE if @de's contents is valid
@@ -424,6 +424,30 @@ gdaui_data_entry_set_editable (GdauiDataEntry *de, gboolean editable)
}
/**
+ * gdaui_data_entry_get_editable
+ * @de: a #GtkWidget object which implements the #GdauiDataEntry interface
+ *
+ * Tells if @de can be edited by the user
+ *
+ * Returns: %TRUE if @de is editable
+ *
+ * Since: 4.2
+ */
+gboolean
+gdaui_data_entry_get_editable (GdauiDataEntry *de)
+{
+ g_return_val_if_fail (GDAUI_IS_DATA_ENTRY (de), FALSE);
+
+ if (GDAUI_DATA_ENTRY_GET_IFACE (de)->get_editable)
+ return (GDAUI_DATA_ENTRY_GET_IFACE (de)->get_editable) (de);
+ else {
+ gboolean sens;
+ g_object_get ((GObject*) de, "sensitive", &sens, NULL);
+ return sens;
+ }
+}
+
+/**
* gdaui_data_entry_grab_focus
* @de: a #GtkWidget object which implements the #GdauiDataEntry interface
*
diff --git a/libgda-ui/gdaui-data-entry.h b/libgda-ui/gdaui-data-entry.h
index ab220ef..8dabc3a 100644
--- a/libgda-ui/gdaui-data-entry.h
+++ b/libgda-ui/gdaui-data-entry.h
@@ -60,8 +60,10 @@ struct _GdauiDataEntryIface
GdaDataHandler *(*get_handler) (GdauiDataEntry *de);
gboolean (*expand_in_layout) (GdauiDataEntry *de);
void (*set_editable) (GdauiDataEntry *de, gboolean editable);
+ gboolean (*get_editable) (GdauiDataEntry *de);
void (*grab_focus) (GdauiDataEntry *de);
+ /*< private >*/
/* Padding for future expansion */
void (*_gdaui_reserved1) (void);
void (*_gdaui_reserved2) (void);
@@ -91,6 +93,7 @@ GdaValueAttribute gdaui_data_entry_get_attributes (GdauiDataEntry *de);
GdaDataHandler *gdaui_data_entry_get_handler (GdauiDataEntry *de);
gboolean gdaui_data_entry_expand_in_layout (GdauiDataEntry *de);
void gdaui_data_entry_set_editable (GdauiDataEntry *de, gboolean editable);
+gboolean gdaui_data_entry_get_editable (GdauiDataEntry *de);
void gdaui_data_entry_grab_focus (GdauiDataEntry *de);
/* TO remove and replace with properties:
diff --git a/libgda-ui/gdaui-data-filter.c b/libgda-ui/gdaui-data-filter.c
index 8d29a77..378dce7 100644
--- a/libgda-ui/gdaui-data-filter.c
+++ b/libgda-ui/gdaui-data-filter.c
@@ -261,7 +261,7 @@ gdaui_data_filter_new (GdauiDataProxy *data_widget)
g_return_val_if_fail (!data_widget || GDAUI_IS_DATA_PROXY (data_widget), NULL);
filter = (GtkWidget *) g_object_new (GDAUI_TYPE_DATA_FILTER,
- "data_widget", data_widget, NULL);
+ "data-widget", data_widget, NULL);
return filter;
}
@@ -300,7 +300,7 @@ release_proxy (GdauiDataFilter *filter)
static void
data_widget_proxy_changed_cb (GdauiDataProxy *data_widget, GdaDataProxy *proxy, GdauiDataFilter *filter)
{
- g_object_set (G_OBJECT (filter), "data_widget", data_widget, NULL);
+ g_object_set (G_OBJECT (filter), "data-widget", data_widget, NULL);
}
static void
@@ -351,7 +351,7 @@ gdaui_data_filter_set_property (GObject *object,
/* data widget */
g_signal_connect (filter->priv->data_widget, "destroy",
G_CALLBACK (data_widget_destroyed_cb), filter);
- g_signal_connect (filter->priv->data_widget, "proxy_changed",
+ g_signal_connect (filter->priv->data_widget, "proxy-changed",
G_CALLBACK (data_widget_proxy_changed_cb), filter);
/* proxy */
diff --git a/libgda-ui/gdaui-data-proxy-info.c b/libgda-ui/gdaui-data-proxy-info.c
index 69e3eeb..020c301 100644
--- a/libgda-ui/gdaui-data-proxy-info.c
+++ b/libgda-ui/gdaui-data-proxy-info.c
@@ -466,7 +466,7 @@ modif_buttons_make (GdauiDataProxyInfo *info)
gtk_box_pack_start (GTK_BOX (toolwid), wid, FALSE, TRUE, 2);
gtk_widget_set_sensitive (wid, FALSE);
info->priv->row_spin = wid;
- g_signal_connect (G_OBJECT (wid), "value_changed",
+ g_signal_connect (G_OBJECT (wid), "value-changed",
G_CALLBACK (row_spin_changed_cb), info);
/* rows counter */
diff --git a/libgda-ui/gdaui-data-store.c b/libgda-ui/gdaui-data-store.c
index 6546a2f..b0b0508 100644
--- a/libgda-ui/gdaui-data-store.c
+++ b/libgda-ui/gdaui-data-store.c
@@ -139,7 +139,7 @@ gdaui_data_store_class_init (GdauiDataStoreClass * class)
g_param_spec_pointer ("proxy", _("Internal GdaDataProxy data model"), NULL,
(G_PARAM_READABLE)));
g_object_class_install_property (object_class, PROP_ADD_NULL_ENTRY,
- g_param_spec_boolean ("prepend_null_entry", NULL, NULL, FALSE,
+ g_param_spec_boolean ("prepend-null-entry", NULL, NULL, FALSE,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
}
@@ -274,7 +274,7 @@ gdaui_data_store_set_property (GObject *object,
else
proxy = (GdaDataProxy *) gda_data_proxy_new (model);
store->priv->proxy = proxy;
- g_object_set (G_OBJECT (proxy), "defer_sync", FALSE, "sample_size", 0, NULL);
+ g_object_set (G_OBJECT (proxy), "defer-sync", FALSE, "sample-size", 0, NULL);
store->priv->nrows = gda_data_model_get_n_rows (GDA_DATA_MODEL (store->priv->proxy));
/* connect to row changes */
@@ -291,7 +291,7 @@ gdaui_data_store_set_property (GObject *object,
break;
case PROP_ADD_NULL_ENTRY:
g_return_if_fail (store->priv->proxy);
- g_object_set (store->priv->proxy, "prepend_null_entry",
+ g_object_set (store->priv->proxy, "prepend-null-entry",
g_value_get_boolean (value), NULL);
store->priv->stamp = g_random_int ();
break;
@@ -321,7 +321,7 @@ gdaui_data_store_get_property (GObject *object,
case PROP_ADD_NULL_ENTRY: {
gboolean prop;
- g_object_get (store->priv->proxy, "prepend_null_entry", &prop, NULL);
+ g_object_get (store->priv->proxy, "prepend-null-entry", &prop, NULL);
g_value_set_boolean (value, prop);
break;
}
diff --git a/libgda-ui/gdaui-layout.dtd b/libgda-ui/gdaui-layout.dtd
new file mode 100644
index 0000000..bdc6735
--- /dev/null
+++ b/libgda-ui/gdaui-layout.dtd
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!ELEMENT gdaui_layouts (gdaui_form | gdaui_grid)>
+
+<!ELEMENT gdaui_form (gdaui_section | gdaui_column | gdaui_notebook)*>
+<!ATTLIST gdaui_form
+ name CDATA #REQUIRED
+ container (columns|rows|hpaned|vpaned) #IMPLIED>
+
+<!ELEMENT gdaui_section (gdaui_section | gdaui_column | gdaui_notebook)*>
+<!ATTLIST gdaui_section
+ title CDATA #IMPLIED >
+
+<!ELEMENT gdaui_notebook (gdaui_section | gdaui_column | gdaui_notebook)*>
+
+<!ELEMENT gdaui_column (gdaui_entry | gdaui_placeholder)*>
+
+<!ELEMENT gdaui_entry EMPTY>
+<!ATTLIST gdaui_entry
+ name CDATA #REQUIRED
+ editable (true|false) #IMPLIED
+ label CDATA #IMPLIED
+ plugin CDATA #IMPLIED>
+
+<!ELEMENT gdaui_placeholder EMPTY>
+<!ATTLIST gdaui_placeholder
+ id CDATA #REQUIRED
+ label CDATA #IMPLIED>
diff --git a/libgda-ui/gdaui-raw-form.c b/libgda-ui/gdaui-raw-form.c
index eda2e37..28a0468 100644
--- a/libgda-ui/gdaui-raw-form.c
+++ b/libgda-ui/gdaui-raw-form.c
@@ -76,7 +76,7 @@ struct _GdauiRawFormPriv
GdaDataProxy *proxy; /* proxy for @model */
GdaDataModelIter *iter; /* proxy's iter */
- GdauiDataProxyWriteMode write_mode;
+ GdauiDataProxyWriteMode write_mode;
GtkActionGroup *actions_group;
@@ -408,7 +408,7 @@ gdaui_raw_form_set_property (GObject *object,
g_signal_connect (form->priv->iter, "validate-set",
G_CALLBACK (iter_validate_set_cb), form);
- g_signal_connect (form->priv->iter, "row_changed",
+ g_signal_connect (form->priv->iter, "row-changed",
G_CALLBACK (iter_row_changed_cb), form);
g_signal_connect (G_OBJECT (form->priv->proxy), "row_inserted",
@@ -424,6 +424,7 @@ gdaui_raw_form_set_property (GObject *object,
g_object_set (object, "paramlist", form->priv->iter, NULL);
gda_data_proxy_set_sample_size (form->priv->proxy, 0);
gdaui_raw_form_initialize (form, NULL, NULL);
+ iter_row_changed_cb (form->priv->iter, gda_data_model_iter_get_row (form->priv->iter), form);
}
gdaui_raw_form_widget_set_write_mode ((GdauiDataProxy *) form, form->priv->write_mode);
@@ -848,11 +849,11 @@ action_filter_cb (GtkAction *action, GdauiRawForm *form)
GTK_WINDOW (form->priv->filter_window));
#endif
- g_signal_connect (form->priv->filter_window, "delete_event",
+ g_signal_connect (form->priv->filter_window, "delete-event",
G_CALLBACK (filter_event), form);
- g_signal_connect (form->priv->filter_window, "button_press_event",
+ g_signal_connect (form->priv->filter_window, "button-press-event",
G_CALLBACK (filter_event), form);
- g_signal_connect (form->priv->filter_window, "key_press_event",
+ g_signal_connect (form->priv->filter_window, "key-press-event",
G_CALLBACK (key_press_filter_event), form);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
diff --git a/libgda-ui/gdaui-raw-grid.c b/libgda-ui/gdaui-raw-grid.c
index 52dbe5c..90c7c89 100644
--- a/libgda-ui/gdaui-raw-grid.c
+++ b/libgda-ui/gdaui-raw-grid.c
@@ -250,7 +250,7 @@ gdaui_raw_grid_class_init (GdauiRawGridClass *klass)
parent_class = g_type_class_peek_parent (klass);
gdaui_raw_grid_signals[DOUBLE_CLICKED] =
- g_signal_new ("double_clicked",
+ g_signal_new ("double-clicked",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GdauiRawGridClass, double_clicked),
@@ -258,7 +258,7 @@ gdaui_raw_grid_class_init (GdauiRawGridClass *klass)
_gdaui_marshal_VOID__INT, G_TYPE_NONE,
1, G_TYPE_INT);
gdaui_raw_grid_signals[POPULATE_POPUP] =
- g_signal_new ("populate_popup",
+ g_signal_new ("populate-popup",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GdauiRawGridClass, populate_popup),
@@ -276,15 +276,15 @@ gdaui_raw_grid_class_init (GdauiRawGridClass *klass)
G_PARAM_READABLE | 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_INFO_CELL_VISIBLE,
- g_param_spec_boolean ("info_cell_visible", NULL, _("Info cell visible"), FALSE,
+ g_param_spec_boolean ("info-cell-visible", NULL, _("Info cell visible"), FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (object_class, PROP_GLOBAL_ACTIONS_VISIBLE,
- g_param_spec_boolean ("global_actions_visible", NULL, _("Global Actions visible"), FALSE,
+ g_param_spec_boolean ("global-actions-visible", NULL, _("Global Actions visible"), FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
}
@@ -309,7 +309,7 @@ gdaui_raw_grid_init (GdauiRawGrid *grid)
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (tree_view), TRUE);
g_signal_connect (G_OBJECT (tree_view), "event",
G_CALLBACK (tree_view_event_cb), grid);
- g_signal_connect (G_OBJECT (tree_view), "button_press_event",
+ g_signal_connect (G_OBJECT (tree_view), "button-press-event",
G_CALLBACK (tree_view_popup_button_pressed_cb), grid);
gtk_tree_view_set_enable_search (tree_view, FALSE);
@@ -318,7 +318,7 @@ gdaui_raw_grid_init (GdauiRawGrid *grid)
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
g_signal_connect (G_OBJECT (selection), "changed",
G_CALLBACK (tree_view_selection_changed_cb), grid);
- g_signal_connect (G_OBJECT (tree_view), "row_activated",
+ g_signal_connect (G_OBJECT (tree_view), "row-activated",
G_CALLBACK (tree_view_row_activated_cb), grid);
/* action group */
@@ -358,7 +358,6 @@ gdaui_raw_grid_dispose (GObject *object)
{
GdauiRawGrid *grid;
- g_return_if_fail (object != NULL);
g_return_if_fail (GDAUI_IS_RAW_GRID (object));
grid = GDAUI_RAW_GRID (object);
@@ -439,7 +438,7 @@ load_xml_data_layout_item (GdauiRawGrid *grid,
}
/* GSList *slist = grid->priv->set->holders; */
- /* while (slist != NULL) { */
+ /* while (slist) { */
/* GdaHolder *holder = slist->data; */
/* g_print ("SET HOLDER=%s\n", gda_holder_get_id (holder)); */
/* slist = g_slist_next (slist); */
@@ -447,7 +446,7 @@ load_xml_data_layout_item (GdauiRawGrid *grid,
//GdaHolder *holder = gda_set_get_holder (grid->priv->set, name);
GdaHolder *holder = gda_set_get_holder (GDA_SET (grid->priv->iter), name);
- g_return_if_fail (holder != NULL);
+ g_return_if_fail (holder);
gint index = g_slist_index (GDA_SET (grid->priv->iter)->holders, holder);
@@ -467,7 +466,7 @@ load_xml_data_layout_item (GdauiRawGrid *grid,
gint position = g_slist_index (GDA_SET (grid->priv->iter)->holders, holder);
GtkTreeViewColumn *column = gtk_tree_view_get_column (GTK_TREE_VIEW (grid), position);
- g_return_if_fail (column != NULL);
+ g_return_if_fail (column);
// ((GdaDataSelect *) model)->prep_stmt
GdaDataModel *model = grid->priv->data_model;
@@ -481,7 +480,7 @@ load_xml_data_layout_item (GdauiRawGrid *grid,
gtk_tree_view_column_set_title (column, text);
xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
+ for (child = node->children; child; child = child->next) {
/* if (child->type == XML_ELEMENT_NODE && */
/* !xmlStrcmp (child->name, (const xmlChar *) "formatting")) { */
@@ -537,7 +536,7 @@ load_xml_data_layout_group (GdauiRawGrid *grid,
}
xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
+ for (child = node->children; child; child = child->next) {
if (child->type == XML_ELEMENT_NODE &&
!xmlStrcmp (child->name, BAD_CAST "data_layout_group")) {
@@ -548,30 +547,6 @@ load_xml_data_layout_group (GdauiRawGrid *grid,
!xmlStrcmp (child->name, BAD_CAST "data_layout_item")) {
load_xml_data_layout_item (grid, child, /* data *//* table */ title);
}
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_portal")) {
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_notebook")) {
- }
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "trans_set")) {
- /* load_xml_trans_set (grid, child, data); */
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_button")) {
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_item_groupby")) {
- }
-
- if (child->type == XML_ELEMENT_NODE &&
- !xmlStrcmp (child->name, BAD_CAST "data_layout_item_header")) {
- }
}
g_free (name);
@@ -587,7 +562,7 @@ load_xml_data_layout_groups (GdauiRawGrid *grid,
g_return_if_fail (grid && GDAUI_IS_RAW_GRID (grid));
xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
+ for (child = node->children; child; child = child->next) {
if (child->type == XML_ELEMENT_NODE &&
!xmlStrcmp (child->name, BAD_CAST "data_layout_group")) {
@@ -635,7 +610,7 @@ load_xml_data_layout (GdauiRawGrid *grid,
return;
xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
+ for (child = node->children; child; child = child->next) {
if (child->type == XML_ELEMENT_NODE &&
!xmlStrcmp (child->name, BAD_CAST "data_layout_groups")) {
@@ -654,7 +629,7 @@ load_xml_data_layouts (GdauiRawGrid *grid,
g_return_if_fail (grid && GDAUI_IS_RAW_GRID (grid));
xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
+ for (child = node->children; child; child = child->next) {
if (child->type == XML_ELEMENT_NODE &&
!xmlStrcmp (child->name, BAD_CAST "data_layout")) {
@@ -804,9 +779,9 @@ gdaui_raw_grid_set_property (GObject *object,
grid->priv->data_model = gda_data_proxy_get_proxied_model (grid->priv->proxy);
g_object_ref (G_OBJECT (grid->priv->proxy));
- g_signal_connect (grid->priv->proxy, "sample_changed",
+ g_signal_connect (grid->priv->proxy, "sample-changed",
G_CALLBACK (proxy_sample_changed_cb), grid);
- g_signal_connect (grid->priv->proxy, "row_updated",
+ g_signal_connect (grid->priv->proxy, "row-updated",
G_CALLBACK (proxy_row_updated_cb), grid);
g_signal_connect (grid->priv->proxy, "reset",
G_CALLBACK (proxy_reset_cb), grid);
@@ -814,12 +789,12 @@ gdaui_raw_grid_set_property (GObject *object,
grid->priv->iter = gda_data_model_create_iter (GDA_DATA_MODEL (grid->priv->proxy));
grid->priv->iter_info = _gdaui_set_new (GDA_SET (grid->priv->iter));
- g_signal_connect (grid->priv->iter_info, "public_data_changed",
+ g_signal_connect (grid->priv->iter_info, "public-data-changed",
G_CALLBACK (paramlist_public_data_changed_cb), grid);
g_signal_connect (grid->priv->iter, "holder-attr-changed",
G_CALLBACK (paramlist_param_attr_changed_cb), grid);
- g_signal_connect (grid->priv->iter, "row_changed",
+ g_signal_connect (grid->priv->iter, "row-changed",
G_CALLBACK (iter_row_changed_cb), grid);
g_signal_connect (grid->priv->iter, "validate-set",
G_CALLBACK (iter_validate_set_cb), grid);
@@ -848,15 +823,14 @@ gdaui_raw_grid_set_property (GObject *object,
xmlNodePtr node = g_value_get_pointer (value);
xmlNodePtr child;
- for (child = node->children; child != NULL; child = child->next) {
-
+ for (child = node->children; child; child = child->next) {
if (child->type == XML_ELEMENT_NODE &&
!xmlStrcmp (child->name, BAD_CAST "data_layout_groups")) {
load_xml_data_layout_groups (grid, child, NULL);
}
}
- if (grid->priv->reordered_indexes != NULL) {
+ if (grid->priv->reordered_indexes) {
g_print ("Loaded XML file, reinit interface\n");
GList *columns = gtk_tree_view_get_columns (GTK_TREE_VIEW(grid));
@@ -865,7 +839,7 @@ gdaui_raw_grid_set_property (GObject *object,
GSList *columns_data = NULL;
GSList *reordered_indexes = grid->priv->reordered_indexes;
- while (reordered_indexes != NULL) {
+ while (reordered_indexes) {
gint position = GPOINTER_TO_INT(reordered_indexes->data);
GtkTreeViewColumn *column = GTK_TREE_VIEW_COLUMN
@@ -1168,8 +1142,8 @@ init_tree_view (GdauiRawGrid *grid)
/* settings and signals */
g_object_set (G_OBJECT (renderer), "editable", !column_data->data_locked, NULL);
- if (g_object_class_find_property (G_OBJECT_GET_CLASS (renderer), "set_default_if_invalid"))
- g_object_set (G_OBJECT (renderer), "set_default_if_invalid", TRUE, NULL);
+ if (g_object_class_find_property (G_OBJECT_GET_CLASS (renderer), "set-default-if-invalid"))
+ g_object_set (G_OBJECT (renderer), "set-default-if-invalid", TRUE, NULL);
g_object_set_data (G_OBJECT (column), "__gdaui_group", group);
/* Adding the GValue's information cell as another GtkCellRenderer */
@@ -1180,7 +1154,7 @@ init_tree_view (GdauiRawGrid *grid)
gtk_tree_view_column_set_cell_data_func (column, renderer,
(GtkTreeCellDataFunc) cell_renderer_info_set_attributes,
grid, NULL);
- g_signal_connect (G_OBJECT (renderer), "status_changed",
+ g_signal_connect (G_OBJECT (renderer), "status-changed",
G_CALLBACK (data_cell_status_changed), grid);
g_object_set (G_OBJECT (renderer), "visible", column_data->info_shown, NULL);
@@ -1240,28 +1214,28 @@ cell_renderer_value_set_attributes (GtkTreeViewColumn *tree_column,
values = _gdaui_utility_proxy_compute_values_for_group (group, grid->priv->store,
grid->priv->iter, iter, FALSE);
g_object_set (G_OBJECT (cell),
- "values_display", values,
- "value_attributes", attributes,
+ "values-display", values,
+ "value-attributes", attributes,
"editable", !column_data->data_locked && !(attributes & GDA_VALUE_ATTR_NO_MODIF),
- "show_expander", !column_data->data_locked && !(attributes & GDA_VALUE_ATTR_NO_MODIF),
- "cell_background", GDAUI_COLOR_NORMAL_MODIF,
+ "show-expander", !column_data->data_locked && !(attributes & GDA_VALUE_ATTR_NO_MODIF),
+ "cell-background", GDAUI_COLOR_NORMAL_MODIF,
"cell_background-set",
! (attributes & GDA_VALUE_ATTR_IS_UNCHANGED) || to_be_deleted,
- "to_be_deleted", to_be_deleted,
+ "to-be-deleted", to_be_deleted,
"visible", !(attributes & GDA_VALUE_ATTR_UNUSED),
NULL);
g_list_free (values);
}
else {
g_object_set (G_OBJECT (cell),
- "values_display", values,
- "value_attributes", attributes,
+ "values-display", values,
+ "value-attributes", attributes,
"editable", !column_data->data_locked && !(attributes & GDA_VALUE_ATTR_NO_MODIF),
- "show_expander", !column_data->data_locked && !(attributes & GDA_VALUE_ATTR_NO_MODIF),
- "cell_background", GDAUI_COLOR_NORMAL_MODIF,
+ "show-expander", !column_data->data_locked && !(attributes & GDA_VALUE_ATTR_NO_MODIF),
+ "cell-background", GDAUI_COLOR_NORMAL_MODIF,
"cell_background-set",
! (attributes & GDA_VALUE_ATTR_IS_UNCHANGED) || to_be_deleted,
- "to_be_deleted", to_be_deleted,
+ "to-be-deleted", to_be_deleted,
"visible", !(attributes & GDA_VALUE_ATTR_UNUSED),
NULL);
g_list_free (values);
@@ -1286,11 +1260,11 @@ cell_renderer_value_set_attributes (GtkTreeViewColumn *tree_column,
offset + col, &attributes, -1);
g_object_set (G_OBJECT (cell),
"value", value,
- "value_attributes", attributes,
+ "value-attributes", attributes,
"editable", !column_data->data_locked && !(attributes & GDA_VALUE_ATTR_NO_MODIF),
- "cell_background", GDAUI_COLOR_NORMAL_MODIF,
+ "cell-background", GDAUI_COLOR_NORMAL_MODIF,
"cell_background-set", ! (attributes & GDA_VALUE_ATTR_IS_UNCHANGED) || to_be_deleted,
- "to_be_deleted", to_be_deleted,
+ "to-be-deleted", to_be_deleted,
"visible", !(attributes & GDA_VALUE_ATTR_UNUSED),
NULL);
}
@@ -1328,10 +1302,10 @@ cell_renderer_info_set_attributes (GtkTreeViewColumn *tree_column,
iter, &to_be_deleted);
g_object_set (G_OBJECT (cell),
"editable", !column_data->data_locked && !(attributes & GDA_VALUE_ATTR_NO_MODIF),
- "value_attributes", attributes,
- "cell_background", GDAUI_COLOR_NORMAL_MODIF,
+ "value-attributes", attributes,
+ "cell-background", GDAUI_COLOR_NORMAL_MODIF,
"cell_background-set", ! (attributes & GDA_VALUE_ATTR_IS_UNCHANGED) || to_be_deleted,
- "to_be_deleted", to_be_deleted,
+ "to-be-deleted", to_be_deleted,
"visible", column_data->info_shown && !(attributes & GDA_VALUE_ATTR_UNUSED),
NULL);
}
@@ -1352,10 +1326,10 @@ cell_renderer_info_set_attributes (GtkTreeViewColumn *tree_column,
offset + col, &attributes, -1);
g_object_set (G_OBJECT (cell),
"editable", !column_data->data_locked && !(attributes & GDA_VALUE_ATTR_NO_MODIF),
- "value_attributes", attributes,
- "cell_background", GDAUI_COLOR_NORMAL_MODIF,
+ "value-attributes", attributes,
+ "cell-background", GDAUI_COLOR_NORMAL_MODIF,
"cell_background-set", ! (attributes & GDA_VALUE_ATTR_IS_UNCHANGED) || to_be_deleted,
- "to_be_deleted", to_be_deleted,
+ "to-be-deleted", to_be_deleted,
"visible", column_data->info_shown && !(attributes & GDA_VALUE_ATTR_UNUSED),
NULL);
}
@@ -1833,11 +1807,11 @@ action_filter_cb (GtkAction *action, GdauiRawGrid *grid)
GTK_WINDOW (grid->priv->filter_window));
#endif
- g_signal_connect (grid->priv->filter_window, "delete_event",
+ g_signal_connect (grid->priv->filter_window, "delete-event",
G_CALLBACK (filter_event), grid);
- g_signal_connect (grid->priv->filter_window, "button_press_event",
+ g_signal_connect (grid->priv->filter_window, "button-press-event",
G_CALLBACK (filter_event), grid);
- g_signal_connect (grid->priv->filter_window, "key_press_event",
+ g_signal_connect (grid->priv->filter_window, "key-press-event",
G_CALLBACK (key_press_filter_event), grid);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
@@ -2603,7 +2577,7 @@ gdaui_raw_grid_set_data_layout_from_file (GdauiRawGrid *grid, const gchar *file_
if (str) {
if (retval && !strcmp ((gchar*) str, "list")) // Now proceed
g_object_set (G_OBJECT (grid), "data-layout", node, NULL);
- //g_print ("name: %s\n", str);
+ g_print ("name: %s\n", str);
xmlFree (str);
}
}
diff --git a/libgda-ui/gdaui-server-operation.c b/libgda-ui/gdaui-server-operation.c
index 67d2da9..694c5c1 100644
--- a/libgda-ui/gdaui-server-operation.c
+++ b/libgda-ui/gdaui-server-operation.c
@@ -192,7 +192,7 @@ gdaui_server_operation_class_init (GdauiServerOperationClass *class)
object_class->set_property = gdaui_server_operation_set_property;
object_class->get_property = gdaui_server_operation_get_property;
g_object_class_install_property (object_class, PROP_SERVER_OP_OBJ,
- g_param_spec_object ("server_operation",
+ g_param_spec_object ("server-operation",
_("The specification of the operation to implement"),
NULL, GDA_TYPE_SERVER_OPERATION,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
@@ -235,7 +235,7 @@ gdaui_server_operation_new (GdaServerOperation *op)
{
GObject *obj;
- obj = g_object_new (GDAUI_TYPE_SERVER_OPERATION, "server_operation", op, NULL);
+ obj = g_object_new (GDAUI_TYPE_SERVER_OPERATION, "server-operation", op, NULL);
return (GtkWidget *) obj;
}
@@ -307,9 +307,9 @@ gdaui_server_operation_set_property (GObject *object,
g_object_ref (form->priv->op);
gdaui_server_operation_fill (form);
- g_signal_connect (G_OBJECT (form->priv->op), "sequence_item_added",
+ g_signal_connect (G_OBJECT (form->priv->op), "sequence-item-added",
G_CALLBACK (sequence_item_added_cb), form);
- g_signal_connect (G_OBJECT (form->priv->op), "sequence_item_remove",
+ g_signal_connect (G_OBJECT (form->priv->op), "sequence-item-remove",
G_CALLBACK (sequence_item_remove_cb), form);
}
break;
@@ -891,7 +891,7 @@ seq_del_item (GtkButton *button, GdauiServerOperation *form)
}
/*
- * For sequences: treating the "sequence_item_added" signal
+ * For sequences: treating the "sequence-item-added" signal
*/
struct MoveChild {
GtkWidget *widget;
@@ -977,7 +977,7 @@ sequence_item_added_cb (GdaServerOperation *op, const gchar *seq_path, gint item
}
/*
- * For sequences: treating the "sequence_item_remove" signal
+ * For sequences: treating the "sequence-item-remove" signal
*/
static void
sequence_item_remove_cb (GdaServerOperation *op, const gchar *seq_path, gint item_index, GdauiServerOperation *form)
@@ -1223,9 +1223,9 @@ create_table_fields_array_create_widget (GdauiServerOperation *form, const gchar
/* keep the selections in sync */
grid_iter = gdaui_data_selector_get_data_set (GDAUI_DATA_SELECTOR (grid_fields));
form_iter = gdaui_data_selector_get_data_set (GDAUI_DATA_SELECTOR (form_props));
- g_signal_connect (grid_iter, "row_changed",
+ g_signal_connect (grid_iter, "row-changed",
G_CALLBACK (create_table_grid_fields_iter_row_changed_cb), form_iter);
- g_signal_connect (form_iter, "row_changed",
+ g_signal_connect (form_iter, "row-changed",
G_CALLBACK (create_table_grid_fields_iter_row_changed_cb), grid_iter);
g_object_set_data (G_OBJECT (hlayout), "expand", GINT_TO_POINTER (TRUE));
diff --git a/libgda-ui/internal/popup-container.c b/libgda-ui/internal/popup-container.c
index 013c8df..936861e 100644
--- a/libgda-ui/internal/popup-container.c
+++ b/libgda-ui/internal/popup-container.c
@@ -69,7 +69,7 @@ key_press_popup (GtkWidget *widget, GdkEventKey *event, PopupContainer *containe
if (event->keyval != GDK_Escape)
return FALSE;
- g_signal_stop_emission_by_name (widget, "key_press_event");
+ g_signal_stop_emission_by_name (widget, "key-press-event");
gtk_widget_hide (GTK_WIDGET (container));
gtk_grab_remove (GTK_WIDGET (container));
return TRUE;
@@ -111,11 +111,11 @@ popup_container_init (PopupContainer *container, PopupContainerClass *klass)
gtk_widget_get_events (GTK_WIDGET (container)) | GDK_KEY_PRESS_MASK);
gtk_window_set_resizable (GTK_WINDOW (container), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (container), 5);
- g_signal_connect (G_OBJECT (container), "delete_event",
+ g_signal_connect (G_OBJECT (container), "delete-event",
G_CALLBACK (delete_popup), container);
- g_signal_connect (G_OBJECT (container), "key_press_event",
+ g_signal_connect (G_OBJECT (container), "key-press-event",
G_CALLBACK (key_press_popup), container);
- g_signal_connect (G_OBJECT (container), "button_press_event",
+ g_signal_connect (G_OBJECT (container), "button-press-event",
G_CALLBACK (button_press_popup), container);
}
diff --git a/libgda/gda-value.c b/libgda/gda-value.c
index 9ba24bd..601cd40 100644
--- a/libgda/gda-value.c
+++ b/libgda/gda-value.c
@@ -1129,7 +1129,7 @@ gda_value_new_blob (const guchar *val, glong size)
GdaBinary *bin;
blob = g_new0 (GdaBlob, 1);
- bin = (GdaBinary*)(&blob);
+ bin = (GdaBinary*)(blob);
bin->data = g_new (guchar, size);
memcpy ((gpointer) bin->data, (gpointer) val, size);
bin->binary_length = size;
@@ -1408,11 +1408,15 @@ void
gda_value_set_binary (GValue *value, const GdaBinary *binary)
{
g_return_if_fail (value);
- g_return_if_fail (binary);
l_g_value_unset (value);
g_value_init (value, GDA_TYPE_BINARY);
- g_value_set_boxed (value, binary);
+ if (binary)
+ g_value_set_boxed (value, binary);
+ else {
+ GdaBinary bin = {NULL, 0};
+ g_value_set_boxed (value, &bin);
+ }
}
/**
diff --git a/testing/gdaui-test-data-entries.c b/testing/gdaui-test-data-entries.c
index 57e76e5..14bd6c6 100644
--- a/testing/gdaui-test-data-entries.c
+++ b/testing/gdaui-test-data-entries.c
@@ -148,7 +148,7 @@ main (int argc, char **argv)
/* Create the main window */
mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (mainwin), 0);
- g_signal_connect (G_OBJECT (mainwin), "delete_event",
+ g_signal_connect (G_OBJECT (mainwin), "delete-event",
G_CALLBACK (delete_event), NULL);
g_signal_connect (G_OBJECT (mainwin), "destroy",
G_CALLBACK (destroy), NULL);
@@ -712,7 +712,7 @@ build_basic_test_for_gtype (GdaDataHandler *dh, GType type, const gchar *plugin_
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 1, 3, 3, 4, 0, 0, 0, 0);
g_object_set_data (G_OBJECT (wid), "value", label);
- g_signal_connect (G_OBJECT (wid), "contents_modified",
+ g_signal_connect (G_OBJECT (wid), "contents-modified",
G_CALLBACK (entry_contents_modified), NULL);
gtk_widget_show (label);
diff --git a/tools/browser/browser-connections-list.c b/tools/browser/browser-connections-list.c
index a0fbf48..2a7f968 100644
--- a/tools/browser/browser-connections-list.c
+++ b/tools/browser/browser-connections-list.c
@@ -325,7 +325,7 @@ browser_connections_list_show (BrowserConnection *current)
_clist = (BrowserConnectionsList *) clist;
gtk_window_set_title (GTK_WINDOW (clist), _("Opened connections"));
gtk_container_set_border_width (GTK_CONTAINER (clist), 6);
- g_signal_connect (G_OBJECT (clist), "delete_event",
+ g_signal_connect (G_OBJECT (clist), "delete-event",
G_CALLBACK (delete_event), NULL);
str = gda_gbr_get_file_path (GDA_DATA_DIR, LIBGDA_ABI_NAME, "pixmaps", "gda-browser-connected.png", NULL);
diff --git a/tools/browser/browser-window.c b/tools/browser/browser-window.c
index 84760b7..2b1249b 100644
--- a/tools/browser/browser-window.c
+++ b/tools/browser/browser-window.c
@@ -304,7 +304,7 @@ browser_window_new (BrowserConnection *bcnc, BrowserPerspectiveFactory *factory)
gtk_window_set_title (GTK_WINDOW (bwin), str);
g_free (str);
gtk_window_set_default_size ((GtkWindow*) bwin, 700, 600);
- g_signal_connect (G_OBJECT (bwin), "delete_event",
+ g_signal_connect (G_OBJECT (bwin), "delete-event",
G_CALLBACK (delete_event), bwin);
/* icon */
GdkPixbuf *icon;
diff --git a/tools/browser/canvas-example.c b/tools/browser/canvas-example.c
index 5b29935..3a53b88 100644
--- a/tools/browser/canvas-example.c
+++ b/tools/browser/canvas-example.c
@@ -61,7 +61,7 @@ main (int argc, char *argv[])
GtkWidget *window, *table, *canvas;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 640, 600);
- g_signal_connect (window, "delete_event", G_CALLBACK (on_delete_event),
+ g_signal_connect (window, "delete-event", G_CALLBACK (on_delete_event),
NULL);
table = gtk_table_new (3, 1, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]