From: Andrea Zagli Date: Sat, 19 Feb 2011 17:16:33 +0000 (+0100) Subject: Started development of query editor. X-Git-Tag: 0.5.0~70 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=61e8650607073a36de4cba51950ecac5d4db218b;p=libgdaex Started development of query editor. --- diff --git a/data/Makefile.am b/data/Makefile.am new file mode 100644 index 0000000..b0dfb96 --- /dev/null +++ b/data/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = libgdaex diff --git a/data/libgdaex/Makefile.am b/data/libgdaex/Makefile.am new file mode 100644 index 0000000..13c2b3d --- /dev/null +++ b/data/libgdaex/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = gui diff --git a/data/libgdaex/gui/Makefile.am b/data/libgdaex/gui/Makefile.am new file mode 100644 index 0000000..0c8103c --- /dev/null +++ b/data/libgdaex/gui/Makefile.am @@ -0,0 +1,5 @@ +guidir = $(datadir)/$(PACKAGE)/gui + +gui_DATA = libgdaex.ui + +EXTRA_DIST = $(gui_DATA) diff --git a/data/libgdaex/gui/libgdaex.ui b/data/libgdaex/gui/libgdaex.ui new file mode 100644 index 0000000..bf25df8 --- /dev/null +++ b/data/libgdaex/gui/libgdaex.ui @@ -0,0 +1,636 @@ + + + + + + 5 + normal + False + + + True + vertical + 2 + + + True + True + + + True + True + automatic + automatic + etched-in + + + True + True + tstore_fields + + + Fields + + + + 1 + + + + + + + + + False + True + + + + + True + vertical + 5 + + + True + 2 + 4 + 5 + 5 + + + True + 5 + end + + + gtk-cancel + True + True + True + True + + + False + False + 0 + + + + + gtk-save + True + True + True + True + + + False + False + 1 + + + + + 4 + 1 + 2 + + + + + + + + + + + + + + + + + 0 + + + + + True + 0 + + + True + 12 + + + True + 5 + + + True + True + automatic + automatic + etched-in + + + True + True + lstore_show + + + Field + + + + 1 + + + + + + + + + 0 + + + + + True + vertical + 5 + + + gtk-add + True + True + True + True + + + False + False + 0 + + + + + gtk-remove + True + True + True + True + + + False + False + 1 + + + + + gtk-go-up + True + True + True + True + + + False + False + 2 + + + + + gtk-go-down + True + True + True + True + + + False + False + 3 + + + + + False + 1 + + + + + + + + + True + <b>Show</b> + True + + + + + 1 + + + + + True + 0 + + + True + 12 + + + True + 5 + + + True + True + automatic + automatic + etched-in + + + True + True + tstore_where + + + Field + + + + 1 + + + + + + + Type + + + + 3 + + + + + + + From + + + + 4 + + + + + + + To + + + + 5 + + + + + + + + + 0 + + + + + True + vertical + 5 + + + gtk-add + True + True + True + True + + + False + False + 0 + + + + + gtk-remove + True + True + True + True + + + False + False + 1 + + + + + gtk-go-up + True + True + True + True + + + False + False + 2 + + + + + gtk-go-down + True + True + True + True + + + False + False + 3 + + + + + False + 1 + + + + + + + + + True + <b>Where</b> + True + + + + + 2 + + + + + True + 0 + + + True + 12 + + + True + 5 + + + True + True + automatic + automatic + etched-in + + + True + True + lstore_order + + + Field + + + + 1 + + + + + + + Order + + + + 2 + + + + + + + + + 0 + + + + + True + vertical + 5 + + + gtk-add + True + True + True + True + + + False + False + 0 + + + + + gtk-remove + True + True + True + True + + + False + False + 1 + + + + + gtk-go-up + True + True + True + True + + + False + False + 2 + + + + + gtk-go-down + True + True + True + True + + + False + False + 3 + + + + + False + 1 + + + + + + + + + True + <b>Order</b> + True + + + + + 3 + + + + + True + True + + + + + 1 + + + + + True + end + + + gtk-cancel + True + True + True + True + + + False + False + 0 + + + + + gtk-ok + True + True + True + True + + + False + False + 1 + + + + + False + end + 0 + + + + + + button1 + button2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/queryeditor.c b/src/queryeditor.c new file mode 100644 index 0000000..bb630cf --- /dev/null +++ b/src/queryeditor.c @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2011 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 + */ + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include "queryeditor.h" + +static void gdaex_query_editor_class_init (GdaExQueryEditorClass *class); +static void gdaex_query_editor_init (GdaExQueryEditor *gdaex_query_editor); + +static void gdaex_query_editor_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec); +static void gdaex_query_editor_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec); + +static void gdaex_query_editor_build_ui (GdaExQueryEditor *qe); + +#define GDAEX_QUERY_EDITOR_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GDAEX_QUERY_EDITOR, GdaExQueryEditorPrivate)) + +typedef struct _GdaExQueryEditorPrivate GdaExQueryEditorPrivate; +struct _GdaExQueryEditorPrivate + { + GdaEx *gdaex; + + GtkWidget *hbx_main; + }; + +G_DEFINE_TYPE (GdaExQueryEditor, gdaex_query_editor, G_TYPE_OBJECT) + +enum +{ + CONDITION_EQ, + CONDITION_LIKE, + CONDITION_ILIKE, + CONDITION_G, + CONDITION_G_EQ, + CONDITION_L, + CONDITION_L_EQ, + CONDITION_BETWEEN +}; + +enum +{ + COL_FIELDS_NAME, + COL_FIELDS_VISIBLE_NAME +}; + +enum +{ + COL_SHOW_NAME, + COL_SHOW_VISIBLE_NAME +}; + +enum +{ + COL_WHERE_NAME, + COL_WHERE_VISIBLE_NAME, + COL_WHERE_CONDITION_TYPE, + COL_WHERE_CONDITION_FROM, + COL_WHERE_CONDITION_TO +}; + +enum +{ + COL_ORDER_NAME, + COL_ORDER_VISIBLE_NAME, + COL_ORDER_ORDER +}; + +static void +gdaex_query_editor_class_init (GdaExQueryEditorClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + + object_class->set_property = gdaex_query_editor_set_property; + object_class->get_property = gdaex_query_editor_get_property; + + g_type_class_add_private (object_class, sizeof (GdaExQueryEditorPrivate)); +} + +static void +gdaex_query_editor_init (GdaExQueryEditor *gdaex_query_editor) +{ + GdaExQueryEditorPrivate *priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor); +} + +/** + * gdaex_query_editor_new: + * @gdaex: + * + * Returns: the newly created #GdaExQueryEditor object. + */ +GdaExQueryEditor +*gdaex_query_editor_new (GdaEx *gdaex) +{ + GError *error; + + GdaExQueryEditor *gdaex_query_editor; + GdaExQueryEditorPrivate *priv; + + g_return_val_if_fail (IS_GDAEX (gdaex), NULL); + + gdaex_query_editor = GDAEX_QUERY_EDITOR (g_object_new (gdaex_query_editor_get_type (), NULL)); + + priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor); + + priv->gdaex = gdaex; + + return gdaex_query_editor; +} + +GtkWidget +*gdaex_query_editor_get_widget (GdaExQueryEditor *gdaex_query_editor) +{ + GdaExQueryEditorPrivate *priv; + + priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor); + + return priv->hbx_main; +} + +/* PRIVATE */ +static void +gdaex_query_editor_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + GdaExQueryEditor *gdaex_query_editor = (GdaExQueryEditor *)object; + + GdaExQueryEditorPrivate *priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor); + + switch (property_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gdaex_query_editor_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GdaExQueryEditor *gdaex_query_editor = (GdaExQueryEditor *)object; + + GdaExQueryEditorPrivate *priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor); + + switch (property_id) + { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} diff --git a/src/queryeditor.h b/src/queryeditor.h new file mode 100644 index 0000000..7fb5e47 --- /dev/null +++ b/src/queryeditor.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011 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 __GDAEX_QUERY_EDITOR_H__ +#define __GDAEX_QUERY_EDITOR_H__ + +#include +#include + +#include + + +G_BEGIN_DECLS + + +#define TYPE_GDAEX_QUERY_EDITOR (gdaex_query_editor_get_type ()) +#define GDAEX_QUERY_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GDAEX_QUERY_EDITOR, GdaExQueryEditor)) +#define GDAEX_QUERY_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GDAEX_QUERY_EDITOR, GdaExQueryEditorClass)) +#define GDAEX_IS_QUERY_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GDAEX_QUERY_EDITOR)) +#define GDAEX_IS_QUERY_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GDAEX_QUERY_EDITOR)) +#define GDAEX_QUERY_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GDAEX_QUERY_EDITOR, GdaExQueryEditorClass)) + +typedef struct _GdaExQueryEditor GdaExQueryEditor; +typedef struct _GdaExQueryEditorClass GdaExQueryEditorClass; + +struct _GdaExQueryEditor + { + GObject parent; + }; + +struct _GdaExQueryEditorClass + { + GObjectClass parent_class; + }; + +GType gdaex_query_editor_get_type (void) G_GNUC_CONST; + + +GdaExQueryEditor *gdaex_query_editor_new (GdaEx *gdaex); + +GtkWidget *gdaex_query_editor_get_widget (GdaExQueryEditor *gdaex_query_editor); + + +G_END_DECLS + + +#endif /* __GDAEX_QUERY_EDITOR_H__ */