[libgda] UI extension API changes, and better handle invalid GdaHolder
- From: Vivien Malerba <vivien src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgda] UI extension API changes, and better handle invalid GdaHolder
- Date: Sun, 24 Jan 2010 20:57:43 +0000 (UTC)
commit 6e9bcdac03f5824ff7e85940a992da037cb30686
Author: Vivien Malerba <malerba gnome-db org>
Date: Sun Jan 24 21:57:10 2010 +0100
UI extension API changes, and better handle invalid GdaHolder
doc/C/libgda-ui-sections.txt | 2 +-
doc/C/tmpl/gdaui-data-entry.sgml | 2 +-
.../gdaui-data-cell-renderer-textual.c | 4 +-
libgda-ui/data-entries/gdaui-entry-combo.c | 12 ++--
libgda-ui/data-entries/gdaui-entry-shell.c | 18 ++++++
libgda-ui/data-entries/gdaui-entry-shell.h | 1 +
libgda-ui/data-entries/gdaui-entry-wrapper.c | 56 ++++++++++---------
.../plugins/gdaui-data-cell-renderer-cgrid.c | 2 +-
.../plugins/gdaui-data-cell-renderer-password.c | 2 +-
libgda-ui/demos/basic_form.c | 2 +-
libgda-ui/gdaui-basic-form.c | 15 ++++--
libgda-ui/gdaui-data-entry.c | 22 ++++----
libgda-ui/gdaui-data-entry.h | 21 ++++----
libgda-ui/libgda-ui.symbols | 2 +-
testing/gdaui-test-data-entries.c | 2 +-
15 files changed, 96 insertions(+), 67 deletions(-)
---
diff --git a/doc/C/libgda-ui-sections.txt b/doc/C/libgda-ui-sections.txt
index 035eccb..bf43792 100644
--- a/doc/C/libgda-ui-sections.txt
+++ b/doc/C/libgda-ui-sections.txt
@@ -76,7 +76,7 @@ gdaui_data_entry_get_value_type
gdaui_data_entry_set_value
gdaui_data_entry_get_value
gdaui_data_entry_content_is_valid
-gdaui_data_entry_set_original_value
+gdaui_data_entry_set_reference_value
gdaui_data_entry_get_original_value
gdaui_data_entry_reset
gdaui_data_entry_set_value_default
diff --git a/doc/C/tmpl/gdaui-data-entry.sgml b/doc/C/tmpl/gdaui-data-entry.sgml
index 7c1a210..3826772 100644
--- a/doc/C/tmpl/gdaui-data-entry.sgml
+++ b/doc/C/tmpl/gdaui-data-entry.sgml
@@ -118,7 +118,7 @@ Data entry widget
@Returns:
-<!-- ##### FUNCTION gdaui_data_entry_set_original_value ##### -->
+<!-- ##### FUNCTION gdaui_data_entry_set_reference_value ##### -->
<para>
</para>
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 fbf27b7..b80e9d9 100644
--- a/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
+++ b/libgda-ui/data-entries/gdaui-data-cell-renderer-textual.c
@@ -709,10 +709,10 @@ gdaui_data_cell_renderer_textual_start_editing (GtkCellRenderer *cell,
g_object_get (G_OBJECT (cell), "text", &text, NULL);
orig = gda_data_handler_get_value_from_str (datacell->priv->dh, text, datacell->priv->type);
g_free (text);
- gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY (entry), orig);
+ gdaui_data_entry_set_reference_value (GDAUI_DATA_ENTRY (entry), orig);
}
else
- gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY (entry), datacell->priv->value);
+ gdaui_data_entry_set_reference_value (GDAUI_DATA_ENTRY (entry), datacell->priv->value);
info = g_new0 (GdauiDataCellRendererTextualInfo, 1);
g_object_set_data_full (G_OBJECT (entry), GDAUI_DATA_CELL_RENDERER_TEXTUAL_PATH, g_strdup (path), g_free);
diff --git a/libgda-ui/data-entries/gdaui-entry-combo.c b/libgda-ui/data-entries/gdaui-entry-combo.c
index 8191b6f..7b0e3d7 100644
--- a/libgda-ui/data-entries/gdaui-entry-combo.c
+++ b/libgda-ui/data-entries/gdaui-entry-combo.c
@@ -47,8 +47,8 @@ static void real_combo_unblock_signals (GdauiEntryCombo *wid);
static void gdaui_entry_combo_data_entry_init (GdauiDataEntryIface *iface);
static void gdaui_entry_combo_set_value (GdauiDataEntry *de, const GValue * value);
static GValue *gdaui_entry_combo_get_value (GdauiDataEntry *de);
-static void gdaui_entry_combo_set_value_orig (GdauiDataEntry *de, const GValue * value);
-static const GValue *gdaui_entry_combo_get_value_orig (GdauiDataEntry *de);
+static void gdaui_entry_combo_set_ref_value (GdauiDataEntry *de, const GValue * value);
+static const GValue *gdaui_entry_combo_get_ref_value (GdauiDataEntry *de);
static void gdaui_entry_combo_set_value_default (GdauiDataEntry *de, const GValue * value);
static void gdaui_entry_combo_set_attributes (GdauiDataEntry *de, guint attrs, guint mask);
static GdaValueAttribute gdaui_entry_combo_get_attributes (GdauiDataEntry *de);
@@ -133,8 +133,8 @@ gdaui_entry_combo_data_entry_init (GdauiDataEntryIface *iface)
iface->get_value_type = NULL;
iface->set_value = gdaui_entry_combo_set_value;
iface->get_value = gdaui_entry_combo_get_value;
- iface->set_value_orig = gdaui_entry_combo_set_value_orig;
- iface->get_value_orig = gdaui_entry_combo_get_value_orig;
+ iface->set_ref_value = gdaui_entry_combo_set_ref_value;
+ iface->get_ref_value = gdaui_entry_combo_get_ref_value;
iface->set_value_default = gdaui_entry_combo_set_value_default;
iface->set_attributes = gdaui_entry_combo_set_attributes;
iface->get_attributes = gdaui_entry_combo_get_attributes;
@@ -713,7 +713,7 @@ gdaui_entry_combo_get_value (GdauiDataEntry *iface)
}
static void
-gdaui_entry_combo_set_value_orig (GdauiDataEntry *iface, const GValue * value)
+gdaui_entry_combo_set_ref_value (GdauiDataEntry *iface, const GValue * value)
{
GdauiEntryCombo *combo;
@@ -725,7 +725,7 @@ gdaui_entry_combo_set_value_orig (GdauiDataEntry *iface, const GValue * value)
}
static const GValue *
-gdaui_entry_combo_get_value_orig (GdauiDataEntry *iface)
+gdaui_entry_combo_get_ref_value (GdauiDataEntry *iface)
{
GdauiEntryCombo *combo;
diff --git a/libgda-ui/data-entries/gdaui-entry-shell.c b/libgda-ui/data-entries/gdaui-entry-shell.c
index 20e981f..7072573 100644
--- a/libgda-ui/data-entries/gdaui-entry-shell.c
+++ b/libgda-ui/data-entries/gdaui-entry-shell.c
@@ -449,3 +449,21 @@ gdaui_entry_shell_refresh (GdauiEntryShell *shell)
gdaui_entry_shell_refresh_attributes (shell);
gdaui_entry_shell_refresh_status_display (shell);
}
+
+/**
+ * gdaui_entry_shell_set_unknown
+ * @shell: the GdauiEntryShell widget to refresh
+ * @unknown: set to %TRUE if @shell's contents is unavailable and should not be modified
+ *
+ * Defines if @shell's contents is in an undefined state (shows or hides @shell's contents)
+ */
+void
+gdaui_entry_shell_set_unknown (GdauiEntryShell *shell, gboolean unknown)
+{
+ g_return_if_fail (GDAUI_IS_ENTRY_SHELL (shell));
+
+ if (unknown)
+ gtk_widget_hide (shell->priv->hbox);
+ else
+ gtk_widget_show (shell->priv->hbox);
+}
diff --git a/libgda-ui/data-entries/gdaui-entry-shell.h b/libgda-ui/data-entries/gdaui-entry-shell.h
index d561514..76a9c6a 100644
--- a/libgda-ui/data-entries/gdaui-entry-shell.h
+++ b/libgda-ui/data-entries/gdaui-entry-shell.h
@@ -58,6 +58,7 @@ struct _GdauiEntryShellClass
GType gdaui_entry_shell_get_type (void) G_GNUC_CONST;
void gdaui_entry_shell_pack_entry (GdauiEntryShell *shell, GtkWidget *main_widget);
void gdaui_entry_shell_refresh (GdauiEntryShell *shell);
+void gdaui_entry_shell_set_unknown (GdauiEntryShell *shell, gboolean unknown);
G_END_DECLS
diff --git a/libgda-ui/data-entries/gdaui-entry-wrapper.c b/libgda-ui/data-entries/gdaui-entry-wrapper.c
index 49844a4..bfe5647 100644
--- a/libgda-ui/data-entries/gdaui-entry-wrapper.c
+++ b/libgda-ui/data-entries/gdaui-entry-wrapper.c
@@ -47,8 +47,8 @@ static void gdaui_entry_wrapper_set_value_type (GdauiDataEntry *de
static GType gdaui_entry_wrapper_get_value_type (GdauiDataEntry *de);
static void gdaui_entry_wrapper_set_value (GdauiDataEntry *de, const GValue *value);
static GValue *gdaui_entry_wrapper_get_value (GdauiDataEntry *de);
-static void gdaui_entry_wrapper_set_value_orig (GdauiDataEntry *de, const GValue *value);
-static const GValue *gdaui_entry_wrapper_get_value_orig (GdauiDataEntry *de);
+static void gdaui_entry_wrapper_set_ref_value (GdauiDataEntry *de, const GValue *value);
+static const GValue *gdaui_entry_wrapper_get_ref_value (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);
@@ -71,7 +71,7 @@ struct _GdauiEntryWrapperPriv {
guint signals_blocked;
GType type;
- GValue *value_orig;
+ GValue *value_ref;
GValue *value_default; /* Can be of any type, not just 'type' */
gboolean null_forced;
@@ -126,8 +126,8 @@ gdaui_entry_wrapper_data_entry_init (GdauiDataEntryIface *iface)
iface->get_value_type = gdaui_entry_wrapper_get_value_type;
iface->set_value = gdaui_entry_wrapper_set_value;
iface->get_value = gdaui_entry_wrapper_get_value;
- iface->set_value_orig = gdaui_entry_wrapper_set_value_orig;
- iface->get_value_orig = gdaui_entry_wrapper_get_value_orig;
+ iface->set_ref_value = gdaui_entry_wrapper_set_ref_value;
+ iface->get_ref_value = gdaui_entry_wrapper_get_ref_value;
iface->set_value_default = gdaui_entry_wrapper_set_value_default;
iface->set_attributes = gdaui_entry_wrapper_set_attributes;
iface->get_attributes = gdaui_entry_wrapper_get_attributes;
@@ -239,7 +239,7 @@ gdaui_entry_wrapper_init (GdauiEntryWrapper *mgwrap)
mgwrap->priv->signals_blocked = 0;
mgwrap->priv->type = G_TYPE_INVALID;
- mgwrap->priv->value_orig = NULL;
+ mgwrap->priv->value_ref = NULL;
mgwrap->priv->value_default = NULL;
mgwrap->priv->null_forced = FALSE;
@@ -264,8 +264,8 @@ gdaui_entry_wrapper_dispose (GObject *object)
mgwrap = GDAUI_ENTRY_WRAPPER (object);
if (mgwrap->priv) {
- if (mgwrap->priv->value_orig)
- gda_value_free (mgwrap->priv->value_orig);
+ if (mgwrap->priv->value_ref)
+ gda_value_free (mgwrap->priv->value_ref);
if (mgwrap->priv->value_default)
gda_value_free (mgwrap->priv->value_default);
@@ -416,9 +416,9 @@ gdaui_entry_wrapper_set_value_type (GdauiDataEntry *iface, GType type)
GValue *value;
GdaDataHandler *dh;
- if (mgwrap->priv->value_orig) {
- gda_value_free (mgwrap->priv->value_orig);
- mgwrap->priv->value_orig = NULL;
+ if (mgwrap->priv->value_ref) {
+ gda_value_free (mgwrap->priv->value_ref);
+ mgwrap->priv->value_ref = NULL;
}
if (mgwrap->priv->value_default) {
gda_value_free (mgwrap->priv->value_default);
@@ -431,7 +431,7 @@ gdaui_entry_wrapper_set_value_type (GdauiDataEntry *iface, GType type)
/* Set original value */
dh = gdaui_data_entry_get_handler (GDAUI_DATA_ENTRY (mgwrap));
value = gda_value_new_null ();
- gdaui_entry_wrapper_set_value_orig (GDAUI_DATA_ENTRY (mgwrap), value);
+ gdaui_entry_wrapper_set_ref_value (GDAUI_DATA_ENTRY (mgwrap), value);
gda_value_free (value);
}
}
@@ -462,12 +462,14 @@ gdaui_entry_wrapper_set_value (GdauiDataEntry *iface, const GValue *value)
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))
+ if (G_VALUE_TYPE ((GValue *) value) == GDA_TYPE_NULL)
mgwrap->priv->null_forced = TRUE;
else
mgwrap->priv->null_forced = FALSE;
+ gdaui_entry_shell_set_unknown ((GdauiEntryShell*) iface, FALSE);
}
else {
+ gdaui_entry_shell_set_unknown ((GdauiEntryShell*) iface, TRUE);
(*mgwrap->priv->real_class->real_set_value) (mgwrap, NULL);
mgwrap->priv->null_forced = TRUE;
}
@@ -508,7 +510,7 @@ gdaui_entry_wrapper_get_value (GdauiDataEntry *iface)
}
static void
-gdaui_entry_wrapper_set_value_orig (GdauiDataEntry *iface, const GValue *value)
+gdaui_entry_wrapper_set_ref_value (GdauiDataEntry *iface, const GValue *value)
{
GdauiEntryWrapper *mgwrap;
gboolean changed = TRUE;
@@ -533,9 +535,9 @@ gdaui_entry_wrapper_set_value_orig (GdauiDataEntry *iface, const GValue *value)
}
/* get rid on any existing orig value */
- if (mgwrap->priv->value_orig) {
- gda_value_free (mgwrap->priv->value_orig);
- mgwrap->priv->value_orig = NULL;
+ if (mgwrap->priv->value_ref) {
+ gda_value_free (mgwrap->priv->value_ref);
+ mgwrap->priv->value_ref = NULL;
}
/* apply changes, if any */
@@ -548,10 +550,10 @@ 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_VALUE_TYPE ((GValue *) value) == GDA_TYPE_NULL));
- mgwrap->priv->value_orig = gda_value_copy ((GValue *) value);
+ mgwrap->priv->value_ref = gda_value_copy ((GValue *) value);
}
else
- mgwrap->priv->value_orig = gda_value_new_null ();
+ mgwrap->priv->value_ref = gda_value_new_null ();
/* signal changes if any */
if (changed)
@@ -559,12 +561,12 @@ gdaui_entry_wrapper_set_value_orig (GdauiDataEntry *iface, const GValue *value)
}
static const GValue *
-gdaui_entry_wrapper_get_value_orig (GdauiDataEntry *iface)
+gdaui_entry_wrapper_get_ref_value (GdauiDataEntry *iface)
{
g_return_val_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface), NULL);
g_return_val_if_fail (GDAUI_ENTRY_WRAPPER (iface)->priv, NULL);
- return GDAUI_ENTRY_WRAPPER (iface)->priv->value_orig;
+ return GDAUI_ENTRY_WRAPPER (iface)->priv->value_ref;
}
static void
@@ -681,7 +683,7 @@ gdaui_entry_wrapper_set_attributes (GdauiDataEntry *iface, guint attrs, guint ma
if (attrs & GDA_VALUE_ATTR_IS_UNCHANGED) {
mgwrap->priv->default_forced = FALSE;
block_signals (mgwrap);
- gdaui_entry_wrapper_set_value (iface, mgwrap->priv->value_orig);
+ gdaui_entry_wrapper_set_value (iface, mgwrap->priv->value_ref);
unblock_signals (mgwrap);
gdaui_entry_wrapper_emit_signal (mgwrap);
}
@@ -762,18 +764,18 @@ gdaui_entry_wrapper_get_attributes (GdauiDataEntry *iface)
/* is unchanged */
if (has_current_value) {
- if (mgwrap->priv->value_orig &&
- (G_VALUE_TYPE (value) == G_VALUE_TYPE (mgwrap->priv->value_orig))) {
+ if (mgwrap->priv->value_ref &&
+ (G_VALUE_TYPE (value) == G_VALUE_TYPE (mgwrap->priv->value_ref))) {
if (gda_value_is_null (value))
retval = retval | GDA_VALUE_ATTR_IS_UNCHANGED;
else {
- if (! gda_value_compare (value, mgwrap->priv->value_orig))
+ if (! gda_value_differ (value, mgwrap->priv->value_ref))
retval = retval | GDA_VALUE_ATTR_IS_UNCHANGED;
}
}
}
else {
- if ((mgwrap->priv->real_class->value_is_equal_to) (mgwrap, mgwrap->priv->value_orig))
+ if ((mgwrap->priv->real_class->value_is_equal_to) (mgwrap, mgwrap->priv->value_ref))
retval = retval | GDA_VALUE_ATTR_IS_UNCHANGED;
}
@@ -789,7 +791,7 @@ gdaui_entry_wrapper_get_attributes (GdauiDataEntry *iface)
}
/* has original value? */
- if (mgwrap->priv->value_orig)
+ if (mgwrap->priv->value_ref)
retval = retval | GDA_VALUE_ATTR_HAS_VALUE_ORIG;
if (has_current_value)
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 b32427e..e371bb3 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
@@ -504,7 +504,7 @@ gdaui_data_cell_renderer_cgrid_start_editing (GtkCellRenderer *renderer,
"actions", FALSE,
NULL);
- gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY(entry),
+ gdaui_data_entry_set_reference_value (GDAUI_DATA_ENTRY(entry),
cgrid->priv->value);
g_signal_connect (G_OBJECT(entry), "editing-done",
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 8c895ac..eac46eb 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
@@ -466,7 +466,7 @@ gdaui_data_cell_renderer_password_start_editing (GtkCellRenderer *cell,
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);
+ gdaui_data_entry_set_reference_value (GDAUI_DATA_ENTRY (entry), datacell->priv->value);
info = g_new0 (GdauiDataCellRendererPasswordInfo, 1);
g_object_set_data_full (G_OBJECT (entry), GDAUI_DATA_CELL_RENDERER_PASSWORD_PATH, g_strdup (path), g_free);
diff --git a/libgda-ui/demos/basic_form.c b/libgda-ui/demos/basic_form.c
index 1630efc..eae99cd 100644
--- a/libgda-ui/demos/basic_form.c
+++ b/libgda-ui/demos/basic_form.c
@@ -61,7 +61,7 @@ do_basic_form (GtkWidget *do_widget)
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);
+ filename = demo_find_file ("custom_layout.xml", NULL);
gdaui_basic_form_set_layout_from_file (GDAUI_BASIC_FORM (form), filename, "simple");
g_free (filename);
diff --git a/libgda-ui/gdaui-basic-form.c b/libgda-ui/gdaui-basic-form.c
index 694a401..3cbff52 100644
--- a/libgda-ui/gdaui-basic-form.c
+++ b/libgda-ui/gdaui-basic-form.c
@@ -710,12 +710,15 @@ create_entry_widget (SingleEntry *sentry)
entry = GTK_WIDGET (gdaui_new_data_entry (type, plugin));
/* set current value */
- gdaui_data_entry_set_value (GDAUI_DATA_ENTRY (entry), val);
+ if (gda_holder_is_valid (param))
+ gdaui_data_entry_set_value (GDAUI_DATA_ENTRY (entry), val);
+ else
+ gdaui_data_entry_set_value (GDAUI_DATA_ENTRY (entry), NULL);
if (!nnul ||
(nnul && value &&
(G_VALUE_TYPE ((GValue *) value) != GDA_TYPE_NULL)))
- gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY (entry), value);
+ gdaui_data_entry_set_reference_value (GDAUI_DATA_ENTRY (entry), value);
if (default_val) {
gdaui_data_entry_set_value_default (GDAUI_DATA_ENTRY (entry), default_val);
@@ -1226,7 +1229,9 @@ entry_contents_modified (GdauiDataEntry *entry, SingleEntry *sentry)
/* GdaHolder refused value => reset GdaDataEntry */
g_signal_handler_block (G_OBJECT (entry),
sentry->entry_contents_modified_id);
- gdaui_data_entry_set_value (entry, gda_holder_get_value (param));
+ gdaui_data_entry_set_value (entry,
+ gda_holder_is_valid (param) ?
+ gda_holder_get_value (param) : NULL);
g_signal_handler_unblock (G_OBJECT (entry),
sentry->entry_contents_modified_id);
}
@@ -1331,7 +1336,7 @@ parameter_changed_cb (GdaHolder *param, SingleEntry *sentry)
}
if (sentry->single_param)
- gdaui_data_entry_set_value (entry, value);
+ gdaui_data_entry_set_value (entry, param_valid ? value : NULL);
else {
GSList *values = NULL;
GSList *list;
@@ -1393,7 +1398,7 @@ gdaui_basic_form_set_as_reference (GdauiBasicForm *form)
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),
+ gdaui_data_entry_set_reference_value (GDAUI_DATA_ENTRY (sentry->entry),
gda_holder_get_value (param));
g_signal_handler_unblock (G_OBJECT (sentry->entry),
sentry->entry_contents_modified_id);
diff --git a/libgda-ui/gdaui-data-entry.c b/libgda-ui/gdaui-data-entry.c
index dc77d44..5899011 100644
--- a/libgda-ui/gdaui-data-entry.c
+++ b/libgda-ui/gdaui-data-entry.c
@@ -165,10 +165,12 @@ gdaui_data_entry_get_value_type (GdauiDataEntry *de)
* @de: a #GtkWidget object which implements the #GdauiDataEntry interface
* @value: a #GValue, or %NULL
*
- * Push a value into the GdauiDataEntry. The value parameter must either be:
+ * Push a value into the #GdauiDataEntry. The value parameter must either be:
* <itemizedlist>
- * <listitem><para>NULL or of type GDA_TYPE_NULL, or</para></listitem>
- * <listitem><para>of type specified using gdaui_data_entry_set_value_type().</para></listitem>
+ * <listitem><para>of type GDA_TYPE_NULL (may be created using gda_value_new_null()) to
+ * represent a NULL value (SQL NULL), or</para></listitem>
+ * <listitem><para>of type specified using gdaui_data_entry_set_value_type(), or</para></listitem>
+ * <listitem><para>NULL to represent an undetermined value (usually an error)</para></listitem>
* </itemizedlist>
*
* Since: 4.2
@@ -233,7 +235,7 @@ gdaui_data_entry_content_is_valid (GdauiDataEntry *de, GError **error)
/**
- * gdaui_data_entry_set_original_value
+ * gdaui_data_entry_set_reference_value
* @de: a #GtkWidget object which implements the #GdauiDataEntry interface
* @value: a #GValue, or %NULL
*
@@ -243,12 +245,12 @@ gdaui_data_entry_content_is_valid (GdauiDataEntry *de, GError **error)
* Since: 4.2
*/
void
-gdaui_data_entry_set_original_value (GdauiDataEntry *de, const GValue *value)
+gdaui_data_entry_set_reference_value (GdauiDataEntry *de, const GValue *value)
{
g_return_if_fail (GDAUI_IS_DATA_ENTRY (de));
- if (GDAUI_DATA_ENTRY_GET_IFACE (de)->set_value_orig)
- (GDAUI_DATA_ENTRY_GET_IFACE (de)->set_value_orig) (de, value);
+ if (GDAUI_DATA_ENTRY_GET_IFACE (de)->set_ref_value)
+ (GDAUI_DATA_ENTRY_GET_IFACE (de)->set_ref_value) (de, value);
}
/**
@@ -266,7 +268,7 @@ gdaui_data_entry_reset (GdauiDataEntry *de)
g_return_if_fail (GDAUI_IS_DATA_ENTRY (de));
value = gdaui_data_entry_get_value (de);
- gdaui_data_entry_set_original_value (de, value);
+ gdaui_data_entry_set_reference_value (de, value);
if (value)
gda_value_free (value);
}
@@ -287,8 +289,8 @@ gdaui_data_entry_get_original_value (GdauiDataEntry *de)
{
g_return_val_if_fail (GDAUI_IS_DATA_ENTRY (de), NULL);
- if (GDAUI_DATA_ENTRY_GET_IFACE (de)->get_value_orig)
- return (GDAUI_DATA_ENTRY_GET_IFACE (de)->get_value_orig) (de);
+ if (GDAUI_DATA_ENTRY_GET_IFACE (de)->get_ref_value)
+ return (GDAUI_DATA_ENTRY_GET_IFACE (de)->get_ref_value) (de);
return NULL;
}
diff --git a/libgda-ui/gdaui-data-entry.h b/libgda-ui/gdaui-data-entry.h
index 8dabc3a..e3bec67 100644
--- a/libgda-ui/gdaui-data-entry.h
+++ b/libgda-ui/gdaui-data-entry.h
@@ -52,8 +52,8 @@ struct _GdauiDataEntryIface
GType (*get_value_type) (GdauiDataEntry *de);
void (*set_value) (GdauiDataEntry *de, const GValue * value);
GValue *(*get_value) (GdauiDataEntry *de);
- void (*set_value_orig) (GdauiDataEntry *de, const GValue * value);
- const GValue *(*get_value_orig) (GdauiDataEntry *de);
+ void (*set_ref_value) (GdauiDataEntry *de, const GValue * value);
+ const GValue *(*get_ref_value) (GdauiDataEntry *de);
void (*set_value_default) (GdauiDataEntry *de, const GValue * value);
void (*set_attributes) (GdauiDataEntry *de, GdaValueAttribute attrs, GdaValueAttribute mask);
GdaValueAttribute (*get_attributes) (GdauiDataEntry *de);
@@ -79,15 +79,16 @@ GType gdaui_data_entry_get_type (void) G_GNUC_CONST;
void gdaui_data_entry_set_value_type (GdauiDataEntry *de, GType type);
GType gdaui_data_entry_get_value_type (GdauiDataEntry *de);
-void gdaui_data_entry_set_value (GdauiDataEntry *de, const GValue * value);
+void gdaui_data_entry_set_value (GdauiDataEntry *de, const GValue *value);
GValue *gdaui_data_entry_get_value (GdauiDataEntry *de);
-gboolean gdaui_data_entry_content_is_valid (GdauiDataEntry *de, GError **error);
-void gdaui_data_entry_set_original_value (GdauiDataEntry *de, const GValue * value);
-const GValue *gdaui_data_entry_get_original_value (GdauiDataEntry *de);
-void gdaui_data_entry_reset (GdauiDataEntry *de);
-void gdaui_data_entry_set_value_default (GdauiDataEntry *de, const GValue * value);
-
-void gdaui_data_entry_set_attributes (GdauiDataEntry *de, GdaValueAttribute attrs, GdaValueAttribute mask);
+gboolean gdaui_data_entry_content_is_valid (GdauiDataEntry *de, GError **error);
+void gdaui_data_entry_set_reference_value (GdauiDataEntry *de, const GValue *value);
+const GValue *gdaui_data_entry_get_original_value (GdauiDataEntry *de);
+void gdaui_data_entry_reset (GdauiDataEntry *de);
+void gdaui_data_entry_set_value_default (GdauiDataEntry *de, const GValue *value);
+
+void gdaui_data_entry_set_attributes (GdauiDataEntry *de, GdaValueAttribute attrs,
+ GdaValueAttribute mask);
GdaValueAttribute gdaui_data_entry_get_attributes (GdauiDataEntry *de);
GdaDataHandler *gdaui_data_entry_get_handler (GdauiDataEntry *de);
diff --git a/libgda-ui/libgda-ui.symbols b/libgda-ui/libgda-ui.symbols
index 3763560..9a75da7 100644
--- a/libgda-ui/libgda-ui.symbols
+++ b/libgda-ui/libgda-ui.symbols
@@ -51,7 +51,7 @@
gdaui_data_entry_reset
gdaui_data_entry_set_attributes
gdaui_data_entry_set_editable
- gdaui_data_entry_set_original_value
+ gdaui_data_entry_set_reference_value
gdaui_data_entry_set_value
gdaui_data_entry_set_value_default
gdaui_data_entry_set_value_type
diff --git a/testing/gdaui-test-data-entries.c b/testing/gdaui-test-data-entries.c
index 14bd6c6..ca8fb06 100644
--- a/testing/gdaui-test-data-entries.c
+++ b/testing/gdaui-test-data-entries.c
@@ -911,7 +911,7 @@ orig_clicked_cb (GtkButton *button, GtkWidget *entry)
g_free (str);
}
- gdaui_data_entry_set_original_value (GDAUI_DATA_ENTRY (entry), value);
+ gdaui_data_entry_set_reference_value (GDAUI_DATA_ENTRY (entry), value);
gda_value_free (value);
entry_contents_modified (entry, NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]