]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Aggiunti i collegamenti alla struttura (closes #657).
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Mon, 3 Jun 2013 09:09:40 +0000 (11:09 +0200)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Mon, 3 Jun 2013 09:09:40 +0000 (11:09 +0200)
data/organigramma/form/Makefile.am
data/organigramma/form/struttura_collegamento.form [new file with mode: 0644]
data/organigramma/gui/organigramma.gui
docs/DBChangelog
docs/organigramma.sql
libreria/Makefile.am
src/Makefile.am
src/struttura.c
src/strutturacollegamento.c [new file with mode: 0644]
src/strutturacollegamento.h [new file with mode: 0644]

index 38971009b18f119f9e1fc51a10b51d02d12d0ff2..ce247ad28bc27d093dbfd6d6d3552def0446d65b 100644 (file)
@@ -13,6 +13,7 @@ form_DATA = \
             profilo_professionale.form \
             ruolo.form \
             struttura.form \
+            struttura_collegamento.form \
             struttura_indirizzo.form \
             tipo_nodo.form \
             tipo_prestazione.form \
diff --git a/data/organigramma/form/struttura_collegamento.form b/data/organigramma/form/struttura_collegamento.form
new file mode 100644 (file)
index 0000000..a62d45f
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<gtkform>
+
+       <table>struttura_collegamenti</table>
+
+       <widget type="label" name="label188">
+               <field type="integer" name="id">
+                       <is-key>t</is-key>
+                       <auto-increment>t</auto-increment>
+               </field>
+       </widget>
+
+       <widget type="label" name="label189">
+               <field type="integer" name="id_strutture" />
+       </widget>
+
+       <widget type="entry" name="entry52" label="label43">
+               <field type="text" name="descrizione">
+                       <obligatory>t</obligatory>
+               </field>
+       </widget>
+
+       <widget type="entry" name="entry53" label="label186">
+               <field type="text" name="indirizzo">
+                       <obligatory>t</obligatory>
+               </field>
+       </widget>
+
+       <widget type="textview" name="textview20" label="label187">
+               <field type="text" name="note" />
+       </widget>
+
+</gtkform>
index fedda5b369e2374415289ebebecde060601a4976..0616fb87ea7582355f8ebefbc6e8cc499f6782b1 100644 (file)
       <column type="gchararray"/>
     </columns>
   </object>
+  <object class="GtkListStore" id="lstore_struttura_collegamenti">
+    <columns>
+      <!-- column-name id -->
+      <column type="guint"/>
+      <!-- column-name descrizione -->
+      <column type="gchararray"/>
+      <!-- column-name indirizzo -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkListStore" id="lstore_struttura_indirizzi">
     <columns>
       <!-- column-name id -->
               </packing>
             </child>
             <child>
-              <object class="GtkFrame" id="frame3">
+              <object class="GtkNotebook" id="notebook3">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label_xalign">0</property>
+                <property name="can_focus">True</property>
                 <child>
                   <object class="GtkHBox" id="hbox6">
                     <property name="visible">True</property>
                     </child>
                   </object>
                 </child>
-                <child type="label">
-                  <object class="GtkLabel" id="label43">
+                <child type="tab">
+                  <object class="GtkLabel" id="label184">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Indirizzi&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
+                    <property name="label" translatable="yes">Indirizzi</property>
+                  </object>
+                  <packing>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="hbox23">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">5</property>
+                    <property name="spacing">5</property>
+                    <child>
+                      <object class="GtkScrolledWindow" id="scrolledwindow45">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hscrollbar_policy">automatic</property>
+                        <property name="vscrollbar_policy">automatic</property>
+                        <property name="shadow_type">etched-in</property>
+                        <child>
+                          <object class="GtkTreeView" id="treeview26">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="model">lstore_struttura_collegamenti</property>
+                            <property name="headers_clickable">False</property>
+                            <property name="rules_hint">True</property>
+                            <property name="search_column">0</property>
+                            <child>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn45">
+                                <property name="title">Descrizione</property>
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderertext56"/>
+                                  <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">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkVButtonBox" id="vbuttonbox14">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">5</property>
+                        <property name="layout_style">start</property>
+                        <child>
+                          <object class="GtkButton" id="button181">
+                            <property name="label">gtk-new</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="button182">
+                            <property name="label">gtk-edit</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="button183">
+                            <property name="label">gtk-delete</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="button184">
+                            <property name="label">gtk-open</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>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child type="tab">
+                  <object class="GtkLabel" id="label185">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Collegamenti</property>
                   </object>
+                  <packing>
+                    <property name="position">1</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
                 </child>
               </object>
               <packing>
       </object>
     </child>
   </object>
+  <object class="GtkWindow" id="w_struttura_collegamento">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Collegamento - Organigramma</property>
+    <property name="modal">True</property>
+    <property name="default_width">500</property>
+    <property name="default_height">300</property>
+    <property name="destroy_with_parent">True</property>
+    <child>
+      <object class="GtkVBox" id="vbox28">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="border_width">5</property>
+        <property name="spacing">5</property>
+        <child>
+          <object class="GtkTable" id="table27">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">5</property>
+            <property name="row_spacing">5</property>
+            <child>
+              <object class="GtkLabel" id="label43">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Descrizione</property>
+              </object>
+              <packing>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry52">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="max_length">255</property>
+                <property name="invisible_char">●</property>
+                <property name="invisible_char_set">True</property>
+                <property name="primary_icon_activatable">False</property>
+                <property name="secondary_icon_activatable">False</property>
+                <property name="primary_icon_sensitive">True</property>
+                <property name="secondary_icon_sensitive">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label186">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Indirizzo</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry53">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">●</property>
+                <property name="invisible_char_set">True</property>
+                <property name="primary_icon_activatable">False</property>
+                <property name="secondary_icon_activatable">False</property>
+                <property name="primary_icon_sensitive">True</property>
+                <property name="secondary_icon_sensitive">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label187">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="yalign">0</property>
+                <property name="label" translatable="yes">Note</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow46">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">automatic</property>
+                <property name="vscrollbar_policy">automatic</property>
+                <property name="shadow_type">etched-in</property>
+                <child>
+                  <object class="GtkTextView" id="textview20">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label188">
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">lbl_id</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label189">
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">lbl_id_strutture</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHButtonBox" id="hbuttonbox37">
+            <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="button185">
+                <property name="label">gtk-cancel</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="button186">
+                <property name="label">gtk-save</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="button187">
+                <property name="label" translatable="yes">Salva e _chiudi</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">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
   <object class="GtkWindow" id="w_struttura_indirizzo">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Indirizzo della struttura - Gestione organigramma</property>
index 483b7590243f1d155415a925f24b4eb988ee109e..5f62a67eb486f761f5b49207b2f1cd9cbe380fda 100644 (file)
@@ -26,3 +26,14 @@ CREATE TABLE ufficio_collegamenti
        status character varying(1) DEFAULT ''::character varying,
        CONSTRAINT ufficio_collegamenti_pkey PRIMARY KEY (id)
 );
+
+CREATE TABLE struttura_collegamenti
+(
+       id integer NOT NULL,
+       id_strutture integer,
+       descrizione character varying(255) DEFAULT ''::character varying,
+       indirizzo character varying DEFAULT ''::bpchar,
+       note text DEFAULT ''::text,
+       status character varying(1) DEFAULT ''::character varying,
+       CONSTRAINT struttura_collegamenti_pkey PRIMARY KEY (id)
+);
index 26493b388789604d71c00e187cfd2a5f04b752e8..758b40d12442849cc6e6734e15a842e1691f3eb7 100644 (file)
@@ -4,7 +4,7 @@
 
 -- Dumped from database version 8.4.17
 -- Dumped by pg_dump version 9.2.2
--- Started on 2013-06-03 10:06:39
+-- Started on 2013-06-03 10:51:06
 
 SET statement_timeout = 0;
 SET client_encoding = 'UTF8';
@@ -14,7 +14,7 @@ SET client_min_messages = warning;
 SET escape_string_warning = off;
 
 --
--- TOC entry 548 (class 2612 OID 16386)
+-- TOC entry 553 (class 2612 OID 16386)
 -- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: -
 --
 
@@ -202,6 +202,21 @@ CREATE TABLE ruoli (
 );
 
 
+--
+-- TOC entry 164 (class 1259 OID 626367)
+-- Name: struttura_collegamenti; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE struttura_collegamenti (
+    id integer NOT NULL,
+    id_strutture integer,
+    descrizione character varying(255) DEFAULT ''::character varying,
+    indirizzo character varying DEFAULT ''::bpchar,
+    note text DEFAULT ''::text,
+    status character varying(1) DEFAULT ''::character varying
+);
+
+
 --
 -- TOC entry 145 (class 1259 OID 59346)
 -- Name: struttura_indirizzi; Type: TABLE; Schema: public; Owner: -
@@ -399,7 +414,7 @@ CREATE TABLE ufficio_stanze (
 
 
 --
--- TOC entry 1979 (class 2606 OID 59289)
+-- TOC entry 1988 (class 2606 OID 59289)
 -- Name: nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -408,7 +423,7 @@ ALTER TABLE ONLY nodi
 
 
 --
--- TOC entry 2019 (class 2606 OID 61360)
+-- TOC entry 2028 (class 2606 OID 61360)
 -- Name: persona_incarichi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -417,7 +432,7 @@ ALTER TABLE ONLY persona_incarichi
 
 
 --
--- TOC entry 2009 (class 2606 OID 61305)
+-- TOC entry 2018 (class 2606 OID 61305)
 -- Name: persona_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -426,7 +441,7 @@ ALTER TABLE ONLY persona_nodi
 
 
 --
--- TOC entry 2011 (class 2606 OID 61321)
+-- TOC entry 2020 (class 2606 OID 61321)
 -- Name: persona_nodo_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -435,7 +450,7 @@ ALTER TABLE ONLY persona_nodo_recapiti
 
 
 --
--- TOC entry 2005 (class 2606 OID 61279)
+-- TOC entry 2014 (class 2606 OID 61279)
 -- Name: persona_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -444,7 +459,7 @@ ALTER TABLE ONLY persona_recapiti
 
 
 --
--- TOC entry 2003 (class 2606 OID 61252)
+-- TOC entry 2012 (class 2606 OID 61252)
 -- Name: persona_uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -453,7 +468,7 @@ ALTER TABLE ONLY persona_uffici
 
 
 --
--- TOC entry 2007 (class 2606 OID 61294)
+-- TOC entry 2016 (class 2606 OID 61294)
 -- Name: persona_ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -462,7 +477,7 @@ ALTER TABLE ONLY persona_ufficio_recapiti
 
 
 --
--- TOC entry 1999 (class 2606 OID 61235)
+-- TOC entry 2008 (class 2606 OID 61235)
 -- Name: persone_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -471,7 +486,7 @@ ALTER TABLE ONLY persone
 
 
 --
--- TOC entry 2013 (class 2606 OID 61328)
+-- TOC entry 2022 (class 2606 OID 61328)
 -- Name: posizioni_economiche_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -480,7 +495,7 @@ ALTER TABLE ONLY posizioni_economiche
 
 
 --
--- TOC entry 2017 (class 2606 OID 61342)
+-- TOC entry 2026 (class 2606 OID 61342)
 -- Name: profili_professionali_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -489,7 +504,7 @@ ALTER TABLE ONLY profili_professionali
 
 
 --
--- TOC entry 2023 (class 2606 OID 618188)
+-- TOC entry 2032 (class 2606 OID 618188)
 -- Name: ruoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -498,7 +513,16 @@ ALTER TABLE ONLY ruoli
 
 
 --
--- TOC entry 1989 (class 2606 OID 59356)
+-- TOC entry 2036 (class 2606 OID 626378)
+-- Name: struttura_collegamenti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY struttura_collegamenti
+    ADD CONSTRAINT struttura_collegamenti_pkey PRIMARY KEY (id);
+
+
+--
+-- TOC entry 1998 (class 2606 OID 59356)
 -- Name: struttura_indirizzi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -507,7 +531,7 @@ ALTER TABLE ONLY struttura_indirizzi
 
 
 --
--- TOC entry 1987 (class 2606 OID 59339)
+-- TOC entry 1996 (class 2606 OID 59339)
 -- Name: strutture_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -516,7 +540,7 @@ ALTER TABLE ONLY strutture
 
 
 --
--- TOC entry 1981 (class 2606 OID 59296)
+-- TOC entry 1990 (class 2606 OID 59296)
 -- Name: tipi_nodo_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -525,7 +549,7 @@ ALTER TABLE ONLY tipi_nodo
 
 
 --
--- TOC entry 2015 (class 2606 OID 61335)
+-- TOC entry 2024 (class 2606 OID 61335)
 -- Name: tipi_prestazione_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -534,7 +558,7 @@ ALTER TABLE ONLY tipi_prestazione
 
 
 --
--- TOC entry 2001 (class 2606 OID 61242)
+-- TOC entry 2010 (class 2606 OID 61242)
 -- Name: tipi_rapporto_lavoro_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -543,7 +567,7 @@ ALTER TABLE ONLY tipi_rapporto_lavoro
 
 
 --
--- TOC entry 1983 (class 2606 OID 59303)
+-- TOC entry 1992 (class 2606 OID 59303)
 -- Name: tipi_recapito_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -552,7 +576,7 @@ ALTER TABLE ONLY tipi_recapito
 
 
 --
--- TOC entry 1997 (class 2606 OID 61226)
+-- TOC entry 2006 (class 2606 OID 61226)
 -- Name: titoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -561,7 +585,7 @@ ALTER TABLE ONLY titoli
 
 
 --
--- TOC entry 1985 (class 2606 OID 59321)
+-- TOC entry 1994 (class 2606 OID 59321)
 -- Name: uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -570,7 +594,7 @@ ALTER TABLE ONLY uffici
 
 
 --
--- TOC entry 2025 (class 2606 OID 626366)
+-- TOC entry 2034 (class 2606 OID 626366)
 -- Name: ufficio_collegamenti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -579,7 +603,7 @@ ALTER TABLE ONLY ufficio_collegamenti
 
 
 --
--- TOC entry 1991 (class 2606 OID 59366)
+-- TOC entry 2000 (class 2606 OID 59366)
 -- Name: ufficio_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -588,7 +612,7 @@ ALTER TABLE ONLY ufficio_nodi
 
 
 --
--- TOC entry 1993 (class 2606 OID 59408)
+-- TOC entry 2002 (class 2606 OID 59408)
 -- Name: ufficio_orari_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -597,7 +621,7 @@ ALTER TABLE ONLY ufficio_orari
 
 
 --
--- TOC entry 1995 (class 2606 OID 59419)
+-- TOC entry 2004 (class 2606 OID 59419)
 -- Name: ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -606,7 +630,7 @@ ALTER TABLE ONLY ufficio_recapiti
 
 
 --
--- TOC entry 2021 (class 2606 OID 61430)
+-- TOC entry 2030 (class 2606 OID 61430)
 -- Name: ufficio_stanze_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -614,7 +638,7 @@ ALTER TABLE ONLY ufficio_stanze
     ADD CONSTRAINT ufficio_stanze_pkey PRIMARY KEY (id);
 
 
--- Completed on 2013-06-03 10:06:40
+-- Completed on 2013-06-03 10:51:06
 
 --
 -- PostgreSQL database dump complete
index 0e6007c1e744f1337744cdb5dbaf96e16fb76150..211827b77a751e2204dc716465581b95beab781c 100644 (file)
@@ -32,6 +32,7 @@ liborganigramma_la_SOURCES = \
                 ../src/ruolo.c \
                 ../src/ruolo.h \
                 ../src/struttura.c \
+                ../src/strutturacollegamento.c \
                 ../src/strutturaindirizzo.c \
                 ../src/strutture.c \
                 ../src/tipinodo.c \
@@ -72,6 +73,7 @@ liborganigramma_include_HEADERS = \
                 ../src/profiliprofessionali.h \
                 ../src/profiloprofessionale.h \
                 ../src/struttura.h \
+                ../src/strutturacollegamento.h \
                 ../src/strutturaindirizzo.h \
                 ../src/strutture.h \
                 ../src/tipinodo.h \
index 00ab5644313544aa83d49df73b25f94514280e76..e83fb98e4a3627e521c91223d167fefdab7529ae 100644 (file)
@@ -61,6 +61,8 @@ organigramma_SOURCES = \
                 ruolo.h \
                 struttura.c \
                 struttura.h \
+                strutturacollegamento.c \
+                strutturacollegamento.h \
                 strutturaindirizzo.c \
                 strutturaindirizzo.h \
                 strutture.c \
index 5a44831b77a293343fd551fa19d5e2ae3e316439..fafb4a203aa3fa2359bf3026aa36489b216ecde8 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "struttura.h"
 #include "strutturaindirizzo.h"
+#include "strutturacollegamento.h"
 
 static void organigramma_struttura_class_init (OrganigrammaStrutturaClass *klass);
 static void organigramma_struttura_init (OrganigrammaStruttura *struttura);
@@ -36,8 +37,10 @@ static void organigramma_struttura_carica (OrganigrammaStruttura *struttura);
 static void organigramma_struttura_salva (OrganigrammaStruttura *struttura, gboolean chiudi);
 
 static void organigramma_struttura_carica_indirizzi (OrganigrammaStruttura *struttura);
+static void organigramma_struttura_carica_collegamenti (OrganigrammaStruttura *struttura);
 
 static void organigramma_struttura_indirizzo_modifica (OrganigrammaStruttura *struttura);
+static void organigramma_struttura_collegamento_modifica (OrganigrammaStruttura *struttura);
 
 static gboolean organigramma_struttura_conferma_chiusura (OrganigrammaStruttura *struttura);
 
@@ -51,6 +54,7 @@ static void organigramma_struttura_get_property (GObject *object,
                                      GParamSpec *pspec);
 
 static void organigramma_struttura_on_indirizzo_aggiornato (gpointer instance, gpointer user_data);
+static void organigramma_struttura_on_collegamento_aggiornato (gpointer instance, gpointer user_data);
 
 static gboolean organigramma_struttura_on_w_organigramma_struttura_delete_event (GtkWidget *widget,
                                GdkEvent *event,
@@ -67,6 +71,19 @@ static void organigramma_struttura_on_trv_indirizzi_row_activated (GtkTreeView *
                                              GtkTreeViewColumn *column,
                                              gpointer user_data);
 
+static void organigramma_struttura_on_btn_collegamento_nuovo_clicked (GtkButton *button,
+                                    gpointer user_data);
+static void organigramma_struttura_on_btn_collegamento_modifica_clicked (GtkButton *button,
+                                    gpointer user_data);
+static void organigramma_struttura_on_btn_collegamento_elimina_clicked (GtkButton *button,
+                                    gpointer user_data);
+static void organigramma_struttura_on_btn_collegamento_apri_clicked (GtkButton *button,
+                                    gpointer user_data);
+static void organigramma_struttura_on_trv_collegamenti_row_activated (GtkTreeView *tree_view,
+                                             GtkTreePath *tree_path,
+                                             GtkTreeViewColumn *column,
+                                             gpointer user_data);
+
 static void organigramma_struttura_on_btn_annulla_clicked (GtkButton *button,
                                     gpointer user_data);
 static void organigramma_struttura_on_btn_salva_clicked (GtkButton *button,
@@ -79,7 +96,8 @@ static void organigramma_struttura_on_btn_salvaechiudi_clicked (GtkButton *butto
 enum
 {
        LBL_ID,
-       LSTORE_INDIRIZZI
+       LSTORE_INDIRIZZI,
+       LSTORE_COLLEGAMENTI
 };
 
 enum
@@ -88,6 +106,13 @@ enum
        INDIRIZZI_COL_INDIRIZZO
 };
 
+enum
+{
+       COLLEGAMENTI_COL_ID,
+       COLLEGAMENTI_COL_DESCRIZIONE,
+       COLLEGAMENTI_COL_INDIRIZZO
+};
+
 typedef struct _OrganigrammaStrutturaPrivate OrganigrammaStrutturaPrivate;
 struct _OrganigrammaStrutturaPrivate
        {
@@ -100,6 +125,7 @@ struct _OrganigrammaStrutturaPrivate
                GObject **objects;
 
                GtkTreeSelection *sel_indirizzi;
+               GtkTreeSelection *sel_collegamenti;
 
                gint id;
        };
@@ -160,6 +186,7 @@ OrganigrammaStruttura
        error = NULL;
        gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
                                           g_strsplit ("lstore_struttura_indirizzi"
+                                                      "|lstore_struttura_collegamenti"
                                                       "|w_struttura",
                                                       "|", -1),
                                           &error);
@@ -178,12 +205,14 @@ OrganigrammaStruttura
        priv->objects = gtk_form_get_objects_by_name (priv->form,
                                                      "label31",
                                                      "lstore_struttura_indirizzi",
+                                                     "lstore_struttura_collegamenti",
                                                      NULL);
 
        g_signal_connect (priv->w,
                          "delete-event", G_CALLBACK (organigramma_struttura_on_w_organigramma_struttura_delete_event), (gpointer)a);
 
        priv->sel_indirizzi = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview9")));
+       priv->sel_collegamenti = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview26")));
 
        g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button47")),
                          "clicked", G_CALLBACK (organigramma_struttura_on_btn_indirizzo_nuovo_clicked), (gpointer)a);
@@ -194,6 +223,17 @@ OrganigrammaStruttura
        g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview9")),
                          "row-activated", G_CALLBACK (organigramma_struttura_on_trv_indirizzi_row_activated), (gpointer)a);
 
+       g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button181")),
+                         "clicked", G_CALLBACK (organigramma_struttura_on_btn_collegamento_nuovo_clicked), (gpointer)a);
+       g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button182")),
+                         "clicked", G_CALLBACK (organigramma_struttura_on_btn_collegamento_modifica_clicked), (gpointer)a);
+       g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button183")),
+                         "clicked", G_CALLBACK (organigramma_struttura_on_btn_collegamento_elimina_clicked), (gpointer)a);
+       g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button184")),
+                         "clicked", G_CALLBACK (organigramma_struttura_on_btn_collegamento_apri_clicked), (gpointer)a);
+       g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview26")),
+                         "row-activated", G_CALLBACK (organigramma_struttura_on_trv_collegamenti_row_activated), (gpointer)a);
+
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button39"),
                          "clicked", G_CALLBACK (organigramma_struttura_on_btn_annulla_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button40"),
@@ -211,7 +251,7 @@ OrganigrammaStruttura
 
                        gtk_form_set_as_origin (priv->form);
 
-                       gtk_form_set_sensitive_by_name (priv->form, FALSE, "frame3", NULL);
+                       gtk_form_set_sensitive_by_name (priv->form, FALSE, "hbox6", "hbox23", NULL);
                }
        else
                {
@@ -226,6 +266,8 @@ OrganigrammaStruttura
                        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button51")), FALSE);
                        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button40")), FALSE);
                        gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button149")), FALSE);
+                       gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button181")), FALSE);
+                       gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button183")), FALSE);
                }
 
        return a;
@@ -253,6 +295,7 @@ organigramma_struttura_carica (OrganigrammaStruttura *struttura)
        if (gtk_form_fill_from_table (priv->form))
                {
                        organigramma_struttura_carica_indirizzi (struttura);
+                       organigramma_struttura_carica_collegamenti (struttura);
                }
 }
 
@@ -361,6 +404,48 @@ organigramma_struttura_carica_indirizzi (OrganigrammaStruttura *struttura)
        g_free (sql);
 }
 
+static void
+organigramma_struttura_carica_collegamenti (OrganigrammaStruttura *struttura)
+{
+       GtkListStore *lstore;
+       GtkTreeIter iter;
+       GdaDataModel *dm;
+
+       gchar *sql;
+
+       gint rows;
+       gint row;
+
+       OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (struttura);
+
+       lstore = GTK_LIST_STORE (priv->objects[LSTORE_COLLEGAMENTI]);
+       gtk_list_store_clear (lstore);
+
+       sql = g_strdup_printf ("SELECT aa.id, aa.descrizione, aa.indirizzo"
+                         " FROM struttura_collegamenti AS aa"
+                         " WHERE aa.status <> 'E'"
+                         " AND aa.id_strutture = %d"
+                         " ORDER BY aa.descrizione",
+                         priv->id);
+       dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
+       if (dm != NULL)
+               {
+                       rows = gda_data_model_get_n_rows (dm);
+                       for (row = 0; row < rows; row++)
+                               {
+                                       gtk_list_store_append (lstore, &iter);
+                                       gtk_list_store_set (lstore, &iter,
+                                                           COLLEGAMENTI_COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
+                                                           COLLEGAMENTI_COL_DESCRIZIONE, gdaex_data_model_get_field_value_stringify_at (dm, row, "descrizione"),
+                                                           COLLEGAMENTI_COL_INDIRIZZO, gdaex_data_model_get_field_value_stringify_at (dm, row, "indirizzo"),
+                                                           -1);
+                               }
+
+                       g_object_unref (dm);
+               }
+}
+
 static void
 organigramma_struttura_indirizzo_modifica (OrganigrammaStruttura *struttura)
 {
@@ -395,6 +480,40 @@ organigramma_struttura_indirizzo_modifica (OrganigrammaStruttura *struttura)
                }
 }
 
+static void
+organigramma_struttura_collegamento_modifica (OrganigrammaStruttura *organigramma_struttura)
+{
+       GtkTreeIter iter;
+       guint id;
+
+       OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (organigramma_struttura);
+
+       if (gtk_tree_selection_get_selected (priv->sel_collegamenti, NULL, &iter))
+               {
+                       GtkWidget *w;
+
+                       gtk_tree_model_get (GTK_TREE_MODEL (priv->objects[LSTORE_COLLEGAMENTI]), &iter,
+                                           COLLEGAMENTI_COL_ID, &id,
+                                           -1);
+
+                       OrganigrammaStrutturaCollegamento *c = organigramma_struttura_collegamento_new (priv->commons, id, 0);
+
+                       g_signal_connect (G_OBJECT (c), "aggiornato",
+                                         G_CALLBACK (organigramma_struttura_on_collegamento_aggiornato), (gpointer)organigramma_struttura);
+
+                       w = organigramma_struttura_collegamento_get_widget (c);
+                       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+                       gtk_widget_show (w);
+               }
+       else
+               {
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un collegamento.");
+               }
+}
+
 static void
 organigramma_struttura_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
@@ -455,6 +574,12 @@ organigramma_struttura_on_indirizzo_aggiornato (gpointer instance, gpointer user
        organigramma_struttura_carica_indirizzi (struttura);
 }
 
+static void
+organigramma_struttura_on_collegamento_aggiornato (gpointer instance, gpointer user_data)
+{
+       organigramma_struttura_carica_collegamenti ((OrganigrammaStruttura *)user_data);
+}
+
 static gboolean
 organigramma_struttura_on_w_organigramma_struttura_delete_event (GtkWidget *widget,
                                GdkEvent *event,
@@ -541,6 +666,111 @@ organigramma_struttura_on_trv_indirizzi_row_activated (GtkTreeView *tree_view,
        organigramma_struttura_indirizzo_modifica ((OrganigrammaStruttura *)user_data);
 }
 
+static void
+organigramma_struttura_on_btn_collegamento_nuovo_clicked (GtkButton *button,
+                                    gpointer user_data)
+{
+       GtkWidget *w;
+
+       OrganigrammaStruttura *struttura = (OrganigrammaStruttura *)user_data;
+
+       OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (struttura);
+
+       OrganigrammaStrutturaCollegamento *a = organigramma_struttura_collegamento_new (priv->commons, 0, priv->id);
+
+       g_signal_connect (G_OBJECT (a), "aggiornato",
+                         G_CALLBACK (organigramma_struttura_on_collegamento_aggiornato), (gpointer)struttura);
+
+       w = organigramma_struttura_collegamento_get_widget (a);
+       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+       gtk_widget_show (w);
+}
+
+static void
+organigramma_struttura_on_btn_collegamento_modifica_clicked (GtkButton *button,
+                                    gpointer user_data)
+{
+       organigramma_struttura_collegamento_modifica ((OrganigrammaStruttura *)user_data);
+}
+
+static void
+organigramma_struttura_on_btn_collegamento_elimina_clicked (GtkButton *button,
+                                    gpointer user_data)
+{
+       GtkTreeIter iter;
+
+       OrganigrammaStruttura *struttura = (OrganigrammaStruttura *)user_data;
+
+       OrganigrammaStrutturaClass *klass = ORGANIGRAMMA_STRUTTURA_GET_CLASS (struttura);
+       OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (struttura);
+
+       if (gtk_tree_selection_get_selected (priv->sel_collegamenti, NULL, &iter))
+               {
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il collegamento selezionato?") == GTK_RESPONSE_YES)
+                               {
+                                       guint id;
+
+                                       gtk_tree_model_get (GTK_TREE_MODEL (priv->objects[LSTORE_COLLEGAMENTI]), &iter,
+                                                           COLLEGAMENTI_COL_ID, &id,
+                                                           -1);
+
+                                       gdaex_execute (priv->commons->gdaex,
+                                                      g_strdup_printf ("UPDATE struttura_collegamenti"
+                                                                       " SET status = 'E'"
+                                                                       " WHERE id = %d",
+                                                                       id));
+
+                                       organigramma_struttura_carica_collegamenti (struttura);
+                               }
+               }
+       else
+               {
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un collegamento.");
+               }
+}
+
+static void
+organigramma_struttura_on_btn_collegamento_apri_clicked (GtkButton *button,
+                                        gpointer user_data)
+{
+       GtkTreeIter iter;
+       gchar *indirizzo;
+
+       OrganigrammaStruttura *organigramma_struttura = (OrganigrammaStruttura *)user_data;
+       OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (organigramma_struttura);
+
+       if (gtk_tree_selection_get_selected (priv->sel_collegamenti, NULL, &iter))
+               {
+                       gtk_tree_model_get (GTK_TREE_MODEL (priv->objects[LSTORE_COLLEGAMENTI]), &iter,
+                                           COLLEGAMENTI_COL_INDIRIZZO, &indirizzo,
+                                           -1);
+
+                       solipa_apri_collegamento (GTK_WINDOW (priv->w), indirizzo);
+               }
+       else
+               {
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un collegamento.");
+               }
+}
+
+static void
+organigramma_struttura_on_trv_collegamenti_row_activated (GtkTreeView *tree_view,
+                                             GtkTreePath *tree_path,
+                                             GtkTreeViewColumn *column,
+                                             gpointer user_data)
+{
+       organigramma_struttura_collegamento_modifica ((OrganigrammaStruttura *)user_data);
+}
+
 static void
 organigramma_struttura_on_btn_annulla_clicked (GtkButton *button,
                         gpointer user_data)
diff --git a/src/strutturacollegamento.c b/src/strutturacollegamento.c
new file mode 100644 (file)
index 0000000..b3e49eb
--- /dev/null
@@ -0,0 +1,360 @@
+/* 
+ * Copyright (C) 2013 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <libsolipa/libsolipa.h>
+#include <libautoz/autoz.h>
+#include <libgtkform/form.h>
+
+#include "strutturacollegamento.h"
+
+static void organigramma_struttura_collegamento_class_init (OrganigrammaStrutturaCollegamentoClass *klass);
+static void organigramma_struttura_collegamento_init (OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento);
+
+static void organigramma_struttura_collegamento_carica (OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento);
+static void organigramma_struttura_collegamento_salva (OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento, gboolean chiudi);
+
+static gboolean organigramma_struttura_collegamento_conferma_chiusura (OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento);
+
+static void organigramma_struttura_collegamento_set_property (GObject *object,
+                                     guint property_id,
+                                     const GValue *value,
+                                     GParamSpec *pspec);
+static void organigramma_struttura_collegamento_get_property (GObject *object,
+                                     guint property_id,
+                                     GValue *value,
+                                     GParamSpec *pspec);
+
+static gboolean organigramma_struttura_collegamento_on_w_organigramma_struttura_collegamento_delete_event (GtkWidget *widget,
+                               GdkEvent *event,
+                               gpointer user_data);
+
+static void organigramma_struttura_collegamento_on_btn_annulla_clicked (GtkButton *button,
+                                    gpointer user_data);
+static void organigramma_struttura_collegamento_on_btn_salva_clicked (GtkButton *button,
+                                  gpointer user_data);
+static void organigramma_struttura_collegamento_on_btn_salvachiudi_clicked (GtkButton *button,
+                                  gpointer user_data);
+
+#define ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO, OrganigrammaStrutturaCollegamentoPrivate))
+
+enum
+{
+       LBL_ID,
+       LBL_ID_STRUTTURE
+};
+
+typedef struct _OrganigrammaStrutturaCollegamentoPrivate OrganigrammaStrutturaCollegamentoPrivate;
+struct _OrganigrammaStrutturaCollegamentoPrivate
+       {
+               OrganigrammaCommons *commons;
+
+               GtkForm *form;
+
+               GtkWidget *w;
+
+               GObject **objects;
+
+               gint id;
+       };
+
+G_DEFINE_TYPE (OrganigrammaStrutturaCollegamento, organigramma_struttura_collegamento, G_TYPE_OBJECT)
+
+static void
+organigramma_struttura_collegamento_class_init (OrganigrammaStrutturaCollegamentoClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+       g_type_class_add_private (object_class, sizeof (OrganigrammaStrutturaCollegamentoPrivate));
+
+       object_class->set_property = organigramma_struttura_collegamento_set_property;
+       object_class->get_property = organigramma_struttura_collegamento_get_property;
+
+       /**
+        * OrganigrammaStrutturaCollegamento::aggiornato:
+        * @organigramma_struttura_collegamento:
+        *
+        */
+       klass->aggiornato_signal_id = g_signal_new ("aggiornato",
+                                                      G_TYPE_FROM_CLASS (object_class),
+                                                      G_SIGNAL_RUN_LAST,
+                                                      0,
+                                                      NULL,
+                                                      NULL,
+                                                      g_cclosure_marshal_VOID__VOID,
+                                                      G_TYPE_NONE,
+                                                      0);
+}
+
+static void
+organigramma_struttura_collegamento_init (OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento)
+{
+       OrganigrammaStrutturaCollegamentoPrivate *priv = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_PRIVATE (organigramma_struttura_collegamento);
+}
+
+/**
+ * organigramma_struttura_collegamento_new:
+ * @commons:
+ * @id:
+ * @id_uffici:
+ *
+ * Returns: the newly created #OrganigrammaStrutturaCollegamento object.
+ */
+OrganigrammaStrutturaCollegamento
+*organigramma_struttura_collegamento_new (OrganigrammaCommons *commons, guint id, guint id_uffici)
+{
+       GError *error;
+       AutozIResource *ires1;
+
+       OrganigrammaStrutturaCollegamento *a = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO (g_object_new (organigramma_struttura_collegamento_get_type (), NULL));
+
+       OrganigrammaStrutturaCollegamentoPrivate *priv = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_PRIVATE (a);
+
+       priv->commons = commons;
+
+       error = NULL;
+       gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
+                                          g_strsplit ("w_struttura_collegamento", "|", -1),
+                                          &error);
+       if (error != NULL)
+               {
+                       g_warning ("Errore: %s.", error->message);
+                       return NULL;
+               }
+
+       priv->form = gtk_form_new ();
+       g_object_set (priv->form, "gdaex", priv->commons->gdaex, NULL);
+       gtk_form_load_from_file (priv->form, g_build_filename (priv->commons->formdir, "struttura_collegamento.form", NULL), priv->commons->gtkbuilder);
+
+       g_object_set (priv->form, "gdaex", priv->commons->gdaex, NULL);
+
+       priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_struttura_collegamento"));
+
+       priv->objects = gtk_form_get_objects_by_name (priv->form,
+                                                     "label188",
+                                                     "label189",
+                                                     NULL);
+
+       g_signal_connect (priv->w,
+                         "delete-event", G_CALLBACK (organigramma_struttura_collegamento_on_w_organigramma_struttura_collegamento_delete_event), (gpointer)a);
+
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button185"),
+                         "clicked", G_CALLBACK (organigramma_struttura_collegamento_on_btn_annulla_clicked), (gpointer)a);
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button186"),
+                         "clicked", G_CALLBACK (organigramma_struttura_collegamento_on_btn_salva_clicked), (gpointer)a);
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button187"),
+                         "clicked", G_CALLBACK (organigramma_struttura_collegamento_on_btn_salvachiudi_clicked), (gpointer)a);
+
+       gtk_form_clear (priv->form);
+
+       priv->id = id;
+       if (priv->id == 0)
+               {
+                       gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+                       gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID_STRUTTURE]), g_strdup_printf ("%d", id_uffici));
+
+                       gtk_form_set_as_origin (priv->form);
+               }
+       else
+               {
+                       gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), g_strdup_printf ("%d", priv->id));
+                       organigramma_struttura_collegamento_carica (a);
+               }
+
+       ires1 = autoz_get_resource_from_id (priv->commons->autoz, "organigramma_rw");
+       if (!autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+               {
+                       gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button186")), FALSE);
+                       gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button187")), FALSE);
+               }
+
+       return a;
+}
+
+/**
+ * organigramma_struttura_collegamento_get_widget:
+ * @organigramma_struttura_collegamento:
+ *
+ */
+GtkWidget
+*organigramma_struttura_collegamento_get_widget (OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento)
+{
+       OrganigrammaStrutturaCollegamentoPrivate *priv = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_PRIVATE (organigramma_struttura_collegamento);
+
+       return priv->w;
+}
+
+/* PRIVATE */
+static void
+organigramma_struttura_collegamento_carica (OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento)
+{
+       OrganigrammaStrutturaCollegamentoPrivate *priv = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_PRIVATE (organigramma_struttura_collegamento);
+
+       if (gtk_form_fill_from_table (priv->form))
+               {
+               }
+}
+
+static void
+organigramma_struttura_collegamento_salva (OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento, gboolean chiudi)
+{
+       gchar *sql;
+       GtkWidget *dialog;
+
+       OrganigrammaStrutturaCollegamentoClass *klass = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_CLASS (organigramma_struttura_collegamento);
+
+       OrganigrammaStrutturaCollegamentoPrivate *priv = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_PRIVATE (organigramma_struttura_collegamento);
+
+       if (!gtk_form_check (priv->form, (priv->id != 0), NULL, TRUE, priv->w, TRUE))
+               {
+                       return;
+               }
+
+       if (priv->id == 0)
+               {
+                       sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_INSERT);
+               }
+       else
+               {
+                       sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_UPDATE);
+               }
+
+       if (gdaex_execute (priv->commons->gdaex, sql) == 1)
+               {
+                       g_free (sql);
+
+                       g_signal_emit (organigramma_struttura_collegamento, klass->aggiornato_signal_id, 0);
+
+                       gtk_form_set_as_origin (priv->form);
+
+                       if (priv->id == 0)
+                               {
+                                       priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
+                               }
+
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
+
+                       if (chiudi)
+                               {
+                                       gtk_widget_destroy (priv->w);
+                                       g_object_unref (organigramma_struttura_collegamento);
+                               }
+               }
+       else
+               {
+                       g_free (sql);
+
+                       if (priv->id == 0)
+                               {
+                                       gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+                               }
+
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
+               }
+}
+
+static void
+organigramma_struttura_collegamento_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+       OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO (object);
+       OrganigrammaStrutturaCollegamentoPrivate *priv = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_PRIVATE (organigramma_struttura_collegamento);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+               }
+}
+
+static void
+organigramma_struttura_collegamento_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+       OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO (object);
+       OrganigrammaStrutturaCollegamentoPrivate *priv = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_PRIVATE (organigramma_struttura_collegamento);
+
+       switch (property_id)
+               {
+                       default:
+                               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+                               break;
+               }
+}
+
+static gboolean
+organigramma_struttura_collegamento_conferma_chiusura (OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento)
+{
+       gboolean ret;
+
+       OrganigrammaStrutturaCollegamentoPrivate *priv = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_PRIVATE (organigramma_struttura_collegamento);
+
+       ret = TRUE;
+       if (gtk_form_is_changed (priv->form))
+               {
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
+                               {
+                                       ret = FALSE;
+                               }
+               }
+
+       return ret;
+}
+
+/* CALLBACK */
+static gboolean
+organigramma_struttura_collegamento_on_w_organigramma_struttura_collegamento_delete_event (GtkWidget *widget,
+                               GdkEvent *event,
+                               gpointer user_data)
+{
+       return !organigramma_struttura_collegamento_conferma_chiusura ((OrganigrammaStrutturaCollegamento *)user_data);
+}
+
+
+static void
+organigramma_struttura_collegamento_on_btn_annulla_clicked (GtkButton *button,
+                                 gpointer user_data)
+{
+       OrganigrammaStrutturaCollegamento *collegamento = (OrganigrammaStrutturaCollegamento *)user_data;
+
+       OrganigrammaStrutturaCollegamentoPrivate *priv = ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_PRIVATE (collegamento);
+
+       if (organigramma_struttura_collegamento_conferma_chiusura (collegamento)) gtk_widget_destroy (priv->w);
+}
+
+static void
+organigramma_struttura_collegamento_on_btn_salva_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       organigramma_struttura_collegamento_salva ((OrganigrammaStrutturaCollegamento *)user_data, FALSE);
+}
+
+static void
+organigramma_struttura_collegamento_on_btn_salvachiudi_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       organigramma_struttura_collegamento_salva ((OrganigrammaStrutturaCollegamento *)user_data, TRUE);
+}
diff --git a/src/strutturacollegamento.h b/src/strutturacollegamento.h
new file mode 100644 (file)
index 0000000..7034910
--- /dev/null
@@ -0,0 +1,65 @@
+/* 
+ * Copyright (C) 2013 Andrea Zagli <azagli@libero.it>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef __ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_H__
+#define __ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+#include "commons.h"
+
+G_BEGIN_DECLS
+
+
+#define TYPE_ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO                 (organigramma_struttura_collegamento_get_type ())
+#define ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO, OrganigrammaStrutturaCollegamento))
+#define ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO, OrganigrammaStrutturaCollegamentoClass))
+#define IS_ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO))
+#define IS_ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO))
+#define ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO, OrganigrammaStrutturaCollegamentoClass))
+
+
+typedef struct _OrganigrammaStrutturaCollegamento OrganigrammaStrutturaCollegamento;
+typedef struct _OrganigrammaStrutturaCollegamentoClass OrganigrammaStrutturaCollegamentoClass;
+
+struct _OrganigrammaStrutturaCollegamento
+       {
+               GObject parent;
+       };
+
+struct _OrganigrammaStrutturaCollegamentoClass
+       {
+               GObjectClass parent_class;
+
+               guint aggiornato_signal_id;
+       };
+
+GType organigramma_struttura_collegamento_get_type (void) G_GNUC_CONST;
+
+OrganigrammaStrutturaCollegamento *organigramma_struttura_collegamento_new (OrganigrammaCommons *commons, guint id, guint id_uffici);
+
+GtkWidget *organigramma_struttura_collegamento_get_widget (OrganigrammaStrutturaCollegamento *organigramma_struttura_allegato);
+
+
+G_END_DECLS
+
+#endif /* __ORGANIGRAMMA_STRUTTURA_COLLEGAMENTO_H__ */