From: Andrea Zagli Date: Thu, 18 Aug 2011 13:49:23 +0000 (+0200) Subject: Introdotto l'utilizzo del widget anche nel programma stesso. X-Git-Tag: gtk3~12 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=5fc31de1beb489f5e4382fe087ac0ded92e6091b;p=solipa%2Fterritorio Introdotto l'utilizzo del widget anche nel programma stesso. --- diff --git a/data/territorio/form/comune.form b/data/territorio/form/comune.form index ac6e092..8a9ed04 100644 --- a/data/territorio/form/comune.form +++ b/data/territorio/form/comune.form @@ -26,25 +26,6 @@ - - - f - f - - - - - - entry16 - - SELECT nome FROM province WHERE id = ##label38::gint - - - - t - - - diff --git a/data/territorio/form/provincia.form b/data/territorio/form/provincia.form index d0a7e5c..c9743e9 100644 --- a/data/territorio/form/provincia.form +++ b/data/territorio/form/provincia.form @@ -26,23 +26,4 @@ - - - f - f - - - - - - entry15 - - SELECT nome FROM regioni WHERE id = ##label36::gint - - - - t - - - diff --git a/data/territorio/form/ricerca_comuni.form b/data/territorio/form/ricerca_comuni.form index 44123f4..799be5d 100644 --- a/data/territorio/form/ricerca_comuni.form +++ b/data/territorio/form/ricerca_comuni.form @@ -6,19 +6,4 @@ - - - - - - - - entry22 - - SELECT nome FROM province WHERE id = ##label48::gint - - - - - diff --git a/data/territorio/form/ricerca_province.form b/data/territorio/form/ricerca_province.form index f895067..83a0323 100644 --- a/data/territorio/form/ricerca_province.form +++ b/data/territorio/form/ricerca_province.form @@ -6,19 +6,4 @@ - - - - - - - - entry23 - - SELECT nome FROM regioni WHERE id = ##label60::gint - - - - - diff --git a/data/territorio/form/ricerca_vie.form b/data/territorio/form/ricerca_vie.form index 600431d..6828809 100644 --- a/data/territorio/form/ricerca_vie.form +++ b/data/territorio/form/ricerca_vie.form @@ -6,19 +6,4 @@ - - - - - - - - entry25 - - SELECT nome FROM comuni WHERE id = ##label51::gint - - - - - diff --git a/data/territorio/form/via.form b/data/territorio/form/via.form index 85920a6..72dbc9f 100644 --- a/data/territorio/form/via.form +++ b/data/territorio/form/via.form @@ -20,23 +20,4 @@ - - - f - f - - - - - - entry20 - - SELECT nome FROM comuni WHERE id = ##label46::gint - - - - t - - - diff --git a/data/territorio/gui/territorio.gui b/data/territorio/gui/territorio.gui index b151176..c2efe91 100644 --- a/data/territorio/gui/territorio.gui +++ b/data/territorio/gui/territorio.gui @@ -1308,36 +1308,7 @@ True 5 - - True - True - False - - - - 0 - - - - - ... - True - True - True - - - False - 1 - - - - - lbl_id_regioni - - - False - 2 - + @@ -1717,36 +1688,7 @@ True 5 - - True - True - False - - - - 0 - - - - - ... - True - True - True - - - False - 1 - - - - - lbl_id_province - - - False - 2 - + @@ -2686,36 +2628,7 @@ True 5 - - True - True - False - - - - 0 - - - - - ... - True - True - True - - - False - 1 - - - - - lbl_id_comuni - - - False - 2 - + @@ -2833,36 +2746,7 @@ True 5 - - True - True - False - - - - 0 - - - - - ... - True - True - True - - - False - 1 - - - - - lbl_id_regioni - - - False - 2 - + @@ -2950,7 +2834,7 @@ True - 2 + 3 2 5 5 @@ -2982,7 +2866,7 @@ True 0 - Provincia + Regione 1 @@ -2996,43 +2880,27 @@ True 5 - - True - True - False - - - - 0 - - - - - ... - True - True - True - - - False - 1 - - - - - lbl_id_province - - - False - 2 - + 1 2 1 - 2 + 3 + GTK_FILL + + + + + True + 0 + Provincia + + + 2 + 3 + GTK_FILL GTK_FILL @@ -3113,7 +2981,7 @@ True - 2 + 4 2 5 5 @@ -3145,7 +3013,7 @@ True 0 - Comune + Regione 1 @@ -3159,43 +3027,40 @@ True 5 - - True - True - False - - - - 0 - - - - - ... - True - True - True - - - False - 1 - - - - - lbl_id_comuni - - - False - 2 - + 1 2 1 - 2 + 4 + GTK_FILL + + + + + True + 0 + Provincia + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + 0 + Comune + + + 3 + 4 + GTK_FILL GTK_FILL diff --git a/libreria/Makefile.am b/libreria/Makefile.am index 6101241..465dd06 100644 --- a/libreria/Makefile.am +++ b/libreria/Makefile.am @@ -3,7 +3,8 @@ formdir = $(datadir)/$(PACKAGE)/form AM_CPPFLAGS = $(TERRITORIO_CFLAGS) \ -DGUIDIR=\""$(guidir)"\" \ - -DFORMDIR=\""$(formdir)"\" + -DFORMDIR=\""$(formdir)"\" \ + -DG_LOG_DOMAIN=\"Territorio\" LIBS = $(TERRITORIO_LIBS) \ -export-dynamic diff --git a/src/comune.c b/src/comune.c index 78b91e1..b62ec02 100644 --- a/src/comune.c +++ b/src/comune.c @@ -21,7 +21,7 @@ #include #include "comune.h" -#include "province.h" +#include "widget.h" static void territorio_comune_class_init (TerritorioComuneClass *klass); static void territorio_comune_init (TerritorioComune *territorio_comune); @@ -40,15 +40,10 @@ static void territorio_comune_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void territorio_comune_on_provincia_selezionato (gpointer instance, guint id, gpointer user_data); - static gboolean territorio_comune_on_w_comune_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); -static void territorio_comune_on_btn_provincia_clicked (GtkButton *button, - gpointer user_data); - static void territorio_comune_on_btn_annulla_clicked (GtkButton *button, gpointer user_data); static void territorio_comune_on_btn_salva_clicked (GtkButton *button, @@ -121,6 +116,7 @@ TerritorioComune { GError *error; AutozIResource *ires1; + GtkWidget *twidget; TerritorioComune *a = TERRITORIO_COMUNE (g_object_new (territorio_comune_get_type (), NULL)); @@ -148,12 +144,35 @@ TerritorioComune "label22", NULL); + twidget = territorio_widget_new (priv->commons); + g_object_set (G_OBJECT (twidget), + "show-stato", FALSE, + "show-regione", FALSE, + "show-provincia-label", FALSE, + "show-provincia-clean", FALSE, + "show-comune", FALSE, + "show-via", FALSE, + NULL); + + territorio_widget_add_to_gtkform (TERRITORIO_WIDGET (twidget), priv->form, + NULL, + FALSE, + NULL, + FALSE, + "id_province", + TRUE, + NULL, + FALSE, + NULL, + FALSE); + + gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "hbox2")), + twidget, TRUE, TRUE, 0); + gtk_widget_show_all (twidget); + g_signal_connect (priv->w, "delete-event", G_CALLBACK (territorio_comune_on_w_comune_delete_event), (gpointer *)a); - g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button44"), - "clicked", G_CALLBACK (territorio_comune_on_btn_provincia_clicked), (gpointer *)a); - g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button27"), "clicked", G_CALLBACK (territorio_comune_on_btn_annulla_clicked), (gpointer *)a); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button28"), @@ -328,15 +347,6 @@ territorio_comune_conferma_chiusura (TerritorioComune *territorio_comune) } /* CALLBACK */ -static void -territorio_comune_on_provincia_selezionato (gpointer instance, guint id, gpointer user_data) -{ - TerritorioComune *f = (TerritorioComune *)user_data; - TerritorioComunePrivate *priv = TERRITORIO_COMUNE_GET_PRIVATE (f); - - gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label38"), g_strdup_printf ("%d", id)); -} - static gboolean territorio_comune_on_w_comune_delete_event (GtkWidget *widget, GdkEvent *event, @@ -345,26 +355,6 @@ territorio_comune_on_w_comune_delete_event (GtkWidget *widget, return !territorio_comune_conferma_chiusura ((TerritorioComune *)user_data); } -static void -territorio_comune_on_btn_provincia_clicked (GtkButton *button, - gpointer user_data) -{ - GtkWidget *w; - - TerritorioComune *rf = (TerritorioComune *)user_data; - - TerritorioComunePrivate *priv = TERRITORIO_COMUNE_GET_PRIVATE (rf); - - TerritorioProvince *c = territorio_province_new (priv->commons, TRUE); - - g_signal_connect (G_OBJECT (c), "selezionato", - G_CALLBACK (territorio_comune_on_provincia_selezionato), user_data); - - w = territorio_province_get_widget (c); - gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); - gtk_widget_show (w); -} - static void territorio_comune_on_btn_annulla_clicked (GtkButton *button, gpointer user_data) diff --git a/src/comuni.c b/src/comuni.c index 8cfb2d0..49e543d 100644 --- a/src/comuni.c +++ b/src/comuni.c @@ -279,6 +279,13 @@ territorio_comuni_carica (TerritorioComuni *territorio_comuni) "%'", NULL); } + ival = g_value_get_int ((GValue *)g_hash_table_lookup (priv->parametri_ricerca, "id_regioni")); + if (ival > 0) + { + sql_where = g_strconcat (sql_where, " AND p.id_regioni = ", + g_strdup_printf ("%d", ival), + NULL); + } } ival = 0; diff --git a/src/provincia.c b/src/provincia.c index e39fe0c..907ebe6 100644 --- a/src/provincia.c +++ b/src/provincia.c @@ -21,7 +21,7 @@ #include #include "provincia.h" -#include "regioni.h" +#include "widget.h" static void territorio_provincia_class_init (TerritorioProvinciaClass *klass); static void territorio_provincia_init (TerritorioProvincia *territorio_provincia); @@ -40,15 +40,10 @@ static void territorio_provincia_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void territorio_provincia_on_regione_selezionato (gpointer instance, guint id, gpointer user_data); - static gboolean territorio_provincia_on_w_provincia_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); -static void territorio_provincia_on_btn_regione_clicked (GtkButton *button, - gpointer user_data); - static void territorio_provincia_on_btn_annulla_clicked (GtkButton *button, gpointer user_data); static void territorio_provincia_on_btn_salva_clicked (GtkButton *button, @@ -121,6 +116,7 @@ TerritorioProvincia { GError *error; AutozIResource *ires1; + GtkWidget *twidget; TerritorioProvincia *a = TERRITORIO_PROVINCIA (g_object_new (territorio_provincia_get_type (), NULL)); @@ -148,12 +144,35 @@ TerritorioProvincia "label16", NULL); + twidget = territorio_widget_new (priv->commons); + g_object_set (G_OBJECT (twidget), + "show-stato", FALSE, + "show-regione-label", FALSE, + "show-regione-clean", FALSE, + "show-provincia", FALSE, + "show-comune", FALSE, + "show-via", FALSE, + NULL); + + territorio_widget_add_to_gtkform (TERRITORIO_WIDGET (twidget), priv->form, + NULL, + FALSE, + "id_regioni", + TRUE, + NULL, + FALSE, + NULL, + FALSE, + NULL, + FALSE); + + gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "hbox1")), + twidget, TRUE, TRUE, 0); + gtk_widget_show_all (twidget); + g_signal_connect (priv->w, "delete-event", G_CALLBACK (territorio_provincia_on_w_provincia_delete_event), (gpointer *)a); - g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button43"), - "clicked", G_CALLBACK (territorio_provincia_on_btn_regione_clicked), (gpointer *)a); - g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button20"), "clicked", G_CALLBACK (territorio_provincia_on_btn_annulla_clicked), (gpointer *)a); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button21"), @@ -328,15 +347,6 @@ territorio_provincia_conferma_chiusura (TerritorioProvincia *territorio_provinci } /* CALLBACK */ -static void -territorio_provincia_on_regione_selezionato (gpointer instance, guint id, gpointer user_data) -{ - TerritorioProvincia *f = (TerritorioProvincia *)user_data; - TerritorioProvinciaPrivate *priv = TERRITORIO_PROVINCIA_GET_PRIVATE (f); - - gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label36"), g_strdup_printf ("%d", id)); -} - static gboolean territorio_provincia_on_w_provincia_delete_event (GtkWidget *widget, GdkEvent *event, @@ -345,26 +355,6 @@ territorio_provincia_on_w_provincia_delete_event (GtkWidget *widget, return !territorio_provincia_conferma_chiusura ((TerritorioProvincia *)user_data); } -static void -territorio_provincia_on_btn_regione_clicked (GtkButton *button, - gpointer user_data) -{ - GtkWidget *w; - - TerritorioProvincia *rf = (TerritorioProvincia *)user_data; - - TerritorioProvinciaPrivate *priv = TERRITORIO_PROVINCIA_GET_PRIVATE (rf); - - TerritorioRegioni *c = territorio_regioni_new (priv->commons, TRUE); - - g_signal_connect (G_OBJECT (c), "selezionato", - G_CALLBACK (territorio_provincia_on_regione_selezionato), user_data); - - w = territorio_regioni_get_widget (c); - gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); - gtk_widget_show (w); -} - static void territorio_provincia_on_btn_annulla_clicked (GtkButton *button, gpointer user_data) diff --git a/src/ricercacomuni.c b/src/ricercacomuni.c index efe1bc7..ec61e33 100644 --- a/src/ricercacomuni.c +++ b/src/ricercacomuni.c @@ -20,7 +20,7 @@ #include #include "ricercacomuni.h" -#include "province.h" +#include "widget.h" static void territorio_ricerca_comuni_class_init (TerritorioRicercaComuniClass *klass); static void territorio_ricerca_comuni_init (TerritorioRicercaComuni *territorio_ricerca_comuni); @@ -34,11 +34,6 @@ static void territorio_ricerca_comuni_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void territorio_ricerca_comuni_on_provincia_selezionato (gpointer instance, guint id, gpointer user_data); - -static void territorio_ricerca_comuni_on_btn_provincia_clicked (GtkButton *button, - gpointer user_data); - static void territorio_ricerca_comuni_on_btn_pulisci_clicked (GtkButton *button, gpointer user_data); static void territorio_ricerca_comuni_on_btn_annulla_clicked (GtkButton *button, @@ -102,6 +97,7 @@ territorio_ricerca_comuni_init (TerritorioRicercaComuni *territorio_ricerca_comu TerritorioRicercaComuni *territorio_ricerca_comuni_new (TerritorioCommons *commons, GHashTable *values) { + GtkWidget *twidget; GError *error; TerritorioRicercaComuni *a = TERRITORIO_RICERCA_COMUNI (g_object_new (territorio_ricerca_comuni_get_type (), NULL)); @@ -124,13 +120,35 @@ TerritorioRicercaComuni g_object_set (G_OBJECT (priv->form), "gdaex", priv->commons->gdaex, NULL); gtk_form_load_from_file (priv->form, g_build_filename (priv->commons->formdir, "ricerca_comuni.form", NULL), priv->commons->gtkbuilder); + priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_ricerca_comuni")); + priv->objects = gtk_form_get_objects_by_name (priv->form, NULL); - priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_ricerca_comuni")); - - g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button54"), - "clicked", G_CALLBACK (territorio_ricerca_comuni_on_btn_provincia_clicked), (gpointer *)a); + twidget = territorio_widget_new (priv->commons); + g_object_set (G_OBJECT (twidget), + "show-stato", FALSE, + "show-regione-label", FALSE, + "show-provincia-label", FALSE, + "show-comune", FALSE, + "show-via", FALSE, + NULL); + + territorio_widget_add_to_gtkform (TERRITORIO_WIDGET (twidget), priv->form, + NULL, + FALSE, + "id_regioni", + FALSE, + "id_province", + FALSE, + NULL, + FALSE, + NULL, + FALSE); + + gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "hbox4")), + twidget, TRUE, TRUE, 0); + gtk_widget_show_all (twidget); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button55"), "clicked", G_CALLBACK (territorio_ricerca_comuni_on_btn_pulisci_clicked), (gpointer *)a); @@ -193,35 +211,6 @@ territorio_ricerca_comuni_get_property (GObject *object, guint property_id, GVal } /* CALLBACK */ -static void -territorio_ricerca_comuni_on_regione_selezionato (gpointer instance, guint id, gpointer user_data) -{ - TerritorioRicercaComuni *f = (TerritorioRicercaComuni *)user_data; - TerritorioRicercaComuniPrivate *priv = TERRITORIO_RICERCA_COMUNI_GET_PRIVATE (f); - - gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label48"), g_strdup_printf ("%d", id)); -} - -static void -territorio_ricerca_comuni_on_btn_provincia_clicked (GtkButton *button, - gpointer user_data) -{ - GtkWidget *w; - - TerritorioRicercaComuni *rf = (TerritorioRicercaComuni *)user_data; - - TerritorioRicercaComuniPrivate *priv = TERRITORIO_RICERCA_COMUNI_GET_PRIVATE (rf); - - TerritorioProvince *c = territorio_province_new (priv->commons, TRUE); - - g_signal_connect (G_OBJECT (c), "selezionato", - G_CALLBACK (territorio_ricerca_comuni_on_regione_selezionato), user_data); - - w = territorio_province_get_widget (c); - gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); - gtk_widget_show (w); -} - static void territorio_ricerca_comuni_on_btn_pulisci_clicked (GtkButton *button, gpointer user_data) diff --git a/src/ricercaprovince.c b/src/ricercaprovince.c index 6c97e49..c360449 100644 --- a/src/ricercaprovince.c +++ b/src/ricercaprovince.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Andrea Zagli + * Copyright (C) 2010-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 @@ -20,7 +20,7 @@ #include #include "ricercaprovince.h" -#include "regioni.h" +#include "widget.h" static void territorio_ricerca_province_class_init (TerritorioRicercaProvinceClass *klass); static void territorio_ricerca_province_init (TerritorioRicercaProvince *territorio_ricerca_province); @@ -34,11 +34,6 @@ static void territorio_ricerca_province_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void territorio_ricerca_province_on_regione_selezionato (gpointer instance, guint id, gpointer user_data); - -static void territorio_ricerca_province_on_btn_regione_clicked (GtkButton *button, - gpointer user_data); - static void territorio_ricerca_province_on_btn_pulisci_clicked (GtkButton *button, gpointer user_data); static void territorio_ricerca_province_on_btn_annulla_clicked (GtkButton *button, @@ -102,6 +97,7 @@ territorio_ricerca_province_init (TerritorioRicercaProvince *territorio_ricerca_ TerritorioRicercaProvince *territorio_ricerca_province_new (TerritorioCommons *commons, GHashTable *values) { + GtkWidget *twidget; GError *error; TerritorioRicercaProvince *a = TERRITORIO_RICERCA_PROVINCE (g_object_new (territorio_ricerca_province_get_type (), NULL)); @@ -124,13 +120,35 @@ TerritorioRicercaProvince g_object_set (G_OBJECT (priv->form), "gdaex", priv->commons->gdaex, NULL); gtk_form_load_from_file (priv->form, g_build_filename (priv->commons->formdir, "ricerca_province.form", NULL), priv->commons->gtkbuilder); + priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_ricerca_province")); + priv->objects = gtk_form_get_objects_by_name (priv->form, NULL); - priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_ricerca_province")); - - g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button69"), - "clicked", G_CALLBACK (territorio_ricerca_province_on_btn_regione_clicked), (gpointer *)a); + twidget = territorio_widget_new (priv->commons); + g_object_set (G_OBJECT (twidget), + "show-stato", FALSE, + "show-regione-label", FALSE, + "show-provincia", FALSE, + "show-comune", FALSE, + "show-via", FALSE, + NULL); + + territorio_widget_add_to_gtkform (TERRITORIO_WIDGET (twidget), priv->form, + NULL, + FALSE, + "id_regioni", + FALSE, + NULL, + FALSE, + NULL, + FALSE, + NULL, + FALSE); + + gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "hbox10")), + twidget, TRUE, TRUE, 0); + gtk_widget_show_all (twidget); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button70"), "clicked", G_CALLBACK (territorio_ricerca_province_on_btn_pulisci_clicked), (gpointer *)a); @@ -193,35 +211,6 @@ territorio_ricerca_province_get_property (GObject *object, guint property_id, GV } /* CALLBACK */ -static void -territorio_ricerca_province_on_regione_selezionato (gpointer instance, guint id, gpointer user_data) -{ - TerritorioRicercaProvince *f = (TerritorioRicercaProvince *)user_data; - TerritorioRicercaProvincePrivate *priv = TERRITORIO_RICERCA_PROVINCE_GET_PRIVATE (f); - - gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label60"), g_strdup_printf ("%d", id)); -} - -static void -territorio_ricerca_province_on_btn_regione_clicked (GtkButton *button, - gpointer user_data) -{ - GtkWidget *w; - - TerritorioRicercaProvince *rf = (TerritorioRicercaProvince *)user_data; - - TerritorioRicercaProvincePrivate *priv = TERRITORIO_RICERCA_PROVINCE_GET_PRIVATE (rf); - - TerritorioRegioni *c = territorio_regioni_new (priv->commons, TRUE); - - g_signal_connect (G_OBJECT (c), "selezionato", - G_CALLBACK (territorio_ricerca_province_on_regione_selezionato), user_data); - - w = territorio_regioni_get_widget (c); - gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); - gtk_widget_show (w); -} - static void territorio_ricerca_province_on_btn_pulisci_clicked (GtkButton *button, gpointer user_data) diff --git a/src/ricercavie.c b/src/ricercavie.c index fc1975d..61c9cc9 100644 --- a/src/ricercavie.c +++ b/src/ricercavie.c @@ -20,7 +20,7 @@ #include #include "ricercavie.h" -#include "comuni.h" +#include "widget.h" static void territorio_ricerca_vie_class_init (TerritorioRicercaVieClass *klass); static void territorio_ricerca_vie_init (TerritorioRicercaVie *territorio_ricerca_vie); @@ -34,11 +34,6 @@ static void territorio_ricerca_vie_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void territorio_ricerca_vie_on_comune_selezionato (gpointer instance, guint id, gpointer user_data); - -static void territorio_ricerca_vie_on_btn_comune_clicked (GtkButton *button, - gpointer user_data); - static void territorio_ricerca_vie_on_btn_pulisci_clicked (GtkButton *button, gpointer user_data); static void territorio_ricerca_vie_on_btn_annulla_clicked (GtkButton *button, @@ -103,6 +98,7 @@ TerritorioRicercaVie *territorio_ricerca_vie_new (TerritorioCommons *commons, GHashTable *values) { GError *error; + GtkWidget *twidget; TerritorioRicercaVie *a = TERRITORIO_RICERCA_VIE (g_object_new (territorio_ricerca_vie_get_type (), NULL)); @@ -124,13 +120,35 @@ TerritorioRicercaVie g_object_set (G_OBJECT (priv->form), "gdaex", priv->commons->gdaex, NULL); gtk_form_load_from_file (priv->form, g_build_filename (priv->commons->formdir, "ricerca_vie.form", NULL), priv->commons->gtkbuilder); + priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_ricerca_vie")); + priv->objects = gtk_form_get_objects_by_name (priv->form, NULL); - priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_ricerca_vie")); - - g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button59"), - "clicked", G_CALLBACK (territorio_ricerca_vie_on_btn_comune_clicked), (gpointer *)a); + twidget = territorio_widget_new (priv->commons); + g_object_set (G_OBJECT (twidget), + "show-stato", FALSE, + "show-regione-label", FALSE, + "show-provincia-label", FALSE, + "show-comune-label", FALSE, + "show-via", FALSE, + NULL); + + territorio_widget_add_to_gtkform (TERRITORIO_WIDGET (twidget), priv->form, + NULL, + FALSE, + "id_regioni", + FALSE, + "id_province", + FALSE, + "id_comuni", + FALSE, + NULL, + FALSE); + + gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "hbox5")), + twidget, TRUE, TRUE, 0); + gtk_widget_show_all (twidget); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button60"), "clicked", G_CALLBACK (territorio_ricerca_vie_on_btn_pulisci_clicked), (gpointer *)a); @@ -166,7 +184,6 @@ static void territorio_ricerca_vie_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { TerritorioRicercaVie *territorio_ricerca_vie = TERRITORIO_RICERCA_VIE (object); - TerritorioRicercaViePrivate *priv = TERRITORIO_RICERCA_VIE_GET_PRIVATE (territorio_ricerca_vie); switch (property_id) @@ -181,7 +198,6 @@ static void territorio_ricerca_vie_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { TerritorioRicercaVie *territorio_ricerca_vie = TERRITORIO_RICERCA_VIE (object); - TerritorioRicercaViePrivate *priv = TERRITORIO_RICERCA_VIE_GET_PRIVATE (territorio_ricerca_vie); switch (property_id) @@ -193,35 +209,6 @@ territorio_ricerca_vie_get_property (GObject *object, guint property_id, GValue } /* CALLBACK */ -static void -territorio_ricerca_vie_on_comune_selezionato (gpointer instance, guint id, gpointer user_data) -{ - TerritorioRicercaVie *f = (TerritorioRicercaVie *)user_data; - TerritorioRicercaViePrivate *priv = TERRITORIO_RICERCA_VIE_GET_PRIVATE (f); - - gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label51"), g_strdup_printf ("%d", id)); -} - -static void -territorio_ricerca_vie_on_btn_comune_clicked (GtkButton *button, - gpointer user_data) -{ - GtkWidget *w; - - TerritorioRicercaVie *rf = (TerritorioRicercaVie *)user_data; - - TerritorioRicercaViePrivate *priv = TERRITORIO_RICERCA_VIE_GET_PRIVATE (rf); - - TerritorioComuni *c = territorio_comuni_new (priv->commons, TRUE); - - g_signal_connect (G_OBJECT (c), "selezionato", - G_CALLBACK (territorio_ricerca_vie_on_comune_selezionato), user_data); - - w = territorio_comuni_get_widget (c); - gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); - gtk_widget_show (w); -} - static void territorio_ricerca_vie_on_btn_pulisci_clicked (GtkButton *button, gpointer user_data) diff --git a/src/via.c b/src/via.c index da3bd9a..22bf794 100644 --- a/src/via.c +++ b/src/via.c @@ -21,7 +21,7 @@ #include #include "via.h" -#include "comuni.h" +#include "widget.h" static void territorio_via_class_init (TerritorioViaClass *klass); static void territorio_via_init (TerritorioVia *territorio_via); @@ -121,6 +121,7 @@ TerritorioVia { GError *error; AutozIResource *ires1; + GtkWidget *twidget; TerritorioVia *a = TERRITORIO_VIA (g_object_new (territorio_via_get_type (), NULL)); @@ -148,12 +149,35 @@ TerritorioVia "label41", NULL); + twidget = territorio_widget_new (priv->commons); + g_object_set (G_OBJECT (twidget), + "show-stato", FALSE, + "show-regione", FALSE, + "show-provincia", FALSE, + "show-comune-label", FALSE, + "show-comune-clean", FALSE, + "show-via", FALSE, + NULL); + + territorio_widget_add_to_gtkform (TERRITORIO_WIDGET (twidget), priv->form, + NULL, + FALSE, + NULL, + FALSE, + NULL, + FALSE, + "id_comuni", + TRUE, + NULL, + FALSE); + + gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "hbox3")), + twidget, TRUE, TRUE, 0); + gtk_widget_show_all (twidget); + g_signal_connect (priv->w, "delete-event", G_CALLBACK (territorio_via_on_w_via_delete_event), (gpointer *)a); - g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button50"), - "clicked", G_CALLBACK (territorio_via_on_btn_comune_clicked), (gpointer *)a); - g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button51"), "clicked", G_CALLBACK (territorio_via_on_btn_annulla_clicked), (gpointer *)a); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button52"), @@ -328,15 +352,6 @@ territorio_via_conferma_chiusura (TerritorioVia *territorio_via) } /* CALLBACK */ -static void -territorio_via_on_comune_selezionato (gpointer instance, guint id, gpointer user_data) -{ - TerritorioVia *f = (TerritorioVia *)user_data; - TerritorioViaPrivate *priv = TERRITORIO_VIA_GET_PRIVATE (f); - - gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label46"), g_strdup_printf ("%d", id)); -} - static gboolean territorio_via_on_w_via_delete_event (GtkWidget *widget, GdkEvent *event, @@ -345,26 +360,6 @@ territorio_via_on_w_via_delete_event (GtkWidget *widget, return !territorio_via_conferma_chiusura ((TerritorioVia *)user_data); } -static void -territorio_via_on_btn_comune_clicked (GtkButton *button, - gpointer user_data) -{ - GtkWidget *w; - - TerritorioVia *rf = (TerritorioVia *)user_data; - - TerritorioViaPrivate *priv = TERRITORIO_VIA_GET_PRIVATE (rf); - - TerritorioComuni *c = territorio_comuni_new (priv->commons, TRUE); - - g_signal_connect (G_OBJECT (c), "selezionato", - G_CALLBACK (territorio_via_on_comune_selezionato), user_data); - - w = territorio_comuni_get_widget (c); - gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); - gtk_widget_show (w); -} - static void territorio_via_on_btn_annulla_clicked (GtkButton *button, gpointer user_data) diff --git a/src/vie.c b/src/vie.c index 1fcc044..c91acad 100644 --- a/src/vie.c +++ b/src/vie.c @@ -292,6 +292,20 @@ territorio_vie_carica (TerritorioVie *territorio_vie) "%'", NULL); } + ival = g_value_get_int ((GValue *)g_hash_table_lookup (priv->parametri_ricerca, "id_regioni")); + if (ival > 0) + { + sql_where = g_strconcat (sql_where, " AND p.id_regioni = ", + g_strdup_printf ("%d", ival), + NULL); + } + ival = g_value_get_int ((GValue *)g_hash_table_lookup (priv->parametri_ricerca, "id_province")); + if (ival > 0) + { + sql_where = g_strconcat (sql_where, " AND c.id_province = ", + g_strdup_printf ("%d", ival), + NULL); + } } ival = 0; diff --git a/src/widget.c b/src/widget.c index 8bc34f3..d2842cb 100644 --- a/src/widget.c +++ b/src/widget.c @@ -17,8 +17,9 @@ * */ -#include +#include #include +#include #include "widget.h" #include "stati.h" @@ -36,22 +37,27 @@ enum { PROP_0, PROP_SHOW_STATO, + PROP_SHOW_STATO_LABEL, PROP_SHOW_STATO_CLEAN, PROP_SHOW_STATO_OPEN, PROP_SHOW_STATO_BROWSE, PROP_SHOW_REGIONE, + PROP_SHOW_REGIONE_LABEL, PROP_SHOW_REGIONE_CLEAN, PROP_SHOW_REGIONE_OPEN, PROP_SHOW_REGIONE_BROWSE, PROP_SHOW_PROVINCIA, + PROP_SHOW_PROVINCIA_LABEL, PROP_SHOW_PROVINCIA_CLEAN, PROP_SHOW_PROVINCIA_OPEN, PROP_SHOW_PROVINCIA_BROWSE, PROP_SHOW_COMUNE, + PROP_SHOW_COMUNE_LABEL, PROP_SHOW_COMUNE_CLEAN, PROP_SHOW_COMUNE_OPEN, PROP_SHOW_COMUNE_BROWSE, PROP_SHOW_VIA, + PROP_SHOW_VIA_LABEL, PROP_SHOW_VIA_CLEAN, PROP_SHOW_VIA_OPEN, PROP_SHOW_VIA_BROWSE @@ -170,6 +176,13 @@ territorio_widget_class_init (TerritorioWidgetClass *klass) TRUE, G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_SHOW_STATO_LABEL, + g_param_spec_boolean ("show-stato-label", + "Visualizza etichetta stato", + "Se l'etichetta dello stato è visibile", + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_SHOW_STATO_CLEAN, g_param_spec_boolean ("show-stato-clean", "Visualizza pulitura stato", @@ -198,6 +211,13 @@ territorio_widget_class_init (TerritorioWidgetClass *klass) TRUE, G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_SHOW_REGIONE_LABEL, + g_param_spec_boolean ("show-regione-label", + "Visualizza etichetta regione", + "Se l'etichetta della regione è visibile", + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_SHOW_REGIONE_CLEAN, g_param_spec_boolean ("show-regione-clean", "Visualizza pulitura regione", @@ -219,6 +239,13 @@ territorio_widget_class_init (TerritorioWidgetClass *klass) TRUE, G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_SHOW_PROVINCIA_LABEL, + g_param_spec_boolean ("show-provincia-label", + "Visualizza etichetta provincia", + "Se l'etichetta della provincia è visibile", + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_SHOW_PROVINCIA, g_param_spec_boolean ("show-provincia", "Visualizza scelta provincia", @@ -254,6 +281,13 @@ territorio_widget_class_init (TerritorioWidgetClass *klass) TRUE, G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_SHOW_COMUNE_LABEL, + g_param_spec_boolean ("show-comune-label", + "Visualizza etichetta comune", + "Se l'etichetta del comune è visibile", + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_SHOW_COMUNE_CLEAN, g_param_spec_boolean ("show-comune-clean", "Visualizza pulitura comune", @@ -282,6 +316,13 @@ territorio_widget_class_init (TerritorioWidgetClass *klass) TRUE, G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_SHOW_VIA_LABEL, + g_param_spec_boolean ("show-via-label", + "Visualizza etichetta via", + "Se l'etichetta della via è visibile", + TRUE, + G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_SHOW_VIA_CLEAN, g_param_spec_boolean ("show-via-clean", "Visualizza pulitura via", @@ -426,6 +467,136 @@ GtkWidget return priv->transient; } +void +territorio_widget_add_to_gtkform (TerritorioWidget *widget, + GtkForm *form, + const gchar *stato_field, + gboolean stato_obligatory, + const gchar *regione_field, + gboolean regione_obligatory, + const gchar *provincia_field, + gboolean provincia_obligatory, + const gchar *comune_field, + gboolean comune_obligatory, + const gchar *via_field, + gboolean via_obligatory) +{ + TerritorioWidgetPrivate *priv; + + GtkFormWidget *fwidget; + GtkFormField *fint; + + g_return_if_fail (IS_TERRITORIO_WIDGET (widget)); + g_return_if_fail (IS_GTK_FORM (form)); + + priv = TERRITORIO_WIDGET_GET_PRIVATE (widget); + + if (gtk_widget_get_visible (priv->dec_stato) && stato_field != NULL) + { + gchar *_stato_field = g_strstrip (g_strdup (stato_field)); + g_return_if_fail (g_strcmp0 (_stato_field, "") != 0); + + fwidget = gtk_form_widget_decoder_new (); + g_object_set (G_OBJECT (fwidget), + "widget", priv->dec_stato, + "label", priv->lbl_stato, + NULL); + fint = gtk_form_field_integer_new (); + g_object_set (G_OBJECT (fint), + "field", _stato_field, + "form-widget", fwidget, + "obligatory", stato_obligatory, + NULL); + gtk_form_add_field (form, fint); + + g_free (_stato_field); + } + + if (gtk_widget_get_visible (priv->dec_regione) && regione_field != NULL) + { + gchar *_regione_field = g_strstrip (g_strdup (regione_field)); + g_return_if_fail (g_strcmp0 (_regione_field, "") != 0); + + fwidget = gtk_form_widget_decoder_new (); + g_object_set (G_OBJECT (fwidget), + "widget", priv->dec_regione, + "label", priv->lbl_regione, + NULL); + fint = gtk_form_field_integer_new (); + g_object_set (G_OBJECT (fint), + "field", _regione_field, + "form-widget", fwidget, + "obligatory", regione_obligatory, + NULL); + gtk_form_add_field (form, fint); + + g_free (_regione_field); + } + + if (gtk_widget_get_visible (priv->dec_provincia) && provincia_field != NULL) + { + gchar *_provincia_field = g_strstrip (g_strdup (provincia_field)); + g_return_if_fail (g_strcmp0 (_provincia_field, "") != 0); + + fwidget = gtk_form_widget_decoder_new (); + g_object_set (G_OBJECT (fwidget), + "widget", priv->dec_provincia, + "label", priv->lbl_provincia, + NULL); + fint = gtk_form_field_integer_new (); + g_object_set (G_OBJECT (fint), + "field", _provincia_field, + "form-widget", fwidget, + "obligatory", provincia_obligatory, + NULL); + gtk_form_add_field (form, fint); + + g_free (_provincia_field); + } + + if (gtk_widget_get_visible (priv->dec_comune) && comune_field != NULL) + { + gchar *_comune_field = g_strstrip (g_strdup (comune_field)); + g_return_if_fail (g_strcmp0 (_comune_field, "") != 0); + + fwidget = gtk_form_widget_decoder_new (); + g_object_set (G_OBJECT (fwidget), + "widget", priv->dec_comune, + "label", priv->lbl_comune, + NULL); + fint = gtk_form_field_integer_new (); + g_object_set (G_OBJECT (fint), + "field", _comune_field, + "form-widget", fwidget, + "obligatory", comune_obligatory, + NULL); + gtk_form_add_field (form, fint); + + g_free (_comune_field); + } + + if (gtk_widget_get_visible (priv->dec_via) && via_field != NULL) + { + gchar *_via_field = g_strstrip (g_strdup (via_field)); + g_return_if_fail (g_strcmp0 (_via_field, "") != 0); + + fwidget = gtk_form_widget_decoder_new (); + g_object_set (G_OBJECT (fwidget), + "widget", priv->dec_via, + "label", priv->lbl_via, + NULL); + fint = gtk_form_field_integer_new (); + g_object_set (G_OBJECT (fint), + "field", _via_field, + "form-widget", fwidget, + "obligatory", via_obligatory, + NULL); + gtk_form_add_field (form, fint); + + g_free (_via_field); + } +} + /* PRIVATE */ static void territorio_widget_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) @@ -438,6 +609,14 @@ territorio_widget_set_property (GObject *object, guint property_id, const GValue 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)); + gtk_table_set_row_spacing (GTK_TABLE (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")), + 0, g_value_get_boolean (value) ? 5 : 0); + break; + + case PROP_SHOW_STATO_LABEL: + gtk_widget_set_visible (priv->lbl_stato, g_value_get_boolean (value)); + gtk_table_set_col_spacing (GTK_TABLE (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")), + 0, g_value_get_boolean (value) ? 5 : 0); break; case PROP_SHOW_STATO_CLEAN: @@ -455,6 +634,14 @@ territorio_widget_set_property (GObject *object, guint property_id, const GValue 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)); + gtk_table_set_row_spacing (GTK_TABLE (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")), + 1, g_value_get_boolean (value) ? 5 : 0); + break; + + case PROP_SHOW_REGIONE_LABEL: + gtk_widget_set_visible (priv->lbl_regione, g_value_get_boolean (value)); + gtk_table_set_col_spacing (GTK_TABLE (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")), + 0, g_value_get_boolean (value) ? 5 : 0); break; case PROP_SHOW_REGIONE_CLEAN: @@ -472,6 +659,14 @@ territorio_widget_set_property (GObject *object, guint property_id, const GValue 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)); + gtk_table_set_row_spacing (GTK_TABLE (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")), + 2, g_value_get_boolean (value) ? 5 : 0); + break; + + case PROP_SHOW_PROVINCIA_LABEL: + gtk_widget_set_visible (priv->lbl_provincia, g_value_get_boolean (value)); + gtk_table_set_col_spacing (GTK_TABLE (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")), + 0, g_value_get_boolean (value) ? 5 : 0); break; case PROP_SHOW_PROVINCIA_CLEAN: @@ -489,6 +684,14 @@ territorio_widget_set_property (GObject *object, guint property_id, const GValue 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)); + gtk_table_set_row_spacing (GTK_TABLE (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")), + 3, g_value_get_boolean (value) ? 5 : 0); + break; + + case PROP_SHOW_COMUNE_LABEL: + gtk_widget_set_visible (priv->lbl_comune, g_value_get_boolean (value)); + gtk_table_set_col_spacing (GTK_TABLE (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")), + 0, g_value_get_boolean (value) ? 5 : 0); break; case PROP_SHOW_COMUNE_CLEAN: @@ -506,6 +709,14 @@ territorio_widget_set_property (GObject *object, guint property_id, const GValue 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)); + gtk_table_set_row_spacing (GTK_TABLE (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")), + 4, g_value_get_boolean (value) ? 5 : 0); + break; + + case PROP_SHOW_VIA_LABEL: + gtk_widget_set_visible (priv->lbl_via, g_value_get_boolean (value)); + gtk_table_set_col_spacing (GTK_TABLE (gtk_builder_get_object (priv->commons->gtkbuilder, "table11")), + 0, g_value_get_boolean (value) ? 5 : 0); break; case PROP_SHOW_VIA_CLEAN: @@ -538,6 +749,10 @@ territorio_widget_get_property (GObject *object, guint property_id, GValue *valu g_value_set_boolean (value, gtk_widget_get_visible (priv->dec_stato)); break; + case PROP_SHOW_STATO_LABEL: + g_value_set_boolean (value, gtk_widget_get_visible (priv->lbl_stato)); + break; + case PROP_SHOW_STATO_CLEAN: g_value_set_boolean (value, gtk_form_decoder_btn_clean_is_visible (GTK_FORM_DECODER (priv->dec_stato))); break; @@ -554,6 +769,10 @@ territorio_widget_get_property (GObject *object, guint property_id, GValue *valu g_value_set_boolean (value, gtk_widget_get_visible (priv->dec_regione)); break; + case PROP_SHOW_REGIONE_LABEL: + g_value_set_boolean (value, gtk_widget_get_visible (priv->lbl_regione)); + break; + case PROP_SHOW_REGIONE_CLEAN: g_value_set_boolean (value, gtk_form_decoder_btn_clean_is_visible (GTK_FORM_DECODER (priv->dec_regione))); break; @@ -570,6 +789,10 @@ territorio_widget_get_property (GObject *object, guint property_id, GValue *valu g_value_set_boolean (value, gtk_widget_get_visible (priv->dec_provincia)); break; + case PROP_SHOW_PROVINCIA_LABEL: + g_value_set_boolean (value, gtk_widget_get_visible (priv->lbl_provincia)); + break; + case PROP_SHOW_PROVINCIA_CLEAN: g_value_set_boolean (value, gtk_form_decoder_btn_clean_is_visible (GTK_FORM_DECODER (priv->dec_provincia))); break; @@ -586,6 +809,10 @@ territorio_widget_get_property (GObject *object, guint property_id, GValue *valu g_value_set_boolean (value, gtk_widget_get_visible (priv->dec_comune)); break; + case PROP_SHOW_COMUNE_LABEL: + g_value_set_boolean (value, gtk_widget_get_visible (priv->lbl_comune)); + break; + case PROP_SHOW_COMUNE_CLEAN: g_value_set_boolean (value, gtk_form_decoder_btn_clean_is_visible (GTK_FORM_DECODER (priv->dec_comune))); break; @@ -602,6 +829,10 @@ territorio_widget_get_property (GObject *object, guint property_id, GValue *valu g_value_set_boolean (value, gtk_widget_get_visible (priv->dec_via)); break; + case PROP_SHOW_VIA_LABEL: + g_value_set_boolean (value, gtk_widget_get_visible (priv->lbl_via)); + break; + case PROP_SHOW_VIA_CLEAN: g_value_set_boolean (value, gtk_form_decoder_btn_clean_is_visible (GTK_FORM_DECODER (priv->dec_via))); break; diff --git a/src/widget.h b/src/widget.h index ddfc1f6..ac767cf 100644 --- a/src/widget.h +++ b/src/widget.h @@ -25,6 +25,8 @@ #include +#include + #include "commons.h" G_BEGIN_DECLS @@ -55,6 +57,21 @@ GType territorio_widget_get_type (void) G_GNUC_CONST; GtkWidget *territorio_widget_new (TerritorioCommons *commons); +GtkWidget *territorio_widget_get_widget (TerritorioWidget *widget); + +void territorio_widget_add_to_gtkform (TerritorioWidget *widget, + GtkForm *form, + const gchar *stato_field, + gboolean stato_obligatory, + const gchar *regione_field, + gboolean regione_obligatory, + const gchar *provincia_field, + gboolean provincia_obligatory, + const gchar *comune_field, + gboolean comune_obligatory, + const gchar *via_field, + gboolean via_obligatory); + G_END_DECLS