<column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="lstore_province">
+ <object class="GtkListStore" id="lstore_tipi_aggregazione_territoriale">
<columns>
<!-- column-name id -->
- <column type="guint"/>
+ <column type="gchararray"/>
<!-- column-name nome -->
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="lstore_comuni">
+ <object class="GtkListStore" id="lstore_aggregazioni_territoriali">
<columns>
<!-- column-name id -->
- <column type="guint"/>
+ <column type="gchararray"/>
<!-- column-name nome -->
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="lstore_tipi_aggregazione_territoriale">
+ <object class="GtkListStore" id="lstore_comuni">
<columns>
<!-- column-name id -->
- <column type="gchararray"/>
+ <column type="guint"/>
<!-- column-name nome -->
<column type="gchararray"/>
+ <!-- column-name provincia -->
+ <column type="gchararray"/>
+ <!-- column-name regione -->
+ <column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="lstore_aggregazioni_territoriali">
+ <object class="GtkListStore" id="lstore_province">
<columns>
<!-- column-name id -->
- <column type="gchararray"/>
+ <column type="guint"/>
<!-- column-name nome -->
<column type="gchararray"/>
+ <!-- column-name sigla -->
+ <column type="gchararray"/>
+ <!-- column-name regione -->
+ <column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="lstore_vie">
<column type="guint"/>
<!-- column-name nome -->
<column type="gchararray"/>
+ <!-- column-name comune -->
+ <column type="gchararray"/>
+ <!-- column-name provincia -->
+ <column type="gchararray"/>
+ <!-- column-name regione -->
+ <column type="gchararray"/>
</columns>
</object>
<object class="GtkWindow" id="w_stati">
</child>
</object>
</child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn11">
+ <property name="title">Sigla</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext12"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn8">
+ <property name="title">Regione</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext9"/>
+ <attributes>
+ <attribute name="text">3</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
</object>
</child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn9">
+ <property name="title">Provincia</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext10"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn10">
+ <property name="title">Regione</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext11"/>
+ <attributes>
+ <attribute name="text">3</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
</object>
</child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn12">
+ <property name="title">Comune</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext13"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn13">
+ <property name="title">Provincia</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext14"/>
+ <attributes>
+ <attribute name="text">3</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn14">
+ <property name="title">Regione</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext15"/>
+ <attributes>
+ <attribute name="text">4</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
enum
{
COL_ID,
- COL_NOME
+ COL_NOME,
+ COL_PROVINCIA,
+ COL_REGIONE
};
typedef struct _TerritorioComuniPrivate TerritorioComuniPrivate;
}
}
- sql = g_strdup_printf ("SELECT c.id, c.nome"
+ sql = g_strdup_printf ("SELECT c.id, c.nome,"
+ " p.nome || ' (' || p.sigla || ')' AS provincia,"
+ " r.nome AS regione"
" FROM comuni AS c"
+ " INNER JOIN province AS p ON c.id_province = p.id"
+ " INNER JOIN regioni AS r ON p.id_regioni = r.id"
" WHERE c.status <> 'E'"
"%s"
" ORDER BY c.nome",
gtk_list_store_set (priv->lstore_comuni, &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"),
+ COL_PROVINCIA, gdaex_data_model_get_field_value_stringify_at (dm, row, "provincia"),
+ COL_REGIONE, gdaex_data_model_get_field_value_stringify_at (dm, row, "regione"),
-1);
}
enum
{
COL_ID,
- COL_NOME
+ COL_NOME,
+ COL_SIGLA,
+ COL_REGIONE
};
typedef struct _TerritorioProvincePrivate TerritorioProvincePrivate;
}
}
- sql = g_strdup_printf ("SELECT c.id, c.nome"
+ sql = g_strdup_printf ("SELECT c.id, c.nome, c.sigla, r.nome AS regione"
" FROM province AS c"
+ " INNER JOIN regioni AS r ON c.id_regioni = r.id"
" WHERE c.status <> 'E'"
"%s"
" ORDER BY c.nome",
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"),
+ COL_SIGLA, gdaex_data_model_get_field_value_stringify_at (dm, row, "sigla"),
+ COL_REGIONE, gdaex_data_model_get_field_value_stringify_at (dm, row, "regione"),
-1);
}
enum
{
COL_ID,
- COL_NOME
+ COL_NOME,
+ COL_COMUNE,
+ COL_PROVINCIA,
+ COL_REGIONE
};
typedef struct _TerritorioViePrivate TerritorioViePrivate;
gcval = g_strstrip ((gchar *)g_value_get_string ((GValue *)g_hash_table_lookup (priv->parametri_ricerca, "nome")));
if (g_strcmp0 (gcval, "") != 0)
{
- sql_where = g_strconcat (sql_where, " AND c.nome ILIKE '%",
+ sql_where = g_strconcat (sql_where, " AND v.nome ILIKE '%",
g_strdup_printf ("%s", gcval),
"%'",
NULL);
ival = g_value_get_int ((GValue *)g_hash_table_lookup (priv->parametri_ricerca, "id_comuni"));
if (ival != 0)
{
- sql_where = g_strconcat (sql_where, " AND c.id_comuni = ",
+ sql_where = g_strconcat (sql_where, " AND v.id_comuni = ",
g_strdup_printf ("%d", ival),
NULL);
}
}
- sql = g_strdup_printf ("SELECT c.id, c.nome"
- " FROM vie AS c"
- " WHERE c.status <> 'E'"
+ sql = g_strdup_printf ("SELECT v.id, v.nome,"
+ " c.nome AS comune,"
+ " p.nome || ' (' || p.sigla || ')' AS provincia,"
+ " r.nome AS regione"
+ " FROM vie AS v"
+ " INNER JOIN comuni AS c ON v.id_comuni = c.id"
+ " INNER JOIN province AS p ON c.id_province = p.id"
+ " INNER JOIN regioni AS r ON p.id_regioni = r.id"
+ " WHERE v.status <> 'E'"
"%s"
- " ORDER BY c.nome",
+ " ORDER BY v.nome",
sql_where);
dm = gdaex_query (priv->commons->gdaex, sql);
gtk_list_store_set (priv->lstore_vie, &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"),
+ COL_COMUNE, gdaex_data_model_get_field_value_stringify_at (dm, row, "comune"),
+ COL_PROVINCIA, gdaex_data_model_get_field_value_stringify_at (dm, row, "provincia"),
+ COL_REGIONE, gdaex_data_model_get_field_value_stringify_at (dm, row, "regione"),
-1);
}