From: Andrea Zagli Date: Sun, 27 Jun 2010 11:00:02 +0000 (+0200) Subject: Plugin for libgtkform. X-Git-Tag: 0.0.3~6 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=f46804f7a07002d312b779afc2914181e3740b9d;p=libgtkdateentry Plugin for libgtkform. --- diff --git a/.gitignore b/.gitignore index 8685cb3..2521cb4 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,5 @@ mkinstalldirs stamp-it intltool-* Rules-quot +tests/plugin_gtkform +*.exe diff --git a/configure.ac b/configure.ac index de26c58..8be725a 100644 --- a/configure.ac +++ b/configure.ac @@ -32,12 +32,22 @@ GTK_DOC_CHECK(1.0) PKG_CHECK_MODULES(GTKDATEENTRY, [gtk+-2.0 >= 2.6.8 libgtkmaskedentry >= 0.0.1]) PKG_CHECK_EXISTS(gladeui-1.0 >= 3.2.0, [GLADEUI_FOUND=yes], [GLADEUI_FOUND=no]) +PKG_CHECK_EXISTS(libgtkform >= 0.2.0, [LIBGTKFORM_FOUND=yes], [LIBGTKFORM_FOUND=no]) AM_CONDITIONAL(GLADEUI, test $GLADEUI_FOUND = yes) +AM_CONDITIONAL(LIBGTKFORM_FOUND, test $LIBGTKFORM_FOUND = yes) AC_SUBST(GTKDATEENTRY_CFLAGS) AC_SUBST(GTKDATEENTRY_LIBS) +if test $LIBGTKFORM_FOUND = yes; then +PKG_CHECK_MODULES(GTKFORM, libgtkform >= 0.2.0) + +AC_SUBST(GTKFORM_CFLAGS) +AC_SUBST(GTKFORM_LIBS) +AC_SUBST(LIBGTKFORM_FOUND) +fi + # Output files AC_CONFIG_FILES([ libgtkdateentry.pc diff --git a/docs/reference/gtkdateentry-decl-list.txt b/docs/reference/gtkdateentry-decl-list.txt index 5ea4575..4e60b94 100644 --- a/docs/reference/gtkdateentry-decl-list.txt +++ b/docs/reference/gtkdateentry-decl-list.txt @@ -27,3 +27,22 @@ 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_TYPE_WIDGET_DATE_ENTRY +gtk_form_widget_date_entry_get_type +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 a5958a2..d1fea4a 100644 --- a/docs/reference/gtkdateentry-decl.txt +++ b/docs/reference/gtkdateentry-decl.txt @@ -117,3 +117,72 @@ GtkDateEntry *date, gboolean is_editable_with_calendar void GtkDateEntry *date, gboolean is_visible + +GTK_FORM_TYPE_WIDGET_DATE_ENTRY +#define GTK_FORM_TYPE_WIDGET_DATE_ENTRY (gtk_form_widget_date_entry_get_type ()) + + +GTK_FORM_WIDGET_DATE_ENTRY +#define GTK_FORM_WIDGET_DATE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_FORM_TYPE_WIDGET_DATE_ENTRY, GtkFormWidgetDateEntry)) + + +GTK_FORM_WIDGET_DATE_ENTRY_CLASS +#define GTK_FORM_WIDGET_DATE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_FORM_TYPE_WIDGET_DATE_ENTRY, GtkFormWidgetDateEntryClass)) + + +GTK_FORM_IS_WIDGET_DATE_ENTRY +#define GTK_FORM_IS_WIDGET_DATE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_FORM_TYPE_WIDGET_DATE_ENTRY)) + + +GTK_FORM_IS_WIDGET_DATE_ENTRY_CLASS +#define GTK_FORM_IS_WIDGET_DATE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_FORM_TYPE_WIDGET_DATE_ENTRY)) + + +GTK_FORM_WIDGET_DATE_ENTRY_GET_CLASS +#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 bc71459..26999e9 100644 --- a/docs/reference/gtkdateentry-undocumented.txt +++ b/docs/reference/gtkdateentry-undocumented.txt @@ -1,11 +1,15 @@ -83% symbol docs coverage. +68% symbol docs coverage. 15 symbols documented. 0 symbols incomplete. -3 not documented. +7 not documented. gtk_date_entry_get_gdate gtk_date_entry_get_strf gtk_date_entry_get_tm +gtk_form_widget_date_entry_get_value_stringify +gtk_form_widget_date_entry_new +gtk_form_widget_date_entry_set_value_stringify +gtk_form_widget_set_editable diff --git a/docs/reference/gtkdateentry-unused.txt b/docs/reference/gtkdateentry-unused.txt index 9646cae..384eb58 100644 --- a/docs/reference/gtkdateentry-unused.txt +++ b/docs/reference/gtkdateentry-unused.txt @@ -1,3 +1,11 @@ +GTK_FORM_IS_WIDGET_DATE_ENTRY +GTK_FORM_IS_WIDGET_DATE_ENTRY_CLASS +GTK_FORM_TYPE_WIDGET_DATE_ENTRY +GTK_FORM_WIDGET_DATE_ENTRY +GTK_FORM_WIDGET_DATE_ENTRY_CLASS +GTK_FORM_WIDGET_DATE_ENTRY_GET_CLASS +GtkFormWidgetDateEntry +GtkFormWidgetDateEntryClass gtk_date_entry_get_gdate gtk_date_entry_get_tm gtk_date_entry_is_valid @@ -7,3 +15,8 @@ gtk_date_entry_set_date_strf gtk_date_entry_set_date_tm 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 diff --git a/src/Makefile.am b/src/Makefile.am index 2093681..e30cc51 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,13 +1,38 @@ AM_CPPFLAGS = $(WARN_CFLAGS) \ $(DISABLE_DEPRECATED_CFLAGS) \ - $(GTKDATEENTRY_CFLAGS) + $(GTKDATEENTRY_CFLAGS) \ + $(GTKFORM_CFLAGS) -LIBS = $(GTKDATEENTRY_LIBS) +LIBS = $(GTKDATEENTRY_LIBS) \ + $(GTKFORM_LIBS) + +if LIBGTKFORM_FOUND +GTKFORM_C = gtkformwidgetdateentry.c +GTKFORM_H = gtkformwidgetdateentry.h +libgtkformmodulesdir = `pkg-config --variable=modulesdir libgtkform` +else +GTKFORM_C = +GTKFORM_H = +libgtkformmodulesdir = +endif lib_LTLIBRARIES = libgtkdateentry.la -libgtkdateentry_la_SOURCES = gtkdateentry.c +libgtkdateentry_la_SOURCES = gtkdateentry.c \ + $(GTKFORM_C) libgtkdateentry_la_LDFLAGS = -no-undefined -include_HEADERS = gtkdateentry.h +include_HEADERS = gtkdateentry.h \ + $(GTKFORM_H) + +install-exec-hook: + if test "x$(LIBGTKFORM_FOUND)" = "xyes"; then \ + cd $(libgtkformmodulesdir) && \ + ln -s -f $(libdir)/libgtkdateentry.so .; \ + fi + +uninstall-hook: + if test "x$(LIBGTKFORM_FOUND)" = "xyes"; then \ + rm -f $(libgtkformmodulesdir)/libgtkdateentry.so + fi diff --git a/src/gtkdateentry.c b/src/gtkdateentry.c index 2ae57b4..eb4f9bf 100644 --- a/src/gtkdateentry.c +++ b/src/gtkdateentry.c @@ -422,21 +422,27 @@ GDate gint i, pos = 0, val; gchar *txt; GDate *gdate; + GDateDay gday; + GDateMonth gmon; + GDateYear gyear; GtkDateEntryPrivate *priv = GTK_DATE_ENTRY_GET_PRIVATE (date); + gday = G_DATE_BAD_DAY; + gmon = G_DATE_BAD_MONTH; + gyear = G_DATE_BAD_YEAR; + txt = (gchar *)gtk_entry_get_text (GTK_ENTRY (priv->day)); - gdate = g_date_new (); for (i = 0; i < 3; i++) { switch (priv->format[i]) { case 'd': - val = atol (g_strndup (txt + pos, 2)); + val = strtol (g_strndup (txt + pos, 2), NULL, 10); if (g_date_valid_day ((GDateDay)val)) { - g_date_set_day (gdate, (GDateDay)val); + gday = (GDateDay)val; pos += 3; } else @@ -446,10 +452,10 @@ GDate break; case 'm': - val = atol (g_strndup (txt + pos, 2)); + val = strtol (g_strndup (txt + pos, 2), NULL, 10); if (g_date_valid_month ((GDateMonth)val)) { - g_date_set_month (gdate, (GDateMonth)val); + gmon = (GDateMonth)val; pos += 3; } else @@ -459,10 +465,10 @@ GDate break; case 'Y': - val = atol (g_strndup (txt + pos, 4)); + val = strtol (g_strndup (txt + pos, 4), NULL, 10); if (g_date_valid_year ((GDateYear)val)) { - g_date_set_year (gdate, (GDateYear)val); + gyear = (GDateYear)val; pos += 5; } else @@ -473,7 +479,16 @@ GDate } } - return gdate; + if (g_date_valid_day (gday) + && g_date_valid_month (gmon) + && g_date_valid_year (gyear)) + { + return g_date_new_dmy (gday, gmon, gyear); + } + else + { + return NULL; + } } /** diff --git a/src/gtkformwidgetdateentry.c b/src/gtkformwidgetdateentry.c new file mode 100644 index 0000000..7906486 --- /dev/null +++ b/src/gtkformwidgetdateentry.c @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2010 Andrea Zagli + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include "gtkdateentry.h" +#include "gtkformwidgetdateentry.h" + +enum +{ + PROP_0 +}; + +static void gtk_form_widget_date_entry_class_init (GtkFormWidgetDateEntryClass *klass); +static void gtk_form_widget_date_entry_init (GtkFormWidgetDateEntry *gtk_form_widget_date_entry); + +static void gtk_form_widget_date_entry_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gtk_form_widget_date_entry_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); + +#define GTK_FORM_WIDGET_DATE_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_FORM_TYPE_WIDGET_DATE_ENTRY, GtkFormWidgetDateEntryPrivate)) + +typedef struct _GtkFormWidgetDateEntryPrivate GtkFormWidgetDateEntryPrivate; +struct _GtkFormWidgetDateEntryPrivate + { + gpointer foo; + }; + + +G_DEFINE_TYPE (GtkFormWidgetDateEntry, gtk_form_widget_date_entry, TYPE_GTK_FORM_WIDGET) + +static void +gtk_form_widget_date_entry_class_init (GtkFormWidgetDateEntryClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkFormWidgetClass *widget_class = GTK_FORM_WIDGET_CLASS (klass); + + object_class->set_property = gtk_form_widget_date_entry_set_property; + object_class->get_property = gtk_form_widget_date_entry_get_property; + + widget_class->get_value_stringify = gtk_form_widget_date_entry_get_value_stringify; + widget_class->set_value_stringify = gtk_form_widget_date_entry_set_value_stringify; + widget_class->set_editable = gtk_form_widget_date_entry_set_editable; + + g_type_class_add_private (object_class, sizeof (GtkFormWidgetDateEntryPrivate)); +} + +static void +gtk_form_widget_date_entry_init (GtkFormWidgetDateEntry *gtk_form_widget_date_entry) +{ +} + +/** + * gtk_form_widget_date_entry_new: + * + * Returns: the newly created #GtkFormWidgetDateEntry. + */ +GtkFormWidget +*gtk_form_widget_date_entry_new () +{ + return g_object_new (gtk_form_widget_date_entry_get_type (), NULL); +} + +/** + * gtk_form_widget_date_entry_get_value_stringify: + * @widget: + * + */ +gchar +*gtk_form_widget_date_entry_get_value_stringify (GtkFormWidget *fwidget) +{ + GtkFormWidgetDateEntryPrivate *priv = GTK_FORM_WIDGET_DATE_ENTRY_GET_PRIVATE (fwidget); + + GtkWidget *w = gtk_form_widget_get_widget (fwidget); + + return g_strdup (gtk_date_entry_get_strf (GTK_DATE_ENTRY (w), "Ymd", '-')); +} + +/** + * gtk_form_widget_date_entry_set_value_stringify: + * @fwidget: + * @value: + * + */ +gboolean +gtk_form_widget_date_entry_set_value_stringify (GtkFormWidget *fwidget, const gchar *value) +{ + gboolean ret = FALSE; + GtkWidget *w; + + g_object_get (G_OBJECT (fwidget), + "widget", &w, + NULL); + + gtk_entry_set_text (GTK_ENTRY (w), value); + + ret = TRUE; + + return ret; +} + +/** + * gtk_form_widget_set_editable: + * @fwidget: + * @editable: + * + */ +void +gtk_form_widget_date_entry_set_editable (GtkFormWidget *fwidget, gboolean editable) +{ + GtkWidget *w; + + g_object_get (G_OBJECT (fwidget), + "widget", &w, + NULL); + + gtk_editable_set_editable (GTK_EDITABLE (w), editable); +} + +/* PRIVATE */ +static void +gtk_form_widget_date_entry_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + GtkFormWidgetDateEntry *widget_entry = (GtkFormWidgetDateEntry *)object; + + GtkFormWidgetDateEntryPrivate *priv = GTK_FORM_WIDGET_DATE_ENTRY_GET_PRIVATE (widget_entry); + + switch (property_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gtk_form_widget_date_entry_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GtkFormWidgetDateEntry *widget_entry = (GtkFormWidgetDateEntry *)object; + + GtkFormWidgetDateEntryPrivate *priv = GTK_FORM_WIDGET_DATE_ENTRY_GET_PRIVATE (widget_entry); + + switch (property_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} diff --git a/src/gtkformwidgetdateentry.h b/src/gtkformwidgetdateentry.h new file mode 100644 index 0000000..d628114 --- /dev/null +++ b/src/gtkformwidgetdateentry.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Andrea Zagli + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __LIBGTK_FORM_WIDGET_ENTRY_H__ +#define __LIBGTK_FORM_WIDGET_ENTRY_H__ + +#include + + +G_BEGIN_DECLS + + +#define GTK_FORM_TYPE_WIDGET_DATE_ENTRY (gtk_form_widget_date_entry_get_type ()) +#define GTK_FORM_WIDGET_DATE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_FORM_TYPE_WIDGET_DATE_ENTRY, GtkFormWidgetDateEntry)) +#define GTK_FORM_WIDGET_DATE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_FORM_TYPE_WIDGET_DATE_ENTRY, GtkFormWidgetDateEntryClass)) +#define GTK_FORM_IS_WIDGET_DATE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_FORM_TYPE_WIDGET_DATE_ENTRY)) +#define GTK_FORM_IS_WIDGET_DATE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_FORM_TYPE_WIDGET_DATE_ENTRY)) +#define GTK_FORM_WIDGET_DATE_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_FORM_TYPE_WIDGET_DATE_ENTRY, GtkFormWidgetDateEntryClass)) + + +typedef struct _GtkFormWidgetDateEntry GtkFormWidgetDateEntry; +typedef struct _GtkFormWidgetDateEntryClass GtkFormWidgetDateEntryClass; + +struct _GtkFormWidgetDateEntry + { + GtkFormWidget parent; + }; + +struct _GtkFormWidgetDateEntryClass + { + GtkFormWidgetClass parent_class; + }; + +GType gtk_form_widget_date_entry_get_type (void) G_GNUC_CONST; + +GtkFormWidget *gtk_form_widget_date_entry_new (void); + +gchar *gtk_form_widget_date_entry_get_value_stringify (GtkFormWidget *widget); + +gboolean gtk_form_widget_date_entry_set_value_stringify (GtkFormWidget *fwidget, const gchar *value); + +void gtk_form_widget_date_entry_set_editable (GtkFormWidget *fwidget, gboolean editable); + + +G_END_DECLS + + +#endif /* __LIBGTK_FORM_WIDGET_ENTRY_H__ */ diff --git a/tests/Makefile.am b/tests/Makefile.am index 71b524f..664a028 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,10 +1,21 @@ AM_CPPFLAGS = $(WARN_CFLAGS) \ - $(DISABLE_DEPRECATED_CFLAGS) \ - $(GTKDATEENTRY_CFLAGS) \ - -I$(top_srcdir)/src + $(DISABLE_DEPRECATED_CFLAGS) \ + $(GTKDATEENTRY_CFLAGS) \ + $(GTKFORM_CFLAGS) \ + -I$(top_srcdir)/src -LIBS = $(GTKDATEENTRY_LIBS) +LIBS = $(GTKDATEENTRY_LIBS) \ + $(GTKFORM_LIBS) LDADD = $(top_builddir)/src/libgtkdateentry.la -noinst_PROGRAMS = date_entry +if LIBGTKFORM_FOUND +GTKFORM_NOINST = plugin_gtkform +else +GTKFORM_NOINST = +endif + +noinst_PROGRAMS = date_entry \ + $(GTKFORM_NOINST) + +plugin_gtkform_SOURCES = plugin_gtkform.c diff --git a/tests/plugin_gtkform.c b/tests/plugin_gtkform.c new file mode 100644 index 0000000..87f5bc6 --- /dev/null +++ b/tests/plugin_gtkform.c @@ -0,0 +1,75 @@ +/* + * GtkDateEntry widget test - plugin for libgtkform + * Copyright (C) 2010 Andrea Zagli + * + * This software is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this software; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include + +#include + +#include + +GtkBuilder *builder; +GtkForm *form; + +static void +btn_insert_on_clicked (GtkButton *button, + gpointer user_data) +{ + GtkTextBuffer *buf; + + buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (gtk_builder_get_object (builder, "textview1"))); + gtk_text_buffer_set_text (buf, gtk_form_get_sql (form, GTK_FORM_SQL_INSERT), -1); +} + +static void +btn_update_on_clicked (GtkButton *button, + gpointer user_data) +{ + GtkTextBuffer *buf; + + buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (gtk_builder_get_object (builder, "textview1"))); + gtk_text_buffer_set_text (buf, gtk_form_get_sql (form, GTK_FORM_SQL_UPDATE), -1); +} + +int +main (int argc, char **argv) +{ + GtkWidget *w; + GError *error; + + gtk_init (&argc, &argv); + + error = NULL; + builder = gtk_builder_new (); + gtk_builder_add_from_file (builder, "plugin_gtkform.ui", &error); + + gtk_builder_connect_signals (builder, NULL); + + g_signal_connect (gtk_builder_get_object (builder, "button1"), "clicked", G_CALLBACK (btn_insert_on_clicked), NULL); + g_signal_connect (gtk_builder_get_object (builder, "button2"), "clicked", G_CALLBACK (btn_update_on_clicked), NULL); + + form = gtk_form_new_from_file ("plugin_gtkform.form", builder); + + w = GTK_WIDGET (gtk_builder_get_object (builder, "window1")); + gtk_widget_show (w); + + gtk_main (); + + return 0; +} diff --git a/tests/plugin_gtkform.form b/tests/plugin_gtkform.form new file mode 100644 index 0000000..476f84e --- /dev/null +++ b/tests/plugin_gtkform.form @@ -0,0 +1,14 @@ + + + + clients
+ + + + TRUE + date + TRUE + + + +
diff --git a/tests/plugin_gtkform.ui b/tests/plugin_gtkform.ui new file mode 100644 index 0000000..ce23860 --- /dev/null +++ b/tests/plugin_gtkform.ui @@ -0,0 +1,88 @@ + + + + + + + center + 440 + 250 + + + + + True + 3 + 3 + + + True + Date Entry + + + + + True + True + automatic + automatic + etched-in + + + True + True + False + + + + + 3 + 2 + 3 + + + + + SQL Insert + True + True + True + + + 1 + 2 + + + + + SQL Update + True + True + True + + + 1 + 2 + 1 + 2 + + + + + + + + + + + True + + + 1 + 2 + + + + + +