From 0bc2ab3b81350e365207c4a5572381b40cf15198 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Sat, 30 Apr 2011 18:01:43 +0200 Subject: [PATCH] Added property GtkFormDecorator::sql. Added function GtkFormDecorator::set_key. --- ui/gtkformdecoder.c | 64 ++++++++++++++++++++++++++++++++++++++++++++- ui/gtkformdecoder.h | 2 ++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/ui/gtkformdecoder.c b/ui/gtkformdecoder.c index 7eada4d..4ad506b 100644 --- a/ui/gtkformdecoder.c +++ b/ui/gtkformdecoder.c @@ -19,16 +19,22 @@ * Boston, MA 02111-1307, USA. */ +#include + #include "gtkformdecoder.h" enum { - PROP_0 + PROP_0, + PROP_GDAEX, + PROP_SQL }; static void gtk_form_decoder_class_init (GtkFormDecoderClass *klass); static void gtk_form_decoder_init (GtkFormDecoder *decoder); +static void gtk_form_decoder_decode (GtkFormDecoder *decoder); + static void gtk_form_decoder_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_form_decoder_size_allocate (GtkWidget *widget, @@ -58,6 +64,9 @@ struct _GtkFormDecoderPrivate GtkWidget *txt_decoded; GtkWidget *btn_browse; GtkWidget *lbl_key; + + GdaEx *gdaex; + gchar *sql; }; G_DEFINE_TYPE (GtkFormDecoder, gtk_form_decoder, GTK_TYPE_BIN) @@ -80,6 +89,20 @@ gtk_form_decoder_class_init (GtkFormDecoderClass *klass) widget_class->size_request = gtk_form_decoder_size_request; widget_class->size_allocate = gtk_form_decoder_size_allocate; + g_object_class_install_property (object_class, PROP_GDAEX, + g_param_spec_object ("gdaex", + "GdaEx object", + "GdaEx object", + TYPE_GDAEX, + G_PARAM_READWRITE)); + + g_object_class_install_property (object_class, PROP_SQL, + g_param_spec_string ("sql", + "Sql string", + "Sql string", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + /** * GtkFormDecoder::btn_browse_clicked: * @gtk_form_decoder: @@ -138,6 +161,19 @@ GtkWidget return w; } +void +gtk_form_decoder_set_key (GtkFormDecoder *decoder, const gchar *key) +{ + GtkFormDecoderPrivate *priv; + + g_return_if_fail (GTK_IS_FORM_DECODER (decoder)); + + priv = GTK_FORM_DECODER_GET_PRIVATE (decoder); + + gtk_label_set_text (GTK_LABEL (priv->lbl_key), key); + gtk_form_decoder_decode (decoder); +} + gchar *gtk_form_decoder_get_key (GtkFormDecoder *decoder) { @@ -163,6 +199,16 @@ gchar } /* PRIVATE */ +static void +gtk_form_decoder_decode (GtkFormDecoder *decoder) +{ + GtkFormDecoderPrivate *priv; + + g_return_if_fail (GTK_IS_FORM_DECODER (decoder)); + + priv = GTK_FORM_DECODER_GET_PRIVATE (decoder); + +} /* CALLBACKS */ static void @@ -173,6 +219,14 @@ gtk_form_decoder_set_property (GObject *object, guint property_id, const GValue switch (property_id) { + case PROP_GDAEX: + priv->gdaex = g_value_get_object (value); + break; + + case PROP_SQL: + priv->sql = g_strstrip (g_value_dup_string (value)); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -187,6 +241,14 @@ gtk_form_decoder_get_property (GObject *object, guint property_id, GValue *value switch (property_id) { + case PROP_GDAEX: + g_value_set_object (value, priv->gdaex); + break; + + case PROP_SQL: + g_value_set_string (value, priv->sql); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; diff --git a/ui/gtkformdecoder.h b/ui/gtkformdecoder.h index 63db551..0f419ff 100644 --- a/ui/gtkformdecoder.h +++ b/ui/gtkformdecoder.h @@ -56,6 +56,8 @@ GType gtk_form_decoder_get_type (void) G_GNUC_CONST; GtkWidget *gtk_form_decoder_new (void); +void gtk_form_decoder_set_key (GtkFormDecoder *decoder, const gchar *key); + gchar *gtk_form_decoder_get_key (GtkFormDecoder *decoder); gchar *gtk_form_decoder_get_decoded (GtkFormDecoder *decoder); -- 2.49.0