]> saetta.ns0.it Git - solipa/territorio/commitdiff
Aggiunto il pulsante esporta a tutti gli elenchi (closes #282).
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Thu, 29 Dec 2011 09:34:05 +0000 (10:34 +0100)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Thu, 29 Dec 2011 09:34:05 +0000 (10:34 +0100)
configure.ac
data/territorio/gui/territorio.gui
src/aggregazioniterritoriali.c
src/province.c
src/regioni.c
src/stati.c
src/tipiaggregazioneterritoriale.c
src/vie.c

index b3ddb8e8b326d8c8824435190fee0ea33b924496..b9255b56a4ff50c530b7b3e3b74cc00eb8f2f271 100644 (file)
@@ -31,7 +31,7 @@ PKG_CHECK_MODULES(TERRITORIO, [gio-2.0 >= 2.20
                           libgtkform >= 0.3.1
                           libgtkformui >= 0.3.1
                           libaute >= 0.0.2
-                          libautoz >= 0.0.1
+                          libautoz >= 0.0.2
                           libsolipa >= 0.3.1])
 
 AC_SUBST(TERRITORIO_CFLAGS)
index fe770326ffdb05d8c26d6424f3ddc32812dc99fd..803dab2fa1d62a3be71ddbb140f3837ed329b753 100644 (file)
             <property name="can_focus">False</property>
             <property name="spacing">5</property>
             <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button43">
+                <property name="label" translatable="yes">E_sporta</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkButton" id="button36">
                 <property name="label">gtk-new</property>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">4</property>
+                <property name="position">5</property>
               </packing>
             </child>
           </object>
             <property name="can_focus">False</property>
             <property name="spacing">5</property>
             <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button59">
+                <property name="label" translatable="yes">E_sporta</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkButton" id="button15">
                 <property name="label">gtk-new</property>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">4</property>
+                <property name="position">5</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">5</property>
+                <property name="position">6</property>
               </packing>
             </child>
           </object>
             <property name="can_focus">False</property>
             <property name="spacing">5</property>
             <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button54">
+                <property name="label" translatable="yes">E_sporta</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkButton" id="button8">
                 <property name="label">gtk-new</property>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">4</property>
+                <property name="position">5</property>
               </packing>
             </child>
           </object>
             <property name="can_focus">False</property>
             <property name="spacing">5</property>
             <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button50">
+                <property name="label" translatable="yes">E_sporta</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkButton" id="button1">
                 <property name="label">gtk-new</property>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">4</property>
+                <property name="position">5</property>
               </packing>
             </child>
           </object>
             <property name="can_focus">False</property>
             <property name="spacing">5</property>
             <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button44">
+                <property name="label" translatable="yes">E_sporta</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkButton" id="button29">
                 <property name="label">gtk-new</property>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">4</property>
+                <property name="position">5</property>
               </packing>
             </child>
           </object>
             <property name="can_focus">False</property>
             <property name="spacing">5</property>
             <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button64">
+                <property name="label" translatable="yes">E_sporta</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
             <child>
               <object class="GtkButton" id="button45">
                 <property name="label">gtk-new</property>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">3</property>
+                <property name="position">4</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">4</property>
+                <property name="position">5</property>
               </packing>
             </child>
             <child>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">5</property>
+                <property name="position">6</property>
               </packing>
             </child>
           </object>
index d0cba5d18d84330ef17a8748f26d3e2b4bdd42af..6cfee4d025bef8e6f35eae51231dd38b965749ff 100644 (file)
@@ -40,6 +40,8 @@ static void territorio_aggregazioni_territoriali_get_property (GObject *object,
                                      GValue *value,
                                      GParamSpec *pspec);
 
+static void territorio_aggregazioni_territoriali_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data);
 static void territorio_aggregazioni_territoriali_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data);
 static void territorio_aggregazioni_territoriali_on_btn_modifica_clicked (GtkButton *button,
@@ -135,8 +137,9 @@ TerritorioAggregazioniTerritoriali
        error = NULL;
        gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
                                           g_strsplit (g_strconcat ("lstore_aggregazioni_territoriali|",
-                                          (selezione ? "w_aggregazioni_territoriali" : "vbox12"),
-                                          NULL), "|", -1),
+                                                                   (selezione ? "w_aggregazioni_territoriali" : "vbox12"),
+                                                                   NULL),
+                                                      "|", -1),
                                           &error);
        if (error != NULL)
                {
@@ -157,6 +160,8 @@ TerritorioAggregazioniTerritoriali
                        priv->wtransient = GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main"));
                }
 
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button43"),
+                         "clicked", G_CALLBACK (territorio_aggregazioni_territoriali_on_btn_esporta_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button36"),
                          "clicked", G_CALLBACK (territorio_aggregazioni_territoriali_on_btn_nuovo_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button37"),
@@ -269,13 +274,10 @@ territorio_aggregazioni_territoriali_modifica (TerritorioAggregazioniTerritorial
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare un'aggregazione territoriale");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un'aggregazione territoriale");
                }
 }
 
@@ -301,13 +303,10 @@ territorio_aggregazioni_territoriali_selezionato (TerritorioAggregazioniTerritor
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un'aggregazione territoriale");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un'aggregazione territoriale");
                }
 }
 
@@ -321,7 +320,6 @@ static void
 territorio_aggregazioni_territoriali_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        TerritorioAggregazioniTerritoriali *territorio_aggregazioni_territoriali = TERRITORIO_AGGREGAZIONI_TERRITORIALI (object);
-
        TerritorioAggregazioniTerritorialiPrivate *priv = TERRITORIO_AGGREGAZIONI_TERRITORIALI_GET_PRIVATE (territorio_aggregazioni_territoriali);
 
        switch (property_id)
@@ -336,7 +334,6 @@ static void
 territorio_aggregazioni_territoriali_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        TerritorioAggregazioniTerritoriali *territorio_aggregazioni_territoriali = TERRITORIO_AGGREGAZIONI_TERRITORIALI (object);
-
        TerritorioAggregazioniTerritorialiPrivate *priv = TERRITORIO_AGGREGAZIONI_TERRITORIALI_GET_PRIVATE (territorio_aggregazioni_territoriali);
 
        switch (property_id)
@@ -348,6 +345,48 @@ territorio_aggregazioni_territoriali_get_property (GObject *object, guint proper
 }
 
 /* CALLBACK */
+static void
+territorio_aggregazioni_territoriali_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       GtkWidget *transient;
+
+       guint ret;
+
+       TerritorioAggregazioniTerritoriali *territorio_aggregazioni_territoriali = (TerritorioAggregazioniTerritoriali *)user_data;
+       TerritorioAggregazioniTerritorialiPrivate *priv = TERRITORIO_AGGREGAZIONI_TERRITORIALI_GET_PRIVATE (territorio_aggregazioni_territoriali);
+
+       gchar **columns_title = g_strsplit ("ID|Tipo|Aggregazione", "|", -1);
+
+       if (priv->selezione)
+               {
+                       transient = priv->widget;
+               }
+       else
+               {
+                       transient = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main"));
+               }
+
+       ret = solipa_gtktreemodel_to_csv_gui (priv->commons->solipa, GTK_WINDOW (transient), GTK_TREE_MODEL (priv->lstore_aggregazioni_territoriali),
+                                             columns_title, g_strv_length (columns_title));
+       if (ret == 1)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
+               }
+       else if (ret == 0)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
+               }
+
+       g_strfreev (columns_title);
+}
+
 static void
 territorio_aggregazioni_territoriali_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
@@ -434,13 +473,10 @@ territorio_aggregazioni_territoriali_on_btn_elimina_clicked (GtkButton *button,
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un'aggregazione territoriale");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un'aggregazione territoriale");
                }
 }
 
index 9717d3943fe1bfa5fe086312be88d2d8756baad0..c9c1ab7f79587a6c707397681a7881f7ad473c9a 100644 (file)
@@ -52,6 +52,8 @@ static gboolean territorio_province_on_key_release_event (GtkWidget *widget,
 static void territorio_province_on_map (GtkWidget *widget,
                                         gpointer user_data);
 
+static void territorio_province_on_btn_esporta_clicked (GtkButton *button,
+                                                      gpointer user_data);
 static void territorio_province_on_btn_nuovo_clicked (GtkButton *button,
                                                       gpointer user_data);
 static void territorio_province_on_btn_modifica_clicked (GtkButton *button,
@@ -200,6 +202,8 @@ TerritorioProvince
        priv->signal_map = g_signal_connect (priv->widget,
                          "map", G_CALLBACK (territorio_province_on_map), (gpointer)a);
 
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button59"),
+                         "clicked", G_CALLBACK (territorio_province_on_btn_esporta_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button15"),
                          "clicked", G_CALLBACK (territorio_province_on_btn_nuovo_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button16"),
@@ -315,7 +319,6 @@ territorio_province_carica (TerritorioProvince *territorio_province)
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_province, &iter);
-
                                        gtk_list_store_set (priv->lstore_province, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
                                                            COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
@@ -355,13 +358,10 @@ territorio_province_modifica (TerritorioProvince *territorio_province)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare una provincia.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una provincia.");
                }
 }
 
@@ -387,13 +387,10 @@ territorio_province_selezionato (TerritorioProvince *territorio_province)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare una provincia.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una provincia.");
                }
 }
 
@@ -488,6 +485,48 @@ territorio_province_on_map (GtkWidget *widget,
        g_signal_handler_disconnect (G_OBJECT (priv->widget), priv->signal_map);
 }
 
+static void
+territorio_province_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       GtkWidget *transient;
+
+       guint ret;
+
+       TerritorioProvince *territorio_province = (TerritorioProvince *)user_data;
+       TerritorioProvincePrivate *priv = TERRITORIO_PROVINCE_GET_PRIVATE (territorio_province);
+
+       gchar **columns_title = g_strsplit ("ID|Provincia|Sigla|Regione", "|", -1);
+
+       if (priv->selezione)
+               {
+                       transient = priv->widget;
+               }
+       else
+               {
+                       transient = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main"));
+               }
+
+       ret = solipa_gtktreemodel_to_csv_gui (priv->commons->solipa, GTK_WINDOW (transient), GTK_TREE_MODEL (priv->lstore_province),
+                                             columns_title, g_strv_length (columns_title));
+       if (ret == 1)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
+               }
+       else if (ret == 0)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
+               }
+
+       g_strfreev (columns_title);
+}
+
 static void
 territorio_province_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
@@ -532,9 +571,6 @@ territorio_province_on_btn_elimina_clicked (GtkButton *button,
 {
        AutozIResource *ires1;
 
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        guint id;
 
@@ -553,13 +589,10 @@ territorio_province_on_btn_elimina_clicked (GtkButton *button,
                                        return;
                                }
 
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_QUESTION,
-                                                        GTK_BUTTONS_YES_NO,
-                                                        "Sicuro di voler eliminare la provincia selezionata?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare la provincia selezionata?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_province), &iter,
                                                            COL_ID, &id,
@@ -570,17 +603,13 @@ territorio_province_on_btn_elimina_clicked (GtkButton *button,
 
                                        territorio_province_carica (territorio_province);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare una provincia.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una provincia.");
                }
 }
 
index 381923260e52bac73112b3b63c56ebd73d279cc3..485420672cad85c8364e7b03659d2b3d8267d984 100644 (file)
@@ -46,6 +46,8 @@ static gboolean territorio_regioni_on_key_release_event (GtkWidget *widget,
                                                           GdkEventKey *event,
                                                           gpointer user_data);
 
+static void territorio_regioni_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data);
 static void territorio_regioni_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data);
 static void territorio_regioni_on_btn_modifica_clicked (GtkButton *button,
@@ -140,8 +142,9 @@ TerritorioRegioni
        error = NULL;
        gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
                                           g_strsplit (g_strconcat ("lstore_regioni|",
-                                          (selezione ? "w_regioni" : "vbox4"),
-                                          NULL), "|", -1),
+                                                                   (selezione ? "w_regioni" : "vbox4"),
+                                                                   NULL),
+                                                      "|", -1),
                                           &error);
        if (error != NULL)
                {
@@ -165,6 +168,8 @@ TerritorioRegioni
        g_signal_connect (priv->widget,
                          "key-release-event", G_CALLBACK (territorio_regioni_on_key_release_event), (gpointer)a);
 
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button54"),
+                         "clicked", G_CALLBACK (territorio_regioni_on_btn_esporta_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button8"),
                          "clicked", G_CALLBACK (territorio_regioni_on_btn_nuovo_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button9"),
@@ -238,7 +243,6 @@ territorio_regioni_carica (TerritorioRegioni *territorio_regioni)
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_regioni, &iter);
-
                                        gtk_list_store_set (priv->lstore_regioni, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
                                                            COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
@@ -276,13 +280,10 @@ territorio_regioni_modifica (TerritorioRegioni *territorio_regioni)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare una regione");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una regione");
                }
 }
 
@@ -308,13 +309,10 @@ territorio_regioni_selezionato (TerritorioRegioni *territorio_regioni)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare una regione");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una regione");
                }
 }
 
@@ -372,6 +370,48 @@ territorio_regioni_on_key_release_event (GtkWidget *widget,
        return FALSE;
 }
 
+static void
+territorio_regioni_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       GtkWidget *transient;
+
+       guint ret;
+
+       TerritorioRegioni *territorio_regioni = (TerritorioRegioni *)user_data;
+       TerritorioRegioniPrivate *priv = TERRITORIO_REGIONI_GET_PRIVATE (territorio_regioni);
+
+       gchar **columns_title = g_strsplit ("ID|Regione", "|", -1);
+
+       if (priv->selezione)
+               {
+                       transient = priv->widget;
+               }
+       else
+               {
+                       transient = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main"));
+               }
+
+       ret = solipa_gtktreemodel_to_csv_gui (priv->commons->solipa, GTK_WINDOW (transient), GTK_TREE_MODEL (priv->lstore_regioni),
+                                             columns_title, g_strv_length (columns_title));
+       if (ret == 1)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
+               }
+       else if (ret == 0)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
+               }
+
+       g_strfreev (columns_title);
+}
+
 static void
 territorio_regioni_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
@@ -416,9 +456,6 @@ territorio_regioni_on_btn_elimina_clicked (GtkButton *button,
 {
        AutozIResource *ires1;
 
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        guint id;
 
@@ -437,13 +474,10 @@ territorio_regioni_on_btn_elimina_clicked (GtkButton *button,
                                        return;
                                }
 
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_QUESTION,
-                                                        GTK_BUTTONS_YES_NO,
-                                                        "Sicuro di voler eliminare la regione selezionata?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare la regione selezionata?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_regioni), &iter,
                                                            COL_ID, &id,
@@ -454,17 +488,13 @@ territorio_regioni_on_btn_elimina_clicked (GtkButton *button,
 
                                        territorio_regioni_carica (territorio_regioni);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare una regione");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una regione");
                }
 }
 
index b9a61fcafd63c1940a9528ed337909d8bddf1c96..0404acd9a6248915fe3e3320c87fe9cab4ff0f4f 100644 (file)
@@ -46,6 +46,8 @@ static gboolean territorio_stati_on_key_release_event (GtkWidget *widget,
                                                        GdkEventKey *event,
                                                        gpointer user_data);
 
+static void territorio_stati_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data);
 static void territorio_stati_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data);
 static void territorio_stati_on_btn_modifica_clicked (GtkButton *button,
@@ -165,6 +167,8 @@ TerritorioStati
        g_signal_connect (priv->widget,
                          "key-release-event", G_CALLBACK (territorio_stati_on_key_release_event), (gpointer)a);
 
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button50"),
+                         "clicked", G_CALLBACK (territorio_stati_on_btn_esporta_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button1"),
                          "clicked", G_CALLBACK (territorio_stati_on_btn_nuovo_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button2"),
@@ -238,7 +242,6 @@ territorio_stati_carica (TerritorioStati *territorio_stati)
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_stati, &iter);
-
                                        gtk_list_store_set (priv->lstore_stati, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
                                                            COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
@@ -276,13 +279,10 @@ territorio_stati_modifica (TerritorioStati *territorio_stati)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare uno stato");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare uno stato");
                }
 }
 
@@ -308,13 +308,10 @@ territorio_stati_selezionato (TerritorioStati *territorio_stati)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare uno stato");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare uno stato");
                }
 }
 
@@ -372,6 +369,48 @@ territorio_stati_on_key_release_event (GtkWidget *widget,
        return FALSE;
 }
 
+static void
+territorio_stati_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       GtkWidget *transient;
+
+       guint ret;
+
+       TerritorioStati *territorio_stati = (TerritorioStati *)user_data;
+       TerritorioStatiPrivate *priv = TERRITORIO_STATI_GET_PRIVATE (territorio_stati);
+
+       gchar **columns_title = g_strsplit ("ID|Stato", "|", -1);
+
+       if (priv->selezione)
+               {
+                       transient = priv->widget;
+               }
+       else
+               {
+                       transient = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main"));
+               }
+
+       ret = solipa_gtktreemodel_to_csv_gui (priv->commons->solipa, GTK_WINDOW (transient), GTK_TREE_MODEL (priv->lstore_stati),
+                                             columns_title, g_strv_length (columns_title));
+       if (ret == 1)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
+               }
+       else if (ret == 0)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
+               }
+
+       g_strfreev (columns_title);
+}
+
 static void
 territorio_stati_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
@@ -458,13 +497,10 @@ territorio_stati_on_btn_elimina_clicked (GtkButton *button,
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare uno stato");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare uno stato");
                }
 }
 
index 600fc0f90ab074da242d27eb9e3686185b386ac7..2dee4193a3a9cd0ed20006b8d0d04fe4dfb09602 100644 (file)
@@ -40,6 +40,8 @@ static void territorio_tipi_aggregazione_territoriale_get_property (GObject *obj
                                      GValue *value,
                                      GParamSpec *pspec);
 
+static void territorio_tipi_aggregazione_territoriale_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data);
 static void territorio_tipi_aggregazione_territoriale_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data);
 static void territorio_tipi_aggregazione_territoriale_on_btn_modifica_clicked (GtkButton *button,
@@ -134,8 +136,9 @@ TerritorioTipiAggregazioneTerritoriale
        error = NULL;
        gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
                                           g_strsplit (g_strconcat ("lstore_tipi_aggregazione_territoriale|",
-                                          (selezione ? "w_tipi_aggregazione_territoriale" : "vbox10"),
-                                          NULL), "|", -1),
+                                                                   (selezione ? "w_tipi_aggregazione_territoriale" : "vbox10"),
+                                                                   NULL),
+                                                      "|", -1),
                                           &error);
        if (error != NULL)
                {
@@ -156,6 +159,8 @@ TerritorioTipiAggregazioneTerritoriale
                        priv->wtransient = GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main"));
                }
 
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button44"),
+                         "clicked", G_CALLBACK (territorio_tipi_aggregazione_territoriale_on_btn_esporta_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button29"),
                          "clicked", G_CALLBACK (territorio_tipi_aggregazione_territoriale_on_btn_nuovo_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button30"),
@@ -229,7 +234,6 @@ territorio_tipi_aggregazione_territoriale_carica (TerritorioTipiAggregazioneTerr
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_tipi_aggregazione_territoriale, &iter);
-
                                        gtk_list_store_set (priv->lstore_tipi_aggregazione_territoriale, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_stringify_at (dm, row, "id"),
                                                            COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
@@ -267,13 +271,10 @@ territorio_tipi_aggregazione_territoriale_modifica (TerritorioTipiAggregazioneTe
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare un tipo aggregazione territoriale");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo aggregazione territoriale.");
                }
 }
 
@@ -299,13 +300,10 @@ territorio_tipi_aggregazione_territoriale_selezionato (TerritorioTipiAggregazion
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un tipo aggregazione territoriale");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo aggregazione territoriale.");
                }
 }
 
@@ -344,6 +342,48 @@ territorio_tipi_aggregazione_territoriale_get_property (GObject *object, guint p
 }
 
 /* CALLBACK */
+static void
+territorio_tipi_aggregazione_territoriale_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       GtkWidget *transient;
+
+       guint ret;
+
+       TerritorioTipiAggregazioneTerritoriale *territorio_tipi_aggregazione_territoriale = (TerritorioTipiAggregazioneTerritoriale *)user_data;
+       TerritorioTipiAggregazioneTerritorialePrivate *priv = TERRITORIO_TIPI_AGGREGAZIONE_TERRITORIALE_GET_PRIVATE (territorio_tipi_aggregazione_territoriale);
+
+       gchar **columns_title = g_strsplit ("ID|Tipo aggregazione", "|", -1);
+
+       if (priv->selezione)
+               {
+                       transient = priv->widget;
+               }
+       else
+               {
+                       transient = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main"));
+               }
+
+       ret = solipa_gtktreemodel_to_csv_gui (priv->commons->solipa, GTK_WINDOW (transient), GTK_TREE_MODEL (priv->lstore_tipi_aggregazione_territoriale),
+                                             columns_title, g_strv_length (columns_title));
+       if (ret == 1)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
+               }
+       else if (ret == 0)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
+               }
+
+       g_strfreev (columns_title);
+}
+
 static void
 territorio_tipi_aggregazione_territoriale_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)
@@ -430,13 +470,10 @@ territorio_tipi_aggregazione_territoriale_on_btn_elimina_clicked (GtkButton *but
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un tipo aggregazione territoriale");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo aggregazione territoriale");
                }
 }
 
@@ -458,7 +495,6 @@ territorio_tipi_aggregazione_territoriale_on_trv_tipi_aggregazione_territoriale_
                }
 }
 
-
 static void
 territorio_tipi_aggregazione_territoriale_on_btn_annulla_clicked (GtkButton *button,
                         gpointer user_data)
index 7bad6e09fa8eb43b789de9a9bac04beba8606c6c..0e5207cc3560086573b6733913f026d9c4b582f8 100644 (file)
--- a/src/vie.c
+++ b/src/vie.c
@@ -54,6 +54,8 @@ static gboolean territorio_vie_on_key_release_event (GtkWidget *widget,
 static void territorio_vie_on_map (GtkWidget *widget,
                                         gpointer user_data);
 
+static void territorio_vie_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data);
 static void territorio_vie_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data);
 static void territorio_vie_on_btn_modifica_clicked (GtkButton *button,
@@ -212,6 +214,8 @@ TerritorioVie
        priv->signal_map = g_signal_connect (priv->widget,
                          "map", G_CALLBACK (territorio_vie_on_map), (gpointer)a);
 
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button64"),
+                         "clicked", G_CALLBACK (territorio_vie_on_btn_esporta_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button45"),
                          "clicked", G_CALLBACK (territorio_vie_on_btn_nuovo_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button46"),
@@ -515,6 +519,48 @@ territorio_vie_on_map (GtkWidget *widget,
        g_signal_handler_disconnect (G_OBJECT (priv->widget), priv->signal_map);
 }
 
+static void
+territorio_vie_on_btn_esporta_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       GtkWidget *transient;
+
+       guint ret;
+
+       TerritorioVie *territorio_vie = (TerritorioVie *)user_data;
+       TerritorioViePrivate *priv = TERRITORIO_VIE_GET_PRIVATE (territorio_vie);
+
+       gchar **columns_title = g_strsplit ("ID|Via|{SKIP}|Comune|Provincia|Regione", "|", -1);
+
+       if (priv->selezione)
+               {
+                       transient = priv->widget;
+               }
+       else
+               {
+                       transient = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main"));
+               }
+
+       ret = solipa_gtktreemodel_to_csv_gui (priv->commons->solipa, GTK_WINDOW (transient), GTK_TREE_MODEL (priv->lstore_vie),
+                                             columns_title, g_strv_length (columns_title));
+       if (ret == 1)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
+               }
+       else if (ret == 0)
+               {
+                       solipa_message_dialog (transient,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
+               }
+
+       g_strfreev (columns_title);
+}
+
 static void
 territorio_vie_on_btn_nuovo_clicked (GtkButton *button,
                       gpointer user_data)