tipo_recapito.form \
titolo.form \
ufficio.form \
+ ufficio_collegamento.form \
ufficio_nodo.form \
ufficio_orario.form \
ufficio_recapito.form \
--- /dev/null
+<?xml version="1.0"?>
+<gtkform>
+
+ <table>ufficio_collegamenti</table>
+
+ <widget type="label" name="label181">
+ <field type="integer" name="id">
+ <is-key>t</is-key>
+ <auto-increment>t</auto-increment>
+ </field>
+ </widget>
+
+ <widget type="label" name="label182">
+ <field type="integer" name="id_uffici" />
+ </widget>
+
+ <widget type="entry" name="entry50" label="label178">
+ <field type="text" name="descrizione">
+ <obligatory>t</obligatory>
+ </field>
+ </widget>
+
+ <widget type="entry" name="entry51" label="label179">
+ <field type="text" name="indirizzo">
+ <obligatory>t</obligatory>
+ </field>
+ </widget>
+
+ <widget type="textview" name="textview19" label="label180">
+ <field type="text" name="note" />
+ </widget>
+
+</gtkform>
<column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="lstore_ufficio_persone">
- <columns>
- <!-- column-name id -->
- <column type="guint"/>
- <!-- column-name ruolo -->
- <column type="gchararray"/>
- <!-- column-name nome -->
- <column type="gchararray"/>
- <!-- column-name da_data -->
- <column type="gchararray"/>
- <!-- column-name a_data -->
- <column type="gchararray"/>
- </columns>
- </object>
<object class="GtkListStore" id="lstore_persona_uffici">
<columns>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkListStore" id="lstore_ufficio_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_ufficio_nodi">
<columns>
<!-- column-name tipo -->
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkListStore" id="lstore_ufficio_persone">
+ <columns>
+ <!-- column-name id -->
+ <column type="guint"/>
+ <!-- column-name ruolo -->
+ <column type="gchararray"/>
+ <!-- column-name nome -->
+ <column type="gchararray"/>
+ <!-- column-name da_data -->
+ <column type="gchararray"/>
+ <!-- column-name a_data -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkListStore" id="lstore_ufficio_recapiti">
<columns>
<!-- column-name tipo -->
<property name="tab_fill">False</property>
</packing>
</child>
+ <child>
+ <object class="GtkHBox" id="hbox22">
+ <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="scrolledwindow44">
+ <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="treeview25">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">lstore_ufficio_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="treeviewcolumn44">
+ <property name="title">Descrizione</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext55"/>
+ <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="vbuttonbox13">
+ <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="button177">
+ <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="button178">
+ <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="button179">
+ <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="button180">
+ <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">3</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label183">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Collegamenti</property>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="right_attach">2</property>
</object>
</child>
</object>
+ <object class="GtkWindow" id="w_ufficio_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="vbox27">
+ <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="table26">
+ <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="label178">
+ <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="entry50">
+ <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="label179">
+ <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="entry51">
+ <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="label180">
+ <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="scrolledwindow43">
+ <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="textview19">
+ <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="label181">
+ <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="label182">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">lbl_id_uffici</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="hbuttonbox36">
+ <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="button174">
+ <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="button175">
+ <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="button176">
+ <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_ufficio_nodo">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Nodo superiore dell'ufficio - Gestione organigramma</property>
);
ALTER TABLE persona_uffici ADD COLUMN id_ruoli integer DEFAULT 0;
+
+CREATE TABLE ufficio_collegamenti
+(
+ id integer NOT NULL,
+ id_uffici 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 ufficio_collegamenti_pkey PRIMARY KEY (id)
+);
-- Dumped from database version 8.4.17
-- Dumped by pg_dump version 9.2.2
--- Started on 2013-05-29 10:39:38
+-- Started on 2013-06-03 10:06:39
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET escape_string_warning = off;
--
--- TOC entry 543 (class 2612 OID 16386)
+-- TOC entry 548 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: -
--
note text DEFAULT ''::text,
status character varying(1) DEFAULT ''::character varying,
piano character varying(10) DEFAULT ''::character varying,
- stanza character varying(10) DEFAULT ''::character varying
+ stanza character varying(10) DEFAULT ''::character varying,
+ id_ruoli integer DEFAULT 0
);
);
+--
+-- TOC entry 163 (class 1259 OID 626355)
+-- Name: ufficio_collegamenti; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE ufficio_collegamenti (
+ id integer NOT NULL,
+ id_uffici 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 146 (class 1259 OID 59357)
-- Name: ufficio_nodi; Type: TABLE; Schema: public; Owner: -
--
--- TOC entry 1969 (class 2606 OID 59289)
+-- TOC entry 1979 (class 2606 OID 59289)
-- Name: nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2009 (class 2606 OID 61360)
+-- TOC entry 2019 (class 2606 OID 61360)
-- Name: persona_incarichi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1999 (class 2606 OID 61305)
+-- TOC entry 2009 (class 2606 OID 61305)
-- Name: persona_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2001 (class 2606 OID 61321)
+-- TOC entry 2011 (class 2606 OID 61321)
-- Name: persona_nodo_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1995 (class 2606 OID 61279)
+-- TOC entry 2005 (class 2606 OID 61279)
-- Name: persona_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1993 (class 2606 OID 61252)
+-- TOC entry 2003 (class 2606 OID 61252)
-- Name: persona_uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1997 (class 2606 OID 61294)
+-- TOC entry 2007 (class 2606 OID 61294)
-- Name: persona_ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1989 (class 2606 OID 61235)
+-- TOC entry 1999 (class 2606 OID 61235)
-- Name: persone_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2003 (class 2606 OID 61328)
+-- TOC entry 2013 (class 2606 OID 61328)
-- Name: posizioni_economiche_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2007 (class 2606 OID 61342)
+-- TOC entry 2017 (class 2606 OID 61342)
-- Name: profili_professionali_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2013 (class 2606 OID 618188)
+-- TOC entry 2023 (class 2606 OID 618188)
-- Name: ruoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1979 (class 2606 OID 59356)
+-- TOC entry 1989 (class 2606 OID 59356)
-- Name: struttura_indirizzi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1977 (class 2606 OID 59339)
+-- TOC entry 1987 (class 2606 OID 59339)
-- Name: strutture_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1971 (class 2606 OID 59296)
+-- TOC entry 1981 (class 2606 OID 59296)
-- Name: tipi_nodo_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2005 (class 2606 OID 61335)
+-- TOC entry 2015 (class 2606 OID 61335)
-- Name: tipi_prestazione_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1991 (class 2606 OID 61242)
+-- TOC entry 2001 (class 2606 OID 61242)
-- Name: tipi_rapporto_lavoro_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1973 (class 2606 OID 59303)
+-- TOC entry 1983 (class 2606 OID 59303)
-- Name: tipi_recapito_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1987 (class 2606 OID 61226)
+-- TOC entry 1997 (class 2606 OID 61226)
-- Name: titoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1975 (class 2606 OID 59321)
+-- TOC entry 1985 (class 2606 OID 59321)
-- Name: uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1981 (class 2606 OID 59366)
+-- TOC entry 2025 (class 2606 OID 626366)
+-- Name: ufficio_collegamenti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY ufficio_collegamenti
+ ADD CONSTRAINT ufficio_collegamenti_pkey PRIMARY KEY (id);
+
+
+--
+-- TOC entry 1991 (class 2606 OID 59366)
-- Name: ufficio_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1983 (class 2606 OID 59408)
+-- TOC entry 1993 (class 2606 OID 59408)
-- Name: ufficio_orari_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1985 (class 2606 OID 59419)
+-- TOC entry 1995 (class 2606 OID 59419)
-- Name: ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2011 (class 2606 OID 61430)
+-- TOC entry 2021 (class 2606 OID 61430)
-- Name: ufficio_stanze_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ADD CONSTRAINT ufficio_stanze_pkey PRIMARY KEY (id);
--- Completed on 2013-05-29 10:39:39
+-- Completed on 2013-06-03 10:06:40
--
-- PostgreSQL database dump complete
../src/titolo.c \
../src/uffici.c \
../src/ufficio.c \
+ ../src/ufficiocollegamento.c \
../src/ufficionodo.c \
../src/ufficioorario.c \
../src/ufficiorecapito.c \
../src/titolo.h \
../src/uffici.h \
../src/ufficio.h \
+ ../src/ufficiocollegamento.h \
../src/ufficionodo.h \
../src/ufficioorario.h \
../src/ufficiorecapito.h \
uffici.h \
ufficio.c \
ufficio.h \
+ ufficiocollegamento.c \
+ ufficiocollegamento.h \
ufficionodo.c \
ufficionodo.h \
ufficioorario.c \
#include "ufficioorario.h"
#include "ufficiorecapito.h"
#include "ufficiostanza.h"
+#include "ufficiocollegamento.h"
static void organigramma_ufficio_class_init (OrganigrammaUfficioClass *klass);
static void organigramma_ufficio_init (OrganigrammaUfficio *ufficio);
static void organigramma_ufficio_carica_recapiti (OrganigrammaUfficio *ufficio);
static void organigramma_ufficio_carica_orari (OrganigrammaUfficio *ufficio);
static void organigramma_ufficio_carica_persone (OrganigrammaUfficio *ufficio);
+static void organigramma_ufficio_carica_collegamenti (OrganigrammaUfficio *ufficio);
static void organigramma_ufficio_nodo_modifica (OrganigrammaUfficio *ufficio);
static void organigramma_ufficio_stanza_modifica (OrganigrammaUfficio *ufficio);
static void organigramma_ufficio_recapito_modifica (OrganigrammaUfficio *ufficio);
static void organigramma_ufficio_orario_modifica (OrganigrammaUfficio *ufficio);
+static void organigramma_ufficio_collegamento_modifica (OrganigrammaUfficio *ufficio);
static gboolean organigramma_ufficio_conferma_chiusura (OrganigrammaUfficio *ufficio);
static void organigramma_ufficio_on_stanza_aggiornato (gpointer instance, gpointer user_data);
static void organigramma_ufficio_on_recapito_aggiornato (gpointer instance, gpointer user_data);
static void organigramma_ufficio_on_orario_aggiornato (gpointer instance, gpointer user_data);
+static void organigramma_ufficio_on_collegamento_aggiornato (gpointer instance, gpointer user_data);
static void organigramma_ufficio_on_organigramma_ufficio_selezionato (gpointer instance, guint id, gpointer user_data);
GtkTreeViewColumn *column,
gpointer user_data);
+static void organigramma_ufficio_on_btn_collegamento_nuovo_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_ufficio_on_btn_collegamento_modifica_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_ufficio_on_btn_collegamento_elimina_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_ufficio_on_btn_collegamento_apri_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_ufficio_on_trv_collegamenti_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *tree_path,
+ GtkTreeViewColumn *column,
+ gpointer user_data);
+
static void organigramma_ufficio_on_btn_annulla_clicked (GtkButton *button,
gpointer user_data);
static void organigramma_ufficio_on_btn_salva_clicked (GtkButton *button,
LSTORE_STANZE,
LSTORE_RECAPITI,
LSTORE_ORARI,
- LSTORE_PERSONE
+ LSTORE_PERSONE,
+ LSTORE_COLLEGAMENTI
};
enum
PERSONE_COL_A_DATA
};
+enum
+{
+ COLLEGAMENTI_COL_ID,
+ COLLEGAMENTI_COL_DESCRIZIONE,
+ COLLEGAMENTI_COL_INDIRIZZO
+};
+
typedef struct _OrganigrammaUfficioPrivate OrganigrammaUfficioPrivate;
struct _OrganigrammaUfficioPrivate
{
GtkTreeSelection *sel_recapiti;
GtkTreeSelection *sel_orari;
GtkTreeSelection *sel_persone;
+ GtkTreeSelection *sel_collegamenti;
gint id;
};
"|lstore_ufficio_recapiti"
"|lstore_ufficio_orari"
"|lstore_ufficio_persone"
+ "|lstore_ufficio_collegamenti"
"|w_ufficio",
"|",
-1),
"lstore_ufficio_recapiti",
"lstore_ufficio_orari",
"lstore_ufficio_persone",
+ "lstore_ufficio_collegamenti",
NULL);
priv->sel_nodi = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview7")));
priv->sel_recapiti = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview6")));
priv->sel_orari = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview10")));
priv->sel_persone = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview24")));
+ priv->sel_collegamenti = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview25")));
g_signal_connect (priv->w,
"delete-event", G_CALLBACK (organigramma_ufficio_on_w_organigramma_ufficio_delete_event), (gpointer)a);
g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview10")),
"row-activated", G_CALLBACK (organigramma_ufficio_on_trv_orari_row_activated), (gpointer)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button177")),
+ "clicked", G_CALLBACK (organigramma_ufficio_on_btn_collegamento_nuovo_clicked), (gpointer)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button178")),
+ "clicked", G_CALLBACK (organigramma_ufficio_on_btn_collegamento_modifica_clicked), (gpointer)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button179")),
+ "clicked", G_CALLBACK (organigramma_ufficio_on_btn_collegamento_elimina_clicked), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button180"),
+ "clicked", G_CALLBACK (organigramma_ufficio_on_btn_collegamento_apri_clicked), (gpointer)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview25")),
+ "row-activated", G_CALLBACK (organigramma_ufficio_on_trv_collegamenti_row_activated), (gpointer)a);
+
g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button29"),
"clicked", G_CALLBACK (organigramma_ufficio_on_btn_annulla_clicked), (gpointer)a);
g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button30"),
gtk_form_set_as_origin (priv->form);
- gtk_form_set_sensitive_by_name (priv->form, FALSE, "hbox2", "hbox19", "hbox4", "hbox9", "hbox21", NULL);
+ gtk_form_set_sensitive_by_name (priv->form, FALSE, "hbox2", "hbox19", "hbox4", "hbox9", "hbox21", "hbox22", NULL);
}
else
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button61")), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button30")), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button151")), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button177")), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button179")), FALSE);
}
return a;
organigramma_ufficio_carica_recapiti (ufficio);
organigramma_ufficio_carica_orari (ufficio);
organigramma_ufficio_carica_persone (ufficio);
+ organigramma_ufficio_carica_collegamenti (ufficio);
}
}
}
}
+static void
+organigramma_ufficio_carica_collegamenti (OrganigrammaUfficio *ufficio)
+{
+ GtkListStore *lstore;
+ GtkTreeIter iter;
+ GdaDataModel *dm;
+
+ gchar *sql;
+
+ gint rows;
+ gint row;
+
+ OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (ufficio);
+
+ 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 ufficio_collegamenti AS aa"
+ " WHERE aa.status <> 'E'"
+ " AND aa.id_uffici = %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_ufficio_nodo_modifica (OrganigrammaUfficio *ufficio)
{
}
}
+static void
+organigramma_ufficio_collegamento_modifica (OrganigrammaUfficio *organigramma_ufficio)
+{
+ GtkTreeIter iter;
+ guint id;
+
+ OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (organigramma_ufficio);
+
+ 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);
+
+ OrganigrammaUfficioCollegamento *c = organigramma_ufficio_collegamento_new (priv->commons, id, 0);
+
+ g_signal_connect (G_OBJECT (c), "aggiornato",
+ G_CALLBACK (organigramma_ufficio_on_collegamento_aggiornato), (gpointer)organigramma_ufficio);
+
+ w = organigramma_ufficio_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_ufficio_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
{
organigramma_ufficio_carica_orari (ufficio);
}
+static void
+organigramma_ufficio_on_collegamento_aggiornato (gpointer instance, gpointer user_data)
+{
+ organigramma_ufficio_carica_collegamenti ((OrganigrammaUfficio *)user_data);
+}
+
static gboolean
organigramma_ufficio_on_w_organigramma_ufficio_delete_event (GtkWidget *widget,
GdkEvent *event,
organigramma_ufficio_orario_modifica ((OrganigrammaUfficio *)user_data);
}
+static void
+organigramma_ufficio_on_btn_collegamento_nuovo_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkWidget *w;
+
+ OrganigrammaUfficio *ufficio = (OrganigrammaUfficio *)user_data;
+
+ OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (ufficio);
+
+ OrganigrammaUfficioCollegamento *a = organigramma_ufficio_collegamento_new (priv->commons, 0, priv->id);
+
+ g_signal_connect (G_OBJECT (a), "aggiornato",
+ G_CALLBACK (organigramma_ufficio_on_collegamento_aggiornato), (gpointer)ufficio);
+
+ w = organigramma_ufficio_collegamento_get_widget (a);
+ gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+ gtk_widget_show (w);
+}
+
+static void
+organigramma_ufficio_on_btn_collegamento_modifica_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ organigramma_ufficio_collegamento_modifica ((OrganigrammaUfficio *)user_data);
+}
+
+static void
+organigramma_ufficio_on_btn_collegamento_elimina_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkTreeIter iter;
+
+ OrganigrammaUfficio *ufficio = (OrganigrammaUfficio *)user_data;
+
+ OrganigrammaUfficioClass *klass = ORGANIGRAMMA_UFFICIO_GET_CLASS (ufficio);
+ OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (ufficio);
+
+ 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 ufficio_collegamenti"
+ " SET status = 'E'"
+ " WHERE id = %d",
+ id));
+
+ organigramma_ufficio_carica_collegamenti (ufficio);
+ }
+ }
+ else
+ {
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare un collegamento.");
+ }
+}
+
+static void
+organigramma_ufficio_on_btn_collegamento_apri_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkTreeIter iter;
+ gchar *indirizzo;
+
+ OrganigrammaUfficio *organigramma_ufficio = (OrganigrammaUfficio *)user_data;
+ OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (organigramma_ufficio);
+
+ 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_ufficio_on_trv_collegamenti_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *tree_path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
+{
+ organigramma_ufficio_collegamento_modifica ((OrganigrammaUfficio *)user_data);
+}
+
static void
organigramma_ufficio_on_btn_annulla_clicked (GtkButton *button,
gpointer user_data)
--- /dev/null
+/*
+ * 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 "ufficiocollegamento.h"
+
+static void organigramma_ufficio_collegamento_class_init (OrganigrammaUfficioCollegamentoClass *klass);
+static void organigramma_ufficio_collegamento_init (OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento);
+
+static void organigramma_ufficio_collegamento_carica (OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento);
+static void organigramma_ufficio_collegamento_salva (OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento, gboolean chiudi);
+
+static gboolean organigramma_ufficio_collegamento_conferma_chiusura (OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento);
+
+static void organigramma_ufficio_collegamento_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void organigramma_ufficio_collegamento_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static gboolean organigramma_ufficio_collegamento_on_w_organigramma_ufficio_collegamento_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data);
+
+static void organigramma_ufficio_collegamento_on_btn_annulla_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_ufficio_collegamento_on_btn_salva_clicked (GtkButton *button,
+ gpointer user_data);
+static void organigramma_ufficio_collegamento_on_btn_salvachiudi_clicked (GtkButton *button,
+ gpointer user_data);
+
+#define ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_ORGANIGRAMMA_UFFICIO_COLLEGAMENTO, OrganigrammaUfficioCollegamentoPrivate))
+
+enum
+{
+ LBL_ID,
+ LBL_ID_UFFICI
+};
+
+typedef struct _OrganigrammaUfficioCollegamentoPrivate OrganigrammaUfficioCollegamentoPrivate;
+struct _OrganigrammaUfficioCollegamentoPrivate
+ {
+ OrganigrammaCommons *commons;
+
+ GtkForm *form;
+
+ GtkWidget *w;
+
+ GObject **objects;
+
+ gint id;
+ };
+
+G_DEFINE_TYPE (OrganigrammaUfficioCollegamento, organigramma_ufficio_collegamento, G_TYPE_OBJECT)
+
+static void
+organigramma_ufficio_collegamento_class_init (OrganigrammaUfficioCollegamentoClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (OrganigrammaUfficioCollegamentoPrivate));
+
+ object_class->set_property = organigramma_ufficio_collegamento_set_property;
+ object_class->get_property = organigramma_ufficio_collegamento_get_property;
+
+ /**
+ * OrganigrammaUfficioCollegamento::aggiornato:
+ * @organigramma_ufficio_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_ufficio_collegamento_init (OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento)
+{
+ OrganigrammaUfficioCollegamentoPrivate *priv = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_PRIVATE (organigramma_ufficio_collegamento);
+}
+
+/**
+ * organigramma_ufficio_collegamento_new:
+ * @commons:
+ * @id:
+ * @id_uffici:
+ *
+ * Returns: the newly created #OrganigrammaUfficioCollegamento object.
+ */
+OrganigrammaUfficioCollegamento
+*organigramma_ufficio_collegamento_new (OrganigrammaCommons *commons, guint id, guint id_uffici)
+{
+ GError *error;
+ AutozIResource *ires1;
+
+ OrganigrammaUfficioCollegamento *a = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO (g_object_new (organigramma_ufficio_collegamento_get_type (), NULL));
+
+ OrganigrammaUfficioCollegamentoPrivate *priv = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_PRIVATE (a);
+
+ priv->commons = commons;
+
+ error = NULL;
+ gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
+ g_strsplit ("w_ufficio_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, "ufficio_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_ufficio_collegamento"));
+
+ priv->objects = gtk_form_get_objects_by_name (priv->form,
+ "label181",
+ "label182",
+ NULL);
+
+ g_signal_connect (priv->w,
+ "delete-event", G_CALLBACK (organigramma_ufficio_collegamento_on_w_organigramma_ufficio_collegamento_delete_event), (gpointer)a);
+
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button174"),
+ "clicked", G_CALLBACK (organigramma_ufficio_collegamento_on_btn_annulla_clicked), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button175"),
+ "clicked", G_CALLBACK (organigramma_ufficio_collegamento_on_btn_salva_clicked), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button176"),
+ "clicked", G_CALLBACK (organigramma_ufficio_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_UFFICI]), 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_ufficio_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, "button175")), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button176")), FALSE);
+ }
+
+ return a;
+}
+
+/**
+ * organigramma_ufficio_collegamento_get_widget:
+ * @organigramma_ufficio_collegamento:
+ *
+ */
+GtkWidget
+*organigramma_ufficio_collegamento_get_widget (OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento)
+{
+ OrganigrammaUfficioCollegamentoPrivate *priv = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_PRIVATE (organigramma_ufficio_collegamento);
+
+ return priv->w;
+}
+
+/* PRIVATE */
+static void
+organigramma_ufficio_collegamento_carica (OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento)
+{
+ OrganigrammaUfficioCollegamentoPrivate *priv = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_PRIVATE (organigramma_ufficio_collegamento);
+
+ if (gtk_form_fill_from_table (priv->form))
+ {
+ }
+}
+
+static void
+organigramma_ufficio_collegamento_salva (OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento, gboolean chiudi)
+{
+ gchar *sql;
+ GtkWidget *dialog;
+
+ OrganigrammaUfficioCollegamentoClass *klass = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_CLASS (organigramma_ufficio_collegamento);
+
+ OrganigrammaUfficioCollegamentoPrivate *priv = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_PRIVATE (organigramma_ufficio_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_ufficio_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_ufficio_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_ufficio_collegamento_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO (object);
+ OrganigrammaUfficioCollegamentoPrivate *priv = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_PRIVATE (organigramma_ufficio_collegamento);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+organigramma_ufficio_collegamento_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO (object);
+ OrganigrammaUfficioCollegamentoPrivate *priv = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_PRIVATE (organigramma_ufficio_collegamento);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static gboolean
+organigramma_ufficio_collegamento_conferma_chiusura (OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento)
+{
+ gboolean ret;
+
+ OrganigrammaUfficioCollegamentoPrivate *priv = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_PRIVATE (organigramma_ufficio_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_ufficio_collegamento_on_w_organigramma_ufficio_collegamento_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ return !organigramma_ufficio_collegamento_conferma_chiusura ((OrganigrammaUfficioCollegamento *)user_data);
+}
+
+
+static void
+organigramma_ufficio_collegamento_on_btn_annulla_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ OrganigrammaUfficioCollegamento *collegamento = (OrganigrammaUfficioCollegamento *)user_data;
+
+ OrganigrammaUfficioCollegamentoPrivate *priv = ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_PRIVATE (collegamento);
+
+ if (organigramma_ufficio_collegamento_conferma_chiusura (collegamento)) gtk_widget_destroy (priv->w);
+}
+
+static void
+organigramma_ufficio_collegamento_on_btn_salva_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ organigramma_ufficio_collegamento_salva ((OrganigrammaUfficioCollegamento *)user_data, FALSE);
+}
+
+static void
+organigramma_ufficio_collegamento_on_btn_salvachiudi_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ organigramma_ufficio_collegamento_salva ((OrganigrammaUfficioCollegamento *)user_data, TRUE);
+}
--- /dev/null
+/*
+ * 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_UFFICIO_COLLEGAMENTO_H__
+#define __ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+#include "commons.h"
+
+G_BEGIN_DECLS
+
+
+#define TYPE_ORGANIGRAMMA_UFFICIO_COLLEGAMENTO (organigramma_ufficio_collegamento_get_type ())
+#define ORGANIGRAMMA_UFFICIO_COLLEGAMENTO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ORGANIGRAMMA_UFFICIO_COLLEGAMENTO, OrganigrammaUfficioCollegamento))
+#define ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ORGANIGRAMMA_UFFICIO_COLLEGAMENTO, OrganigrammaUfficioCollegamentoClass))
+#define IS_ORGANIGRAMMA_UFFICIO_COLLEGAMENTO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ORGANIGRAMMA_UFFICIO_COLLEGAMENTO))
+#define IS_ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ORGANIGRAMMA_UFFICIO_COLLEGAMENTO))
+#define ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ORGANIGRAMMA_UFFICIO_COLLEGAMENTO, OrganigrammaUfficioCollegamentoClass))
+
+
+typedef struct _OrganigrammaUfficioCollegamento OrganigrammaUfficioCollegamento;
+typedef struct _OrganigrammaUfficioCollegamentoClass OrganigrammaUfficioCollegamentoClass;
+
+struct _OrganigrammaUfficioCollegamento
+ {
+ GObject parent;
+ };
+
+struct _OrganigrammaUfficioCollegamentoClass
+ {
+ GObjectClass parent_class;
+
+ guint aggiornato_signal_id;
+ };
+
+GType organigramma_ufficio_collegamento_get_type (void) G_GNUC_CONST;
+
+OrganigrammaUfficioCollegamento *organigramma_ufficio_collegamento_new (OrganigrammaCommons *commons, guint id, guint id_uffici);
+
+GtkWidget *organigramma_ufficio_collegamento_get_widget (OrganigrammaUfficioCollegamento *organigramma_ufficio_allegato);
+
+
+G_END_DECLS
+
+#endif /* __ORGANIGRAMMA_UFFICIO_COLLEGAMENTO_H__ */