From 2bf580896253603395120e5e019212185d93c0fa Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 9 Jan 2016 12:57:02 +0100 Subject: [PATCH] Adjustments/bugfixes for QueryEditorIWidget. --- src/queryeditor_widget_interface.c | 17 ++++++++++++++++- src/queryeditor_widget_interface.h | 16 +++++++++++----- src/queryeditorentry.c | 16 ++++++++-------- src/queryeditorentry.h | 14 +++++++------- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/queryeditor_widget_interface.c b/src/queryeditor_widget_interface.c index 69bd95d..4b0231c 100644 --- a/src/queryeditor_widget_interface.c +++ b/src/queryeditor_widget_interface.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Andrea Zagli + * Copyright (C) 2011-2016 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -88,3 +88,18 @@ gdaex_query_editor_iwidget_set_value (GdaExQueryEditorIWidget *iwidget, (* iface->set_value) (iwidget, value); } } + +void +gdaex_query_editor_xml_parsing (GdaExQueryEditorIWidget *iwidget, xmlNode *xnode) +{ + GdaExQueryEditorIWidgetIface *iface; + + g_return_if_fail (GDAEX_QUERY_EDITOR_IS_IWIDGET (iwidget)); + + iface = GDAEX_QUERY_EDITOR_IWIDGET_GET_IFACE (iwidget); + + if (iface->xml_parsing) + { + (* iface->xml_parsing) (iwidget, xnode); + } +} diff --git a/src/queryeditor_widget_interface.h b/src/queryeditor_widget_interface.h index 4677692..5da0484 100644 --- a/src/queryeditor_widget_interface.h +++ b/src/queryeditor_widget_interface.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Andrea Zagli + * Copyright (C) 2011-2016 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,8 @@ #include +#include + G_BEGIN_DECLS @@ -38,17 +40,21 @@ struct _GdaExQueryEditorIWidgetIface { GTypeInterface g_iface; - const gchar *(*get_value) (GdaExQueryEditorIWidget *irole); - const gchar *(*get_value_sql) (GdaExQueryEditorIWidget *irole); - void (*set_value) (GdaExQueryEditorIWidget *irole, const gchar *value); + const gchar *(*get_value) (GdaExQueryEditorIWidget *iwidget); + const gchar *(*get_value_sql) (GdaExQueryEditorIWidget *iwidget); + void (*set_value) (GdaExQueryEditorIWidget *iwidget, const gchar *value); + + void (*xml_parsing) (GdaExQueryEditorIWidget *iwidget, xmlNode *xnode); }; -GType gdaex_query_editor_irole_get_type (void) G_GNUC_CONST; +GType gdaex_query_editor_iwidget_get_type (void) G_GNUC_CONST; const gchar *gdaex_query_editor_iwidget_get_value (GdaExQueryEditorIWidget *iwidget); const gchar *gdaex_query_editor_iwidget_get_value_sql (GdaExQueryEditorIWidget *iwidget); void gdaex_query_editor_iwidget_set_value (GdaExQueryEditorIWidget *iwidget, const gchar *value); +void gdaex_query_editor_xml_parsing (GdaExQueryEditorIWidget *iwidget, xmlNode *xnode); + G_END_DECLS diff --git a/src/queryeditorentry.c b/src/queryeditorentry.c index fceb7f4..b290a3f 100644 --- a/src/queryeditorentry.c +++ b/src/queryeditorentry.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Andrea Zagli + * Copyright (C) 2011-2016 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -43,7 +43,7 @@ static const gchar *gdaex_query_editor_entry_get_value (GdaExQueryEditorIWidget static const gchar *gdaex_query_editor_entry_get_value_sql (GdaExQueryEditorIWidget *iwidget); static void gdaex_query_editor_entry_set_value (GdaExQueryEditorIWidget *iwidget, const gchar *value); -#define GDAEX_QUERY_EDITOR_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_MASKED_ENTRY, GdaExQueryEditorEntryPrivate)) +#define GDAEX_QUERY_EDITOR_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ENTRY, GdaExQueryEditorEntryPrivate)) typedef struct _GdaExQueryEditorEntryPrivate GdaExQueryEditorEntryPrivate; struct _GdaExQueryEditorEntryPrivate @@ -67,9 +67,9 @@ gdaex_query_editor_entry_class_init (GdaExQueryEditorEntryClass *klass) } static void -gdaex_query_editor_entry_init (GdaExQueryEditorEntry *masked_entry) +gdaex_query_editor_entry_init (GdaExQueryEditorEntry *entry) { - GdaExQueryEditorEntryPrivate *priv = GDAEX_QUERY_EDITOR_ENTRY_GET_PRIVATE (masked_entry); + GdaExQueryEditorEntryPrivate *priv = GDAEX_QUERY_EDITOR_ENTRY_GET_PRIVATE (entry); } static void @@ -96,8 +96,8 @@ gdaex_query_editor_entry_new () static void gdaex_query_editor_entry_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { - GdaExQueryEditorEntry *masked_entry = GDAEX_QUERY_EDITOR_ENTRY (object); - GdaExQueryEditorEntryPrivate *priv = GDAEX_QUERY_EDITOR_ENTRY_GET_PRIVATE (masked_entry); + GdaExQueryEditorEntry *entry = GDAEX_QUERY_EDITOR_ENTRY (object); + GdaExQueryEditorEntryPrivate *priv = GDAEX_QUERY_EDITOR_ENTRY_GET_PRIVATE (entry); switch (property_id) { @@ -110,8 +110,8 @@ gdaex_query_editor_entry_set_property (GObject *object, guint property_id, const static void gdaex_query_editor_entry_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { - GdaExQueryEditorEntry *masked_entry = GDAEX_QUERY_EDITOR_ENTRY (object); - GdaExQueryEditorEntryPrivate *priv = GDAEX_QUERY_EDITOR_ENTRY_GET_PRIVATE (masked_entry); + GdaExQueryEditorEntry *entry = GDAEX_QUERY_EDITOR_ENTRY (object); + GdaExQueryEditorEntryPrivate *priv = GDAEX_QUERY_EDITOR_ENTRY_GET_PRIVATE (entry); switch (property_id) { diff --git a/src/queryeditorentry.h b/src/queryeditorentry.h index 01fc784..204bc1e 100644 --- a/src/queryeditorentry.h +++ b/src/queryeditorentry.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Andrea Zagli + * Copyright (C) 2011-2016 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,12 +26,12 @@ G_BEGIN_DECLS -#define GTK_TYPE_MASKED_ENTRY (gdaex_query_editor_entry_get_type ()) -#define GDAEX_QUERY_EDITOR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MASKED_ENTRY, GdaExQueryEditorEntry)) -#define GDAEX_QUERY_EDITOR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MASKED_ENTRY, GdaExQueryEditorEntryClass)) -#define GTK_IS_MASKED_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MASKED_ENTRY)) -#define GTK_IS_MASKED_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MASKED_ENTRY)) -#define GDAEX_QUERY_EDITOR_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MASKED_ENTRY, GdaExQueryEditorEntryClass)) +#define GDAEX_QUERY_EDITOR_TYPE_ENTRY (gdaex_query_editor_entry_get_type ()) +#define GDAEX_QUERY_EDITOR_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDAEX_QUERY_EDITOR_TYPE_ENTRY, GdaExQueryEditorEntry)) +#define GDAEX_QUERY_EDITOR_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDAEX_QUERY_EDITOR_TYPE_ENTRY, GdaExQueryEditorEntryClass)) +#define GDAEX_QUERY_EDITOR_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDAEX_QUERY_EDITOR_TYPE_ENTRY)) +#define GDAEX_QUERY_EDITOR_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDAEX_QUERY_EDITOR_TYPE__ENTRY)) +#define GDAEX_QUERY_EDITOR_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDAEX_QUERY_EDITOR_TYPE_ENTRY, GdaExQueryEditorEntryClass)) typedef struct _GdaExQueryEditorEntry GdaExQueryEditorEntry; -- 2.49.0