]> saetta.ns0.it Git - solipa/territorio/commitdiff
Aggiunta la possibilità di nascondere i campi in TerritorioWidget.
authorAndrea Zagli <azagli@libero.it>
Sun, 19 Jun 2011 10:02:06 +0000 (12:02 +0200)
committerAndrea Zagli <azagli@libero.it>
Sun, 19 Jun 2011 10:02:06 +0000 (12:02 +0200)
src/widget.c

index 5708b63d99c557e691639e6aa7383c9b37cb1950..baeaf6241e239b0cc26bccba65fe3664dfc3ac01 100644 (file)
 #include "vie.h"
 #include "via.h"
 
+enum
+{
+       PROP_0,
+       PROP_SHOW_STATO,
+       PROP_SHOW_REGIONE,
+       PROP_SHOW_PROVINCIA,
+       PROP_SHOW_COMUNE,
+       PROP_SHOW_VIA
+};
+
 static void territorio_widget_class_init (TerritorioWidgetClass *klass);
 static void territorio_widget_init (TerritorioWidget *territorio_widget);
 
@@ -99,6 +109,11 @@ struct _TerritorioWidgetPrivate
        {
                TerritorioCommons *commons;
 
+               GtkWidget *lbl_stato;
+               GtkWidget *lbl_regione;
+               GtkWidget *lbl_provincia;
+               GtkWidget *lbl_comune;
+               GtkWidget *lbl_via;
                GtkWidget *dec_stato;
                GtkWidget *dec_regione;
                GtkWidget *dec_provincia;
@@ -126,6 +141,42 @@ territorio_widget_class_init (TerritorioWidgetClass *klass)
 
        widget_class->size_request = territorio_widget_size_request;
        widget_class->size_allocate = territorio_widget_size_allocate;
+
+       g_object_class_install_property (object_class, PROP_SHOW_STATO,
+                                        g_param_spec_boolean ("show-stato",
+                                                              "Visualizza scelta stato",
+                                                              "Se la scelta dello stato è disponibile",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class, PROP_SHOW_REGIONE,
+                                        g_param_spec_boolean ("show-regione",
+                                                              "Visualizza scelta regione",
+                                                              "Se la scelta della regione è disponibile",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class, PROP_SHOW_PROVINCIA,
+                                        g_param_spec_boolean ("show-provincia",
+                                                              "Visualizza scelta provincia",
+                                                              "Se la scelta della provincia è disponibile",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class, PROP_SHOW_COMUNE,
+                                        g_param_spec_boolean ("show-comune",
+                                                              "Visualizza scelta comune",
+                                                              "Se la scelta del comune è disponibile",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE));
+
+       g_object_class_install_property (object_class, PROP_SHOW_VIA,
+                                        g_param_spec_boolean ("show-via",
+                                                              "Visualizza scelta via",
+                                                              "Se la scelta della via è disponibile",
+                                                              TRUE,
+                                                              G_PARAM_READWRITE));
+
 }
 
 static void
@@ -167,6 +218,11 @@ GtkWidget
 
        gtk_container_add (GTK_CONTAINER (a), GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")));
 
+       priv->lbl_stato = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "label53"));
+       priv->lbl_regione = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "label54"));
+       priv->lbl_provincia = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "label55"));
+       priv->lbl_comune = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "label57"));
+       priv->lbl_via = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "label58"));
        priv->dec_stato = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "gtkformdecoder1"));
        priv->dec_regione = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "gtkformdecoder2"));
        priv->dec_provincia = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "gtkformdecoder3"));
@@ -254,6 +310,31 @@ territorio_widget_set_property (GObject *object, guint property_id, const GValue
 
        switch (property_id)
                {
+                       case PROP_SHOW_STATO:
+                               gtk_widget_set_visible (priv->lbl_stato, g_value_get_boolean (value));
+                               gtk_widget_set_visible (priv->dec_stato, g_value_get_boolean (value));
+                               break;
+
+                       case PROP_SHOW_REGIONE:
+                               gtk_widget_set_visible (priv->lbl_regione, g_value_get_boolean (value));
+                               gtk_widget_set_visible (priv->dec_regione, g_value_get_boolean (value));
+                               break;
+
+                       case PROP_SHOW_PROVINCIA:
+                               gtk_widget_set_visible (priv->lbl_provincia, g_value_get_boolean (value));
+                               gtk_widget_set_visible (priv->dec_provincia, g_value_get_boolean (value));
+                               break;
+
+                       case PROP_SHOW_COMUNE:
+                               gtk_widget_set_visible (priv->lbl_comune, g_value_get_boolean (value));
+                               gtk_widget_set_visible (priv->dec_comune, g_value_get_boolean (value));
+                               break;
+
+                       case PROP_SHOW_VIA:
+                               gtk_widget_set_visible (priv->lbl_via, g_value_get_boolean (value));
+                               gtk_widget_set_visible (priv->dec_via, g_value_get_boolean (value));
+                               break;
+
                        default:
                                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                                break;
@@ -268,6 +349,26 @@ territorio_widget_get_property (GObject *object, guint property_id, GValue *valu
 
        switch (property_id)
                {
+                       case PROP_SHOW_STATO:
+                               g_value_set_boolean (value, gtk_widget_get_visible (priv->dec_stato));
+                               break;
+
+                       case PROP_SHOW_REGIONE:
+                               g_value_set_boolean (value, gtk_widget_get_visible (priv->dec_regione));
+                               break;
+
+                       case PROP_SHOW_PROVINCIA:
+                               g_value_set_boolean (value, gtk_widget_get_visible (priv->dec_provincia));
+                               break;
+
+                       case PROP_SHOW_COMUNE:
+                               g_value_set_boolean (value, gtk_widget_get_visible (priv->dec_comune));
+                               break;
+
+                       case PROP_SHOW_VIA:
+                               g_value_set_boolean (value, gtk_widget_get_visible (priv->dec_via));
+                               break;
+
                        default:
                                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
                                break;