]> saetta.ns0.it Git - solipa/territorio/commitdiff
Introdotto l'utilizzo del widget anche nel programma stesso.
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Thu, 18 Aug 2011 13:49:23 +0000 (15:49 +0200)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Thu, 18 Aug 2011 13:49:23 +0000 (15:49 +0200)
18 files changed:
data/territorio/form/comune.form
data/territorio/form/provincia.form
data/territorio/form/ricerca_comuni.form
data/territorio/form/ricerca_province.form
data/territorio/form/ricerca_vie.form
data/territorio/form/via.form
data/territorio/gui/territorio.gui
libreria/Makefile.am
src/comune.c
src/comuni.c
src/provincia.c
src/ricercacomuni.c
src/ricercaprovince.c
src/ricercavie.c
src/via.c
src/vie.c
src/widget.c
src/widget.h

index ac6e0922184c16fc665b510910d2bccbc6dd4ef9..8a9ed04c66f8919113539d9ed0e0749563e3aef9 100644 (file)
                <field type="text" name="cap" />
        </widget>
 
-       <widget type="entry" name="entry16">
-               <field type="text" name="provincia">
-                       <to-load>f</to-load>
-                       <to-save>f</to-save>
-               </field>
-       </widget>
-
-       <widget type="label" name="label38" label="label37">
-               <on-change what="update" when="after">
-                       <widget-name>entry16</widget-name>
-                       <sql>
-                               SELECT nome FROM province WHERE id = ##label38::gint
-                       </sql>
-               </on-change>
-               <field type="integer" name="id_province">
-                       <obligatory>t</obligatory>
-               </field>
-       </widget>
-
        <widget type="checkbox" name="checkbutton2" label="label52">
                <field type="boolean" name="capoluogo" />
        </widget>
index d0a7e5cd9feef2e170844ec36cd23ab0fa216daf..c9743e910136ecec46eab8d118fc3d27a517f95a 100644 (file)
                <field type="text" name="sigla" />
        </widget>
 
-       <widget type="entry" name="entry15">
-               <field type="text" name="regione">
-                       <to-load>f</to-load>
-                       <to-save>f</to-save>
-               </field>
-       </widget>
-
-       <widget type="label" name="label36" label="label35">
-               <on-change what="update" when="after">
-                       <widget-name>entry15</widget-name>
-                       <sql>
-                               SELECT nome FROM regioni WHERE id = ##label36::gint
-                       </sql>
-               </on-change>
-               <field type="integer" name="id_regioni">
-                       <obligatory>t</obligatory>
-               </field>
-       </widget>
-
 </gtkform>
index 44123f4d0fc18a1b6f72ddb2f09e503e8049ba10..799be5dabe059d4b106b1ca3e7423c68170e80ac 100644 (file)
@@ -6,19 +6,4 @@
                </field>
        </widget>
 
-       <widget type="entry" name="entry22">
-               <field type="text" name="provincia">
-               </field>
-       </widget>
-
-       <widget type="label" name="label48" label="label47">
-               <on-change what="update" when="after">
-                       <widget-name>entry22</widget-name>
-                       <sql>
-                               SELECT nome FROM province WHERE id = ##label48::gint
-                       </sql>
-               </on-change>
-               <field type="integer" name="id_province" />
-       </widget>
-
 </gtkform>
index f895067b910c62b8997d75ff05876f8ffa2c75c7..83a03231849087a8c4136217915018ad26638a31 100644 (file)
@@ -6,19 +6,4 @@
                </field>
        </widget>
 
-       <widget type="entry" name="entry23">
-               <field type="text" name="regione">
-               </field>
-       </widget>
-
-       <widget type="label" name="label60" label="label59">
-               <on-change what="update" when="after">
-                       <widget-name>entry23</widget-name>
-                       <sql>
-                               SELECT nome FROM regioni WHERE id = ##label60::gint
-                       </sql>
-               </on-change>
-               <field type="integer" name="id_regioni" />
-       </widget>
-
 </gtkform>
index 600431d7d80ad27dfd56f768900d4ee2f493ac0f..6828809fa3d825f9d436a38d81c2005d6ad4fff7 100644 (file)
@@ -6,19 +6,4 @@
                </field>
        </widget>
 
-       <widget type="entry" name="entry25">
-               <field type="text" name="comune">
-               </field>
-       </widget>
-
-       <widget type="label" name="label51" label="label50">
-               <on-change what="update" when="after">
-                       <widget-name>entry25</widget-name>
-                       <sql>
-                               SELECT nome FROM comuni WHERE id = ##label51::gint
-                       </sql>
-               </on-change>
-               <field type="integer" name="id_comuni" />
-       </widget>
-
 </gtkform>
index 85920a6cd9e0dde8ec404e48c26612597cfbf315..72dbc9f728aa4bf21fd9e0eb834f1559cba72a4a 100644 (file)
                <field type="text" name="cap" />
        </widget>
 
-       <widget type="entry" name="entry20">
-               <field type="text" name="comune">
-                       <to-load>f</to-load>
-                       <to-save>f</to-save>
-               </field>
-       </widget>
-
-       <widget type="label" name="label46" label="label45">
-               <on-change what="update" when="after">
-                       <widget-name>entry20</widget-name>
-                       <sql>
-                               SELECT nome FROM comuni WHERE id = ##label46::gint
-                       </sql>
-               </on-change>
-               <field type="integer" name="id_comuni">
-                       <obligatory>t</obligatory>
-               </field>
-       </widget>
-
 </gtkform>
index b151176348690d44aa22bfdfeb27bee055a6c669..c2efe916ef18527e680d3396c2daa7ae41bc4dc5 100644 (file)
                 <property name="visible">True</property>
                 <property name="spacing">5</property>
                 <child>
-                  <object class="GtkEntry" id="entry15">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="editable">False</property>
-                    <property name="invisible_char">&#x25CF;</property>
-                  </object>
-                  <packing>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="button43">
-                    <property name="label" translatable="yes">...</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label36">
-                    <property name="label" translatable="yes">lbl_id_regioni</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">2</property>
-                  </packing>
+                  <placeholder/>
                 </child>
               </object>
               <packing>
                 <property name="visible">True</property>
                 <property name="spacing">5</property>
                 <child>
-                  <object class="GtkEntry" id="entry16">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="editable">False</property>
-                    <property name="invisible_char">&#x25CF;</property>
-                  </object>
-                  <packing>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="button44">
-                    <property name="label" translatable="yes">...</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label38">
-                    <property name="label" translatable="yes">lbl_id_province</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">2</property>
-                  </packing>
+                  <placeholder/>
                 </child>
               </object>
               <packing>
                 <property name="visible">True</property>
                 <property name="spacing">5</property>
                 <child>
-                  <object class="GtkEntry" id="entry20">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="editable">False</property>
-                    <property name="invisible_char">&#x25CF;</property>
-                  </object>
-                  <packing>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="button50">
-                    <property name="label" translatable="yes">...</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label46">
-                    <property name="label" translatable="yes">lbl_id_comuni</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">2</property>
-                  </packing>
+                  <placeholder/>
                 </child>
               </object>
               <packing>
                 <property name="visible">True</property>
                 <property name="spacing">5</property>
                 <child>
-                  <object class="GtkEntry" id="entry23">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="editable">False</property>
-                    <property name="invisible_char">&#x25CF;</property>
-                  </object>
-                  <packing>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="button69">
-                    <property name="label" translatable="yes">...</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label60">
-                    <property name="label" translatable="yes">lbl_id_regioni</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">2</property>
-                  </packing>
+                  <placeholder/>
                 </child>
               </object>
               <packing>
         <child>
           <object class="GtkTable" id="table8">
             <property name="visible">True</property>
-            <property name="n_rows">2</property>
+            <property name="n_rows">3</property>
             <property name="n_columns">2</property>
             <property name="column_spacing">5</property>
             <property name="row_spacing">5</property>
               <object class="GtkLabel" id="label47">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
-                <property name="label" translatable="yes">Provincia</property>
+                <property name="label" translatable="yes">Regione</property>
               </object>
               <packing>
                 <property name="top_attach">1</property>
                 <property name="visible">True</property>
                 <property name="spacing">5</property>
                 <child>
-                  <object class="GtkEntry" id="entry22">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="editable">False</property>
-                    <property name="invisible_char">&#x25CF;</property>
-                  </object>
-                  <packing>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="button54">
-                    <property name="label" translatable="yes">...</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label48">
-                    <property name="label" translatable="yes">lbl_id_province</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">2</property>
-                  </packing>
+                  <placeholder/>
                 </child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
                 <property name="right_attach">2</property>
                 <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label46">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Provincia</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
                 <property name="y_options">GTK_FILL</property>
               </packing>
             </child>
         <child>
           <object class="GtkTable" id="table10">
             <property name="visible">True</property>
-            <property name="n_rows">2</property>
+            <property name="n_rows">4</property>
             <property name="n_columns">2</property>
             <property name="column_spacing">5</property>
             <property name="row_spacing">5</property>
               <object class="GtkLabel" id="label50">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
-                <property name="label" translatable="yes">Comune</property>
+                <property name="label" translatable="yes">Regione</property>
               </object>
               <packing>
                 <property name="top_attach">1</property>
                 <property name="visible">True</property>
                 <property name="spacing">5</property>
                 <child>
-                  <object class="GtkEntry" id="entry25">
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="editable">False</property>
-                    <property name="invisible_char">&#x25CF;</property>
-                  </object>
-                  <packing>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="button59">
-                    <property name="label" translatable="yes">...</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label51">
-                    <property name="label" translatable="yes">lbl_id_comuni</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">2</property>
-                  </packing>
+                  <placeholder/>
                 </child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
                 <property name="right_attach">2</property>
                 <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
+                <property name="bottom_attach">4</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label36">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Provincia</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label38">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Comune</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
                 <property name="y_options">GTK_FILL</property>
               </packing>
             </child>
index 6101241f83d897edb875c69e3b6edcfcd701f147..465dd06bc27dffe44f2d237f1a5102a76c9601c3 100644 (file)
@@ -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
index 78b91e1941e37634ac5d124f704d01714a7dd83f..b62ec02384747abea34ee1b92576e2bf04990ba8 100644 (file)
@@ -21,7 +21,7 @@
 #include <libautoz/autoz.h>
 
 #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)
index 8cfb2d01ae73a18e94cb848efdae1377b49bec5f..49e543d33c9728cad30d973043829ca4820f1493 100644 (file)
@@ -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;
index e39fe0c4be85082fb7c4bf6777a87b07d53a42bc..907ebe613e67c5b4ae6d52dc2b5b704f4d47da56 100644 (file)
@@ -21,7 +21,7 @@
 #include <libautoz/autoz.h>
 
 #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)
index efe1bc7a6e8b2f50ff18051a4486d3a824654157..ec61e33eb021201c41158dd5f9604508b0300e22 100644 (file)
@@ -20,7 +20,7 @@
 #include <libgtkform/form.h>
 
 #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)
index 6c97e496dc0c2c2c06ee1a1e9cbdb4a684b3550f..c36044998403b6272d2546cd0865729ce21c1ba7 100644 (file)
@@ -1,5 +1,5 @@
 /* 
- * Copyright (C) 2010 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2011 Andrea Zagli <azagli@libero.it>
  *
  * 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 <libgtkform/form.h>
 
 #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)
index fc1975dbe2922a2d38ce5086b896c62d665fe3d0..61c9cc91356273f0e320d80f2b8977da3fdaff0e 100644 (file)
@@ -20,7 +20,7 @@
 #include <libgtkform/form.h>
 
 #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)
index da3bd9ad3449fea5dcf0e402b91f2b725c3c3dac..22bf79444691304ed202d6135aa150afb96df42b 100644 (file)
--- a/src/via.c
+++ b/src/via.c
@@ -21,7 +21,7 @@
 #include <libautoz/autoz.h>
 
 #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)
index 1fcc04479d994f3783a25b996ec617a9802a5794..c91acad4ad652848ad617622995122bbb67e1345 100644 (file)
--- 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;
index 8bc34f37caa379733c0e2dd4221179e4db39ce54..d2842cbaf96ac8adb7fc48f31c3285cc10102f46 100644 (file)
@@ -17,8 +17,9 @@
  *
  */
 
-#include <libgtkform/form.h>
+#include <libgtkform/fieldinteger.h>
 #include <libgtkformui/gtkformdecoder.h>
+#include <libgtkformui/gtkformwidgetdecoder.h>
 
 #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;
index ddfc1f680a4389aff6d745be9ecee886c7a5dab4..ac767cf59869f2a0e214dd4ae7536a8966f46d3f 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <gtk/gtk.h>
 
+#include <libgtkform/form.h>
+
 #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