1 /*
2  * Copyright (C) 2009 - 2011 Vivien Malerba <malerba@gnome-db.org>
3  * Copyright (C) 2010 David King <davidk@openismus.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA  02110-1301, USA.
19  */
20 
21 #include <glib/gi18n-lib.h>
22 #include "gdaui-entry-timestamp.h"
23 #include <libgda/gda-data-handler.h>
24 #include <gdk/gdkkeysyms.h>
25 #include <string.h>
26 
27 /*
28  * Main static functions
29  */
30 static void gdaui_entry_timestamp_class_init (GdauiEntryTimestampClass * class);
31 static void gdaui_entry_timestamp_init (GdauiEntryTimestamp * srv);
32 /* get a pointer to the parents to be able to call their destructor */
33 static GObjectClass  *parent_class = NULL;
34 
35 GType
gdaui_entry_timestamp_get_type(void)36 gdaui_entry_timestamp_get_type (void)
37 {
38 	static GType type = 0;
39 
40 	if (G_UNLIKELY (type == 0)) {
41 		static const GTypeInfo info = {
42 			sizeof (GdauiEntryTimestampClass),
43 			(GBaseInitFunc) NULL,
44 			(GBaseFinalizeFunc) NULL,
45 			(GClassInitFunc) gdaui_entry_timestamp_class_init,
46 			NULL,
47 			NULL,
48 			sizeof (GdauiEntryTimestamp),
49 			0,
50 			(GInstanceInitFunc) gdaui_entry_timestamp_init,
51 			0
52 		};
53 
54 		type = g_type_register_static (GDAUI_TYPE_ENTRY_COMMON_TIME, "GdauiEntryTimestamp", &info, 0);
55 	}
56 	return type;
57 }
58 
59 static void
gdaui_entry_timestamp_class_init(GdauiEntryTimestampClass * class)60 gdaui_entry_timestamp_class_init (GdauiEntryTimestampClass * class)
61 {
62 	parent_class = g_type_class_peek_parent (class);
63 }
64 
65 static void
gdaui_entry_timestamp_init(G_GNUC_UNUSED GdauiEntryTimestamp * gdaui_entry_timestamp)66 gdaui_entry_timestamp_init (G_GNUC_UNUSED GdauiEntryTimestamp * gdaui_entry_timestamp)
67 {
68 }
69 
70 /**
71  * gdaui_entry_timestamp_new:
72  * @dh: the data handler to be used by the new widget
73  *
74  * Creates a new data entry widget
75  *
76  * Returns: (transfer full): the new widget
77  */
78 GtkWidget *
gdaui_entry_timestamp_new(GdaDataHandler * dh)79 gdaui_entry_timestamp_new (GdaDataHandler *dh)
80 {
81 	GObject *obj;
82 
83 	g_return_val_if_fail (dh && GDA_IS_DATA_HANDLER (dh), NULL);
84 	g_return_val_if_fail (gda_data_handler_accepts_g_type (dh, GDA_TYPE_TIMESTAMP), NULL);
85 
86 	obj = g_object_new (GDAUI_TYPE_ENTRY_TIMESTAMP, "handler", dh, "type", GDA_TYPE_TIMESTAMP, NULL);
87 
88 	return GTK_WIDGET (obj);
89 }
90