]> saetta.ns0.it Git - libgtkform/commitdiff
Added property GtkFormDecorator::sql.
authorAndrea Zagli <azagli@libero.it>
Sat, 30 Apr 2011 16:01:43 +0000 (18:01 +0200)
committerAndrea Zagli <azagli@libero.it>
Sat, 30 Apr 2011 16:01:43 +0000 (18:01 +0200)
Added function GtkFormDecorator::set_key.

ui/gtkformdecoder.c
ui/gtkformdecoder.h

index 7eada4dd42ebdd0c1c6e9e0e33faf8c9433d90e5..4ad506bb563b2872d5b1c262f976951187a56b2b 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
+#include <libgdaex.h>
+
 #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;
index 63db5516659b6623fa24245e206c6f7add6afdc2..0f419ffdfadd073894a6fe130a6a53a8573c154d 100644 (file)
@@ -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);