From 68ce7e2cd0afaf09801cd3554b498298dbb5ea23 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Wed, 25 Aug 2010 11:00:22 +0200 Subject: [PATCH] Messi i campi id_regioni e id_province nelle tabelle province e comuni (i cambiamenti verranno gestiti direttamente con libaudit). Aggiunti a git i file del progetto eclipse. --- .cproject | 121 ++++++++++++++++ .project | 71 +++++++++ data/territorio/form/comune.form | 19 +++ data/territorio/form/provincia.form | 19 +++ data/territorio/gui/territorio.gui | 216 +++++++++++++++++++++------- docs/territorio.sql | 124 +++++----------- src/comune.c | 38 +++++ src/provincia.c | 38 +++++ 8 files changed, 509 insertions(+), 137 deletions(-) create mode 100644 .cproject create mode 100644 .project diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..5113583 --- /dev/null +++ b/.cproject @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..6b676e5 --- /dev/null +++ b/.project @@ -0,0 +1,71 @@ + + + territorio + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + ?name? + + + + org.eclipse.cdt.make.core.append_environment + true + + + org.eclipse.cdt.make.core.buildArguments + + + + org.eclipse.cdt.make.core.buildCommand + make + + + org.eclipse.cdt.make.core.buildLocation + ${workspace_loc:/territorio/Default} + + + org.eclipse.cdt.make.core.contents + org.eclipse.cdt.make.core.activeConfigSettings + + + org.eclipse.cdt.make.core.enableAutoBuild + false + + + org.eclipse.cdt.make.core.enableCleanBuild + true + + + org.eclipse.cdt.make.core.enableFullBuild + true + + + org.eclipse.cdt.make.core.stopOnError + true + + + org.eclipse.cdt.make.core.useDefaultBuildCmd + true + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/data/territorio/form/comune.form b/data/territorio/form/comune.form index a6578c0..ffd57c6 100644 --- a/data/territorio/form/comune.form +++ b/data/territorio/form/comune.form @@ -22,4 +22,23 @@ + + + f + f + + + + + + entry16 + + SELECT nome FROM province WHERE id = ##label38::gint + + + + t + + + diff --git a/data/territorio/form/provincia.form b/data/territorio/form/provincia.form index fd38096..6d64aff 100644 --- a/data/territorio/form/provincia.form +++ b/data/territorio/form/provincia.form @@ -22,4 +22,23 @@ + + + f + f + + + + + + entry15 + + SELECT nome FROM regioni WHERE id = ##label36::gint + + + + t + + + diff --git a/data/territorio/gui/territorio.gui b/data/territorio/gui/territorio.gui index c77353f..4aa5fd6 100644 --- a/data/territorio/gui/territorio.gui +++ b/data/territorio/gui/territorio.gui @@ -201,6 +201,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Stati - Territorio True @@ -339,54 +387,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Stato - Territorio True @@ -1049,7 +1049,7 @@ True - 4 + 5 2 5 5 @@ -1160,6 +1160,64 @@ GTK_FILL + + + True + 0 + Regione + + + 4 + 5 + GTK_FILL + GTK_FILL + + + + + True + 5 + + + True + True + False + + + + 0 + + + + + ... + True + True + True + + + False + 1 + + + + + lbl_id_regioni + + + False + 2 + + + + + 1 + 2 + 4 + 5 + GTK_FILL + + 0 @@ -1359,7 +1417,7 @@ True - 4 + 5 2 5 5 @@ -1470,6 +1528,64 @@ GTK_FILL + + + True + 0 + Provincia + + + 4 + 5 + GTK_FILL + GTK_FILL + + + + + True + 5 + + + True + True + False + + + + 0 + + + + + ... + True + True + True + + + False + 1 + + + + + lbl_id_province + + + False + 2 + + + + + 1 + 2 + 4 + 5 + GTK_FILL + + 0 diff --git a/docs/territorio.sql b/docs/territorio.sql index 411eaf9..8eacb3d 100644 --- a/docs/territorio.sql +++ b/docs/territorio.sql @@ -2,7 +2,7 @@ -- PostgreSQL database dump -- --- Started on 2010-08-24 16:56:56 +-- Started on 2010-08-25 10:29:20 SET statement_timeout = 0; SET client_encoding = 'UTF8'; @@ -12,7 +12,7 @@ SET client_min_messages = warning; SET escape_string_warning = off; -- --- TOC entry 1839 (class 1262 OID 59420) +-- TOC entry 1827 (class 1262 OID 59420) -- Name: territorio; Type: DATABASE; Schema: -; Owner: - -- @@ -29,7 +29,7 @@ SET client_min_messages = warning; SET escape_string_warning = off; -- --- TOC entry 321 (class 2612 OID 16386) +-- TOC entry 317 (class 2612 OID 16386) -- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: - -- @@ -43,8 +43,8 @@ SET default_tablespace = ''; SET default_with_oids = false; -- --- TOC entry 1514 (class 1259 OID 59503) --- Dependencies: 1810 1811 3 +-- TOC entry 1508 (class 1259 OID 59503) +-- Dependencies: 1802 1803 3 -- Name: aggregazioni_territoriali; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -57,24 +57,8 @@ CREATE TABLE aggregazioni_territoriali ( -- --- TOC entry 1512 (class 1259 OID 59490) --- Dependencies: 1807 3 --- Name: comune_province; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE comune_province ( - id integer NOT NULL, - id_comuni integer, - id_province integer, - da_data date, - a_data date, - status character varying(1) DEFAULT ''::character varying -); - - --- --- TOC entry 1511 (class 1259 OID 59481) --- Dependencies: 1803 1804 1805 1806 3 +-- TOC entry 1506 (class 1259 OID 59481) +-- Dependencies: 1796 1797 1798 1799 3 -- Name: comuni; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -83,13 +67,14 @@ CREATE TABLE comuni ( nome character varying(255) DEFAULT ''::character varying, cod_istat character varying(5) DEFAULT ''::character varying, cap character varying(5) DEFAULT ''::character varying, - status character varying(1) DEFAULT ''::character varying + status character varying(1) DEFAULT ''::character varying, + id_province integer ); -- --- TOC entry 1516 (class 1259 OID 59532) --- Dependencies: 1815 1816 1817 1818 3 +-- TOC entry 1510 (class 1259 OID 59532) +-- Dependencies: 1807 1808 1809 1810 3 -- Name: province; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -98,29 +83,14 @@ CREATE TABLE province ( nome character varying(255) DEFAULT ''::character varying, cod_istat character varying(5) DEFAULT ''::character varying, sigla character varying(5) DEFAULT ''::character varying, - status character varying(1) DEFAULT ''::character varying + status character varying(1) DEFAULT ''::character varying, + id_regioni integer ); -- --- TOC entry 1510 (class 1259 OID 59475) --- Dependencies: 1802 3 --- Name: provincia_regioni; Type: TABLE; Schema: public; Owner: -; Tablespace: --- - -CREATE TABLE provincia_regioni ( - id integer NOT NULL, - id_province integer, - id_regioni integer, - da_data date, - a_data date, - status character varying(1) DEFAULT ''::character varying -); - - --- --- TOC entry 1509 (class 1259 OID 59459) --- Dependencies: 1799 1800 1801 3 +-- TOC entry 1505 (class 1259 OID 59459) +-- Dependencies: 1793 1794 1795 3 -- Name: regioni; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -133,8 +103,8 @@ CREATE TABLE regioni ( -- --- TOC entry 1508 (class 1259 OID 59446) --- Dependencies: 1794 1795 1796 1797 1798 3 +-- TOC entry 1504 (class 1259 OID 59446) +-- Dependencies: 1788 1789 1790 1791 1792 3 -- Name: stati; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -150,8 +120,8 @@ CREATE TABLE stati ( -- --- TOC entry 1513 (class 1259 OID 59496) --- Dependencies: 1808 1809 3 +-- TOC entry 1507 (class 1259 OID 59496) +-- Dependencies: 1800 1801 3 -- Name: tipi_aggregazione_territoriale; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -163,8 +133,8 @@ CREATE TABLE tipi_aggregazione_territoriale ( -- --- TOC entry 1515 (class 1259 OID 59524) --- Dependencies: 1812 1813 1814 3 +-- TOC entry 1509 (class 1259 OID 59524) +-- Dependencies: 1804 1805 1806 3 -- Name: vie; Type: TABLE; Schema: public; Owner: -; Tablespace: -- @@ -178,8 +148,8 @@ CREATE TABLE vie ( -- --- TOC entry 1832 (class 2606 OID 59509) --- Dependencies: 1514 1514 +-- TOC entry 1820 (class 2606 OID 59509) +-- Dependencies: 1508 1508 -- Name: aggregazioni_territoriali_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -188,18 +158,8 @@ ALTER TABLE ONLY aggregazioni_territoriali -- --- TOC entry 1828 (class 2606 OID 59495) --- Dependencies: 1512 1512 --- Name: comune_province_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY comune_province - ADD CONSTRAINT comune_province_pkey PRIMARY KEY (id); - - --- --- TOC entry 1826 (class 2606 OID 59489) --- Dependencies: 1511 1511 +-- TOC entry 1816 (class 2606 OID 59489) +-- Dependencies: 1506 1506 -- Name: comuni_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -208,8 +168,8 @@ ALTER TABLE ONLY comuni -- --- TOC entry 1836 (class 2606 OID 59540) --- Dependencies: 1516 1516 +-- TOC entry 1824 (class 2606 OID 59540) +-- Dependencies: 1510 1510 -- Name: province_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -218,18 +178,8 @@ ALTER TABLE ONLY province -- --- TOC entry 1824 (class 2606 OID 59480) --- Dependencies: 1510 1510 --- Name: provincia_regioni_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: --- - -ALTER TABLE ONLY provincia_regioni - ADD CONSTRAINT provincia_regioni_pkey PRIMARY KEY (id); - - --- --- TOC entry 1822 (class 2606 OID 59466) --- Dependencies: 1509 1509 +-- TOC entry 1814 (class 2606 OID 59466) +-- Dependencies: 1505 1505 -- Name: regioni_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -238,8 +188,8 @@ ALTER TABLE ONLY regioni -- --- TOC entry 1820 (class 2606 OID 59458) --- Dependencies: 1508 1508 +-- TOC entry 1812 (class 2606 OID 59458) +-- Dependencies: 1504 1504 -- Name: stati_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -248,8 +198,8 @@ ALTER TABLE ONLY stati -- --- TOC entry 1830 (class 2606 OID 59502) --- Dependencies: 1513 1513 +-- TOC entry 1818 (class 2606 OID 59502) +-- Dependencies: 1507 1507 -- Name: tipi_aggregazioni_territoriali_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -258,8 +208,8 @@ ALTER TABLE ONLY tipi_aggregazione_territoriale -- --- TOC entry 1834 (class 2606 OID 59531) --- Dependencies: 1515 1515 +-- TOC entry 1822 (class 2606 OID 59531) +-- Dependencies: 1509 1509 -- Name: vie_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: -- @@ -268,7 +218,7 @@ ALTER TABLE ONLY vie -- --- TOC entry 1841 (class 0 OID 0) +-- TOC entry 1829 (class 0 OID 0) -- Dependencies: 3 -- Name: public; Type: ACL; Schema: -; Owner: - -- @@ -279,7 +229,7 @@ GRANT ALL ON SCHEMA public TO postgres; GRANT ALL ON SCHEMA public TO PUBLIC; --- Completed on 2010-08-24 16:56:56 +-- Completed on 2010-08-25 10:29:20 -- -- PostgreSQL database dump complete diff --git a/src/comune.c b/src/comune.c index ea2a248..b82f903 100644 --- a/src/comune.c +++ b/src/comune.c @@ -20,6 +20,7 @@ #include #include "comune.h" +#include "province.h" static void comune_class_init (ComuneClass *klass); static void comune_init (Comune *comune); @@ -38,10 +39,15 @@ static void comune_get_property (GObject *object, GValue *value, GParamSpec *pspec); +static void comune_on_provincia_selezionato (gpointer instance, guint id, gpointer user_data); + static gboolean comune_on_w_comune_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); +static void comune_on_btn_provincia_clicked (GtkButton *button, + gpointer user_data); + static void comune_on_btn_annulla_clicked (GtkButton *button, gpointer user_data); static void comune_on_btn_salva_clicked (GtkButton *button, @@ -143,6 +149,9 @@ Comune g_signal_connect (priv->w, "delete-event", G_CALLBACK (comune_on_w_comune_delete_event), (gpointer *)a); + g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button44"), + "clicked", G_CALLBACK (comune_on_btn_provincia_clicked), (gpointer *)a); + g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button27"), "clicked", G_CALLBACK (comune_on_btn_annulla_clicked), (gpointer *)a); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button28"), @@ -311,6 +320,15 @@ comune_conferma_chiusura (Comune *comune) } /* CALLBACK */ +static void +comune_on_provincia_selezionato (gpointer instance, guint id, gpointer user_data) +{ + Comune *f = (Comune *)user_data; + ComunePrivate *priv = 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 comune_on_w_comune_delete_event (GtkWidget *widget, GdkEvent *event, @@ -319,6 +337,26 @@ comune_on_w_comune_delete_event (GtkWidget *widget, return !comune_conferma_chiusura ((Comune *)user_data); } +static void +comune_on_btn_provincia_clicked (GtkButton *button, + gpointer user_data) +{ + GtkWidget *w; + + Comune *rf = (Comune *)user_data; + + ComunePrivate *priv = COMUNE_GET_PRIVATE (rf); + + Province *c = province_new (priv->commons, TRUE); + + g_signal_connect (G_OBJECT (c), "selezionato", + G_CALLBACK (comune_on_provincia_selezionato), user_data); + + w = province_get_widget (c); + gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); + gtk_widget_show (w); +} + static void comune_on_btn_annulla_clicked (GtkButton *button, gpointer user_data) diff --git a/src/provincia.c b/src/provincia.c index fb7fcc1..9ac5edb 100644 --- a/src/provincia.c +++ b/src/provincia.c @@ -20,6 +20,7 @@ #include #include "provincia.h" +#include "regioni.h" static void provincia_class_init (ProvinciaClass *klass); static void provincia_init (Provincia *provincia); @@ -38,10 +39,15 @@ static void provincia_get_property (GObject *object, GValue *value, GParamSpec *pspec); +static void provincia_on_regione_selezionato (gpointer instance, guint id, gpointer user_data); + static gboolean provincia_on_w_provincia_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); +static void provincia_on_btn_regione_clicked (GtkButton *button, + gpointer user_data); + static void provincia_on_btn_annulla_clicked (GtkButton *button, gpointer user_data); static void provincia_on_btn_salva_clicked (GtkButton *button, @@ -143,6 +149,9 @@ Provincia g_signal_connect (priv->w, "delete-event", G_CALLBACK (provincia_on_w_provincia_delete_event), (gpointer *)a); + g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button43"), + "clicked", G_CALLBACK (provincia_on_btn_regione_clicked), (gpointer *)a); + g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button20"), "clicked", G_CALLBACK (provincia_on_btn_annulla_clicked), (gpointer *)a); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button21"), @@ -311,6 +320,15 @@ provincia_conferma_chiusura (Provincia *provincia) } /* CALLBACK */ +static void +provincia_on_regione_selezionato (gpointer instance, guint id, gpointer user_data) +{ + Provincia *f = (Provincia *)user_data; + ProvinciaPrivate *priv = 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 provincia_on_w_provincia_delete_event (GtkWidget *widget, GdkEvent *event, @@ -319,6 +337,26 @@ provincia_on_w_provincia_delete_event (GtkWidget *widget, return !provincia_conferma_chiusura ((Provincia *)user_data); } +static void +provincia_on_btn_regione_clicked (GtkButton *button, + gpointer user_data) +{ + GtkWidget *w; + + Provincia *rf = (Provincia *)user_data; + + ProvinciaPrivate *priv = PROVINCIA_GET_PRIVATE (rf); + + Regioni *c = regioni_new (priv->commons, TRUE); + + g_signal_connect (G_OBJECT (c), "selezionato", + G_CALLBACK (provincia_on_regione_selezionato), user_data); + + w = regioni_get_widget (c); + gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); + gtk_widget_show (w); +} + static void provincia_on_btn_annulla_clicked (GtkButton *button, gpointer user_data) -- 2.49.0