<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="gtkformui" version="0.0"/>
<property name="destroy_with_parent">True</property>
<property name="type_hint">normal</property>
<property name="program_name">Territorio</property>
- <property name="version">0.0.1</property>
- <property name="copyright" translatable="yes">Andrea Zagli</property>
+ <property name="version">0.0.3</property>
+ <property name="copyright" translatable="yes">Andrea Zagli <azagli@libero.it> 2010-2016</property>
<property name="authors">Andrea Zagli <azagli@libero.it></property>
<property name="logo_icon_name">image-missing</property>
<child internal-child="vbox">
</child>
</object>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<object class="GtkListStore" id="lstore_aggregazioni_territoriali">
<columns>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkListStore" id="lstore_province">
<columns>
</child>
</object>
</child>
- </object>
- <object class="GtkWindow" id="w_tipi_aggregazione_territoriale">
- <property name="can_focus">False</property>
- <property name="title" translatable="yes">Tipi aggregazioni territoriali - Territorio</property>
- <property name="modal">True</property>
- <property name="window_position">center-on-parent</property>
- <property name="default_width">550</property>
- <property name="default_height">400</property>
- <property name="destroy_with_parent">True</property>
- <child>
- <object class="GtkBox" id="vbox10">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="orientation">vertical</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkLabel" id="label26">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes"><b>Tipi aggregazioni territoriali</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow5">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">etched-in</property>
- <child>
- <object class="GtkTreeView" id="treeview5">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="model">lstore_tipi_aggregazione_territoriale</property>
- <property name="headers_clickable">False</property>
- <property name="rules_hint">True</property>
- <property name="search_column">0</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection6"/>
- </child>
- <child>
- <object class="GtkTreeViewColumn" id="treeviewcolumn5">
- <property name="title">Nome</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext5"/>
- <attributes>
- <attribute name="text">1</attribute>
- </attributes>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButtonBox" id="hbuttonbox9">
- <property name="visible">True</property>
- <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>
- <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_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button30">
- <property name="label">gtk-edit</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_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button31">
- <property name="label">gtk-delete</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_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button32">
- <property name="label">gtk-cancel</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_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button33">
- <property name="label">gtk-ok</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_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">5</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
+ <child type="titlebar">
+ <placeholder/>
</child>
</object>
<object class="GtkListStore" id="lstore_vie">
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_comune">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_comuni">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_main">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_province">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_provincia">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_regione">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_regioni">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_ricerca_comuni">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_ricerca_province">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_ricerca_vie">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_stati">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_stati_qe">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_stato">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
+ </object>
+ <object class="GtkWindow" id="w_tipi_aggregazione_territoriale">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Tipi aggregazioni territoriali - Territorio</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="default_width">550</property>
+ <property name="default_height">400</property>
+ <property name="destroy_with_parent">True</property>
+ <child>
+ <object class="GtkBox" id="vbox10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkLabel" id="label26">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>Tipi aggregazioni territoriali</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButtonBox" id="hbuttonbox9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button29">
+ <property name="label">gtk-new</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_stock">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="button30">
+ <property name="label">gtk-edit</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_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button31">
+ <property name="label">gtk-delete</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_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button32">
+ <property name="label">gtk-cancel</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_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button33">
+ <property name="label">gtk-ok</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_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_tipo_aggregazione_territoriale">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_via">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
<object class="GtkWindow" id="w_widget">
<property name="can_focus">False</property>
</child>
</object>
</child>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
</object>
</interface>
#include <libzakautho/autho.h>
#include <libsolipa/libsolipa.h>
+#include <libgdaexgrid/libgdaexgrid.h>
#include "tipiaggregazioneterritoriale.h"
#include "tipoaggregazioneterritoriale.h"
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,
TerritorioCommons *commons;
GtkWidget *widget;
+ GdaExGrid *grid;
+ GtkWidget *wgrid;
GtkTreeSelection *selection;
- GtkListStore *lstore_tipi_aggregazione_territoriale;
+ GtkTreeStore *tstore_tipi_aggregazione_territoriale;
gboolean selezione;
GtkWindow *wtransient;
GError *error;
ZakAuthoIResource *ires1;
+ GdaExGridColumn *gcol;
+
TerritorioTipiAggregazioneTerritoriale *a = TERRITORIO_TIPI_AGGREGAZIONE_TERRITORIALE (g_object_new (territorio_tipi_aggregazione_territoriale_get_type (), NULL));
TerritorioTipiAggregazioneTerritorialePrivate *priv = TERRITORIO_TIPI_AGGREGAZIONE_TERRITORIALE_GET_PRIVATE (a);
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"),
+ g_strsplit (g_strconcat ((selezione ? "w_tipi_aggregazione_territoriale" : "vbox10"),
NULL),
"|", -1),
&error);
}
priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, (selezione ? "w_tipi_aggregazione_territoriale" : "vbox10")));
- priv->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview5")));
- priv->lstore_tipi_aggregazione_territoriale = GTK_LIST_STORE (gtk_builder_get_object (priv->commons->gtkbuilder, "lstore_tipi_aggregazione_territoriale"));
+
+ /* creo la gdaexgrid */
+ priv->grid = gdaex_grid_new ();
+ gdaex_grid_set_solipa (priv->grid, priv->commons->solipa);
+ gdaex_grid_set_title (priv->grid, gtk_label_get_text (GTK_LABEL (gtk_builder_get_object (priv->commons->gtkbuilder, "label26"))));
+
+ gcol = gdaex_grid_column_new ("ID", "id", G_TYPE_INT, TRUE, TRUE, TRUE, TRUE, -1);
+ gdaex_grid_add_column (priv->grid, gcol);
+
+ gcol = gdaex_grid_column_new_defaults ("Nome", "nome", G_TYPE_STRING);
+ gdaex_grid_add_column (priv->grid, gcol);
+
+ priv->wgrid = gdaex_grid_get_widget (priv->grid);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (priv->wgrid), 1);
+ gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (priv->commons->gtkbuilder, "scrolledwindow5")), priv->wgrid);
+ gtk_widget_show (priv->wgrid);
+
+ priv->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->wgrid));
+ priv->tstore_tipi_aggregazione_territoriale = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->wgrid)));
if (priv->selezione)
{
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"),
"clicked", G_CALLBACK (territorio_tipi_aggregazione_territoriale_on_btn_modifica_clicked), (gpointer)a);
g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button31"),
"clicked", G_CALLBACK (territorio_tipi_aggregazione_territoriale_on_btn_elimina_clicked), (gpointer)a);
- g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview5"),
+ g_signal_connect (priv->wgrid,
"row-activated", G_CALLBACK (territorio_tipi_aggregazione_territoriale_on_trv_tipi_aggregazione_territoriale_row_activated), (gpointer)a);
if (priv->selezione)
static void
territorio_tipi_aggregazione_territoriale_carica (TerritorioTipiAggregazioneTerritoriale *territorio_tipi_aggregazione_territoriale)
{
- GtkTreeIter iter;
- GdaDataModel *dm;
-
- gint rows;
- gint row;
+ gchar *sql;
TerritorioTipiAggregazioneTerritorialePrivate *priv = TERRITORIO_TIPI_AGGREGAZIONE_TERRITORIALE_GET_PRIVATE (territorio_tipi_aggregazione_territoriale);
- gtk_list_store_clear (priv->lstore_tipi_aggregazione_territoriale);
+ gtk_tree_store_clear (priv->tstore_tipi_aggregazione_territoriale);
- dm = gdaex_query (priv->commons->gdaex,
- "SELECT c.id, c.nome"
+ sql = g_strdup_printf ("SELECT c.id, c.nome"
" FROM tipi_aggregazione_territoriale AS c"
" WHERE c.status <> 'E'"
" ORDER BY c.nome");
- if (dm != NULL)
- {
- rows = gda_data_model_get_n_rows (dm);
- 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"),
- -1);
- }
-
- g_object_unref (dm);
- }
+ gdaex_grid_fill_from_sql (priv->grid,
+ priv->commons->gdaex,
+ sql,
+ NULL);
+ g_free (sql);
}
static void
{
GtkWidget *w;
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_aggregazione_territoriale), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_tipi_aggregazione_territoriale), &iter,
COL_ID, &id,
-1);
if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_aggregazione_territoriale), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_tipi_aggregazione_territoriale), &iter,
COL_ID, &id,
-1);
}
/* 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)
GTK_BUTTONS_YES_NO,
"Sicuro di voler eliminare il tipo aggregazione territoriale selezionato?") == GTK_RESPONSE_YES)
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_aggregazione_territoriale), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_tipi_aggregazione_territoriale), &iter,
COL_ID, &id,
-1);