From e1b49ca367d5f9fdc0f3b99dcfc33b6a0ab8b0df Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 26 Nov 2011 10:28:17 +0100 Subject: [PATCH] Implemented GdaExQueryEditorIWidget interface. --- docs/reference/gtkdateentry-decl-list.txt | 46 ++++--- docs/reference/gtkdateentry-decl.txt | 135 +++++++++---------- docs/reference/gtkdateentry-undocumented.txt | 13 +- docs/reference/gtkdateentry-unused.txt | 15 ++- docs/reference/gtkdateentry.args | 72 +++++++++- docs/reference/gtkdateentry.hierarchy | 7 +- docs/reference/gtkdateentry.interfaces | 5 +- docs/reference/gtkdateentry.prerequisites | 2 + docs/reference/tmpl/gtkdateentry-unused.sgml | 6 + docs/reference/tmpl/gtkdateentry.sgml | 39 +++++- src/gtkdateentry.c | 38 +++++- 11 files changed, 267 insertions(+), 111 deletions(-) diff --git a/docs/reference/gtkdateentry-decl-list.txt b/docs/reference/gtkdateentry-decl-list.txt index 4e60b94..45e7077 100644 --- a/docs/reference/gtkdateentry-decl-list.txt +++ b/docs/reference/gtkdateentry-decl-list.txt @@ -1,48 +1,50 @@
gtkdateentry GtkDateEntry -GTK_TYPE_DATE_ENTRY -GTK_DATE_ENTRY -GTK_DATE_ENTRY_CLASS -GTK_DATE_ENTRY_GET_CLASS GtkDateEntry GtkDateEntryClass -gtk_date_entry_new -gtk_date_entry_set_separator -gtk_date_entry_set_format -gtk_date_entry_get_text +gtk_date_entry_get_gdate +gtk_date_entry_get_gdatetime +gtk_date_entry_get_sql gtk_date_entry_get_strf +gtk_date_entry_get_text gtk_date_entry_get_tm -gtk_date_entry_get_gdate +gtk_date_entry_is_date_visible +gtk_date_entry_is_time_visible +gtk_date_entry_is_valid +gtk_date_entry_new +gtk_date_entry_set_calendar_button_visible +gtk_date_entry_set_date_gdate +gtk_date_entry_set_date_gdatetime gtk_date_entry_set_date_strf gtk_date_entry_set_date_tm -gtk_date_entry_set_date_gdate -gtk_date_entry_is_valid +gtk_date_entry_set_date_visible gtk_date_entry_set_editable gtk_date_entry_set_editable_with_calendar -gtk_date_entry_set_calendar_button_visible +gtk_date_entry_set_format +gtk_date_entry_set_separator +gtk_date_entry_set_time_separator +gtk_date_entry_set_time_visible -GTK_IS_DATE +GTK_DATE_ENTRY +GTK_DATE_ENTRY_CLASS +GTK_DATE_ENTRY_GET_CLASS +GTK_IS_DATE_ENTRY +GTK_IS_DATE_ENTRY_CLASS +GTK_TYPE_DATE_ENTRY gtk_date_entry_get_type -GTK_IS_DATE_CLASS
gtkformwidgetdateentry -GtkFormWidgetDateEntry GtkFormWidgetDateEntry GtkFormWidgetDateEntryClass -gtk_form_widget_date_entry_new -gtk_form_widget_date_entry_get_value_stringify -gtk_form_widget_date_entry_set_value_stringify -gtk_form_widget_date_entry_set_editable -GTK_FORM_WIDGET_DATE_ENTRY GTK_FORM_IS_WIDGET_DATE_ENTRY +GTK_FORM_IS_WIDGET_DATE_ENTRY_CLASS GTK_FORM_TYPE_WIDGET_DATE_ENTRY -gtk_form_widget_date_entry_get_type +GTK_FORM_WIDGET_DATE_ENTRY GTK_FORM_WIDGET_DATE_ENTRY_CLASS -GTK_FORM_IS_WIDGET_DATE_ENTRY_CLASS GTK_FORM_WIDGET_DATE_ENTRY_GET_CLASS
diff --git a/docs/reference/gtkdateentry-decl.txt b/docs/reference/gtkdateentry-decl.txt index d1fea4a..75fd265 100644 --- a/docs/reference/gtkdateentry-decl.txt +++ b/docs/reference/gtkdateentry-decl.txt @@ -11,12 +11,12 @@ #define GTK_DATE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_DATE_ENTRY, GtkDateEntry)) -GTK_IS_DATE -#define GTK_IS_DATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DATE_ENTRY)) +GTK_IS_DATE_ENTRY +#define GTK_IS_DATE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DATE_ENTRY)) -GTK_IS_DATE_CLASS -#define GTK_IS_DATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DATE_ENTRY)) +GTK_IS_DATE_ENTRY_CLASS +#define GTK_IS_DATE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DATE_ENTRY)) GTK_DATE_ENTRY_GET_CLASS @@ -24,99 +24,133 @@ GtkDateEntry - - -GtkDateEntryClass - - -GtkDateEntry struct _GtkDateEntry { - GtkHBox hbox; + GtkBin parent; }; GtkDateEntryClass struct _GtkDateEntryClass { - GtkHBoxClass parent_class; + GtkBinClass parent_class; }; gtk_date_entry_get_type -GType +GType void gtk_date_entry_new -GtkWidget * -const gchar *format, const gchar separator, gboolean calendar_button_is_visible +GtkWidget * +const gchar *format, const gchar *separator, gboolean calendar_button_is_visible gtk_date_entry_set_separator -void -GtkDateEntry *date, const gchar separator +gboolean +GtkDateEntry *date, const gchar *separator + + +gtk_date_entry_set_time_separator +gboolean +GtkDateEntry *date, const gchar *separator gtk_date_entry_set_format -gboolean +gboolean GtkDateEntry *date, const gchar *format gtk_date_entry_get_text -const gchar * +const gchar * GtkDateEntry *date gtk_date_entry_get_strf -const gchar * -GtkDateEntry *date, const gchar *format, gchar separator +const gchar * +GtkDateEntry *date, const gchar *format, const gchar *separator, const gchar *time_separator + + +gtk_date_entry_get_sql +const gchar * +GtkDateEntry *date gtk_date_entry_get_tm -struct tm * +struct tm * GtkDateEntry *date gtk_date_entry_get_gdate -GDate * +GDate * +GtkDateEntry *date + + +gtk_date_entry_get_gdatetime +GDateTime * GtkDateEntry *date gtk_date_entry_set_date_strf -gboolean -GtkDateEntry *date, const gchar *str, const gchar *format, const gchar separator +gboolean +GtkDateEntry *date, const gchar *str, const gchar *format gtk_date_entry_set_date_tm -void +void GtkDateEntry *date, const struct tm tmdate gtk_date_entry_set_date_gdate -void +void GtkDateEntry *date, const GDate *gdate +gtk_date_entry_set_date_gdatetime +void +GtkDateEntry *date, const GDateTime *gdatetime + + gtk_date_entry_is_valid -gboolean +gboolean GtkDateEntry *date gtk_date_entry_set_editable -void +void GtkDateEntry *date, gboolean is_editable gtk_date_entry_set_editable_with_calendar -void +void GtkDateEntry *date, gboolean is_editable_with_calendar gtk_date_entry_set_calendar_button_visible -void +void +GtkDateEntry *date, gboolean is_visible + + +gtk_date_entry_set_date_visible +void +GtkDateEntry *date, gboolean is_visible + + +gtk_date_entry_is_date_visible +gboolean +GtkDateEntry *date + + +gtk_date_entry_set_time_visible +void GtkDateEntry *date, gboolean is_visible + +gtk_date_entry_is_time_visible +gboolean +GtkDateEntry *date + GTK_FORM_TYPE_WIDGET_DATE_ENTRY #define GTK_FORM_TYPE_WIDGET_DATE_ENTRY (gtk_form_widget_date_entry_get_type ()) @@ -142,47 +176,8 @@ GtkDateEntry *date, gboolean is_visible #define GTK_FORM_WIDGET_DATE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_FORM_TYPE_WIDGET_DATE_ENTRY, GtkFormWidgetDateEntryClass)) -GtkFormWidgetDateEntry - - GtkFormWidgetDateEntryClass GtkFormWidgetDateEntry -struct _GtkFormWidgetDateEntry - { - GtkFormWidget parent; - }; - - -GtkFormWidgetDateEntryClass -struct _GtkFormWidgetDateEntryClass - { - GtkFormWidgetClass parent_class; - }; - -gtk_form_widget_date_entry_get_type -GType -void - - -gtk_form_widget_date_entry_new -GtkFormWidget * -void - - -gtk_form_widget_date_entry_get_value_stringify -gchar * -GtkFormWidget *widget - - -gtk_form_widget_date_entry_set_value_stringify -gboolean -GtkFormWidget *fwidget, const gchar *value - - -gtk_form_widget_date_entry_set_editable -void -GtkFormWidget *fwidget, gboolean editable - diff --git a/docs/reference/gtkdateentry-undocumented.txt b/docs/reference/gtkdateentry-undocumented.txt index 26999e9..9a8546d 100644 --- a/docs/reference/gtkdateentry-undocumented.txt +++ b/docs/reference/gtkdateentry-undocumented.txt @@ -1,12 +1,17 @@ -68% symbol docs coverage. -15 symbols documented. -0 symbols incomplete. -7 not documented. +70% symbol docs coverage. +26 symbols documented. +1 symbols incomplete. +11 not documented. gtk_date_entry_get_gdate +gtk_date_entry_get_gdatetime +gtk_date_entry_get_sql gtk_date_entry_get_strf gtk_date_entry_get_tm +gtk_date_entry_is_date_visible +gtk_date_entry_is_time_visible +gtk_date_entry_set_separator (Returns) gtk_form_widget_date_entry_get_value_stringify gtk_form_widget_date_entry_new gtk_form_widget_date_entry_set_value_stringify diff --git a/docs/reference/gtkdateentry-unused.txt b/docs/reference/gtkdateentry-unused.txt index 384eb58..3373d1a 100644 --- a/docs/reference/gtkdateentry-unused.txt +++ b/docs/reference/gtkdateentry-unused.txt @@ -4,19 +4,24 @@ GTK_FORM_TYPE_WIDGET_DATE_ENTRY GTK_FORM_WIDGET_DATE_ENTRY GTK_FORM_WIDGET_DATE_ENTRY_CLASS GTK_FORM_WIDGET_DATE_ENTRY_GET_CLASS +GTK_IS_DATE_ENTRY +GTK_IS_DATE_ENTRY_CLASS GtkFormWidgetDateEntry GtkFormWidgetDateEntryClass gtk_date_entry_get_gdate +gtk_date_entry_get_gdatetime +gtk_date_entry_get_sql gtk_date_entry_get_tm +gtk_date_entry_is_date_visible +gtk_date_entry_is_time_visible gtk_date_entry_is_valid gtk_date_entry_set_calendar_button_visible gtk_date_entry_set_date_gdate +gtk_date_entry_set_date_gdatetime gtk_date_entry_set_date_strf gtk_date_entry_set_date_tm +gtk_date_entry_set_date_visible gtk_date_entry_set_editable gtk_date_entry_set_editable_with_calendar -gtk_form_widget_date_entry_get_type -gtk_form_widget_date_entry_get_value_stringify -gtk_form_widget_date_entry_new -gtk_form_widget_date_entry_set_editable -gtk_form_widget_date_entry_set_value_stringify +gtk_date_entry_set_time_separator +gtk_date_entry_set_time_visible diff --git a/docs/reference/gtkdateentry.args b/docs/reference/gtkdateentry.args index a3f0092..8c56661 100644 --- a/docs/reference/gtkdateentry.args +++ b/docs/reference/gtkdateentry.args @@ -1,5 +1,25 @@ -GtkDateEntry::editable-with-calendar +GtkDateEntry::calendar-button-visible +gboolean + +rw +TRUE to show the calendar's button +Determines if the calendar's button is visible or not. +TRUE + + + +GtkDateEntry::date-visible +gboolean + +rw +TRUE to show the date part +Determines if the date part of the widget is visible or not. +TRUE + + + +GtkDateEntry::editable-from-calendar gboolean rw @@ -8,3 +28,53 @@ FALSE + +GtkDateEntry::format +gchar* + +rw +The date's format +The date's format. +"" + + + +GtkDateEntry::separator +gchar* + +rw +The separator +The separator between day, month and year. +"" + + + +GtkDateEntry::time-separator +gchar* + +rw +The time separator +The separator between hours, minutes and seconds. +"" + + + +GtkDateEntry::time-visible +gboolean + +rw +TRUE to show the time part +Determines if the time part of the widget is visible or not. +TRUE + + + +GtkDateEntry::time-with-seconds +gboolean + +rw +TRUE to show the seconds in time part +Determines if the seconds in the time part of the widget are visible or not. +TRUE + + diff --git a/docs/reference/gtkdateentry.hierarchy b/docs/reference/gtkdateentry.hierarchy index 1a5923c..7c88479 100644 --- a/docs/reference/gtkdateentry.hierarchy +++ b/docs/reference/gtkdateentry.hierarchy @@ -3,9 +3,8 @@ GObject GtkObject GtkWidget GtkContainer - GtkBox - GtkHBox - GtkDateEntry + GtkBin + GtkDateEntry GtkStyle GdkDrawable GdkWindow @@ -16,4 +15,4 @@ GInterface GTypePlugin AtkImplementorIface GtkBuildable - GtkOrientable + GdaExQueryEditorIWidget diff --git a/docs/reference/gtkdateentry.interfaces b/docs/reference/gtkdateentry.interfaces index 6ecc93e..8e35c02 100644 --- a/docs/reference/gtkdateentry.interfaces +++ b/docs/reference/gtkdateentry.interfaces @@ -1,5 +1,4 @@ GtkWidget AtkImplementorIface GtkBuildable GtkContainer AtkImplementorIface GtkBuildable -GtkBox AtkImplementorIface GtkBuildable GtkOrientable -GtkHBox AtkImplementorIface GtkBuildable GtkOrientable -GtkDateEntry AtkImplementorIface GtkBuildable GtkOrientable +GtkBin AtkImplementorIface GtkBuildable +GtkDateEntry AtkImplementorIface GtkBuildable GdaExQueryEditorIWidget diff --git a/docs/reference/gtkdateentry.prerequisites b/docs/reference/gtkdateentry.prerequisites index e69de29..2edef48 100644 --- a/docs/reference/gtkdateentry.prerequisites +++ b/docs/reference/gtkdateentry.prerequisites @@ -0,0 +1,2 @@ +GtkBuildable GObject +GdaExQueryEditorIWidget GObject diff --git a/docs/reference/tmpl/gtkdateentry-unused.sgml b/docs/reference/tmpl/gtkdateentry-unused.sgml index b0f165c..419b4a3 100644 --- a/docs/reference/tmpl/gtkdateentry-unused.sgml +++ b/docs/reference/tmpl/gtkdateentry-unused.sgml @@ -25,3 +25,9 @@ + + + + + + diff --git a/docs/reference/tmpl/gtkdateentry.sgml b/docs/reference/tmpl/gtkdateentry.sgml index 5594d3d..05f1f46 100644 --- a/docs/reference/tmpl/gtkdateentry.sgml +++ b/docs/reference/tmpl/gtkdateentry.sgml @@ -27,7 +27,42 @@ using the functions below. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -50,6 +85,7 @@ using the functions below. @date: @separator: +@Returns: @@ -79,6 +115,7 @@ using the functions below. @date: @format: @separator: +@time_separator: @Returns: diff --git a/src/gtkdateentry.c b/src/gtkdateentry.c index e0d907c..a40e4b8 100644 --- a/src/gtkdateentry.c +++ b/src/gtkdateentry.c @@ -36,6 +36,7 @@ #endif #include +#include #include "gtkdateentry.h" @@ -55,6 +56,8 @@ enum static void gtk_date_entry_class_init (GtkDateEntryClass *klass); static void gtk_date_entry_init (GtkDateEntry *date); +static void gtk_date_entry_gdaex_query_editor_iwidget_interface_init (GdaExQueryEditorIWidgetIface *iface); + static void gtk_date_entry_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_date_entry_size_allocate (GtkWidget *widget, @@ -92,6 +95,10 @@ static void gtk_date_entry_get_property (GObject *object, static gchar *gtk_date_entry_get_separator_from_locale (); static gchar *gtk_date_entry_get_format_from_locale (); +static const gchar *gtk_date_entry_get_value (GdaExQueryEditorIWidget *iwidget); +static const gchar *gtk_date_entry_get_value_sql (GdaExQueryEditorIWidget *iwidget); +static void gtk_date_entry_set_value (GdaExQueryEditorIWidget *iwidget, const gchar *value); + static GtkWidgetClass *parent_class = NULL; @@ -122,7 +129,9 @@ struct _GtkDateEntryPrivate gboolean time_with_seconds; }; -G_DEFINE_TYPE (GtkDateEntry, gtk_date_entry, GTK_TYPE_BIN) +G_DEFINE_TYPE_WITH_CODE (GtkDateEntry, gtk_date_entry, GTK_TYPE_BIN, + G_IMPLEMENT_INTERFACE (GDAEX_QUERY_EDITOR_TYPE_IWIDGET, + gtk_date_entry_gdaex_query_editor_iwidget_interface_init)); static void gtk_date_entry_class_init (GtkDateEntryClass *klass) @@ -297,6 +306,14 @@ gtk_date_entry_init (GtkDateEntry *date) gtk_widget_show (priv->spnSeconds); } +static void +gtk_date_entry_gdaex_query_editor_iwidget_interface_init (GdaExQueryEditorIWidgetIface *iface) +{ + iface->get_value = gtk_date_entry_get_value; + iface->get_value_sql = gtk_date_entry_get_value_sql; + iface->set_value = gtk_date_entry_set_value; +} + /** * gtk_date_entry_new: * @format: a #gchar which is the date's format. @@ -1762,3 +1779,22 @@ static gchar return fmt; } + +static const gchar +*gtk_date_entry_get_value (GdaExQueryEditorIWidget *iwidget) +{ + return gtk_date_entry_get_strf (GTK_DATE_ENTRY (iwidget), gtk_date_entry_is_time_visible (GTK_DATE_ENTRY (iwidget)) ? "dmYHMS" : "dmY", NULL, NULL); +} + +static const gchar +*gtk_date_entry_get_value_sql (GdaExQueryEditorIWidget *iwidget) +{ + return gtk_date_entry_get_sql (GTK_DATE_ENTRY (iwidget)); +} + +static void +gtk_date_entry_set_value (GdaExQueryEditorIWidget *iwidget, + const gchar *value) +{ + gtk_date_entry_set_date_strf (GTK_DATE_ENTRY (iwidget), value == NULL ? g_date_time_format (g_date_time_new_now_local (), "%Y-%m-%d %H.%M.%S") : value, "YmdHMS"); +} -- 2.49.0