form_DATA = \
nodo.form \
persona.form \
+ persona_incarico.form \
persona_nodo.form \
persona_nodo_recapito.form \
persona_recapito.form \
--- /dev/null
+<?xml version="1.0"?>
+<gtkform>
+
+ <table>persona_incarichi</table>
+
+ <widget type="label" name="label129">
+ <field type="integer" name="id">
+ <is-key>t</is-key>
+ <auto-increment>t</auto-increment>
+ </field>
+ </widget>
+
+ <widget type="label" name="label130">
+ <field type="integer" name="id_persone">
+ </field>
+ </widget>
+
+ <widget type="entry" name="entry34" label="label127">
+ <field type="text" name="matricola">
+ </field>
+ </widget>
+
+ <widget type="combobox" name="combobox8" label="label133">
+ <column-field>0</column-field>
+ <sql with-empty-entry="t">
+ SELECT id, nome FROM tipi_rapporto_lavoro WHERE status <> 'E' ORDER BY nome
+ </sql>
+ <field type="integer" name="id_tipi_rapporto_lavoro">
+ </field>
+ </widget>
+
+ <widget type="combobox" name="combobox9" label="label134">
+ <column-field>0</column-field>
+ <sql with-empty-entry="t">
+ SELECT id, nome FROM posizioni_economiche WHERE status <> 'E' ORDER BY nome
+ </sql>
+ <field type="integer" name="id_posizioni_economiche">
+ </field>
+ </widget>
+
+ <widget type="combobox" name="combobox10" label="label135">
+ <column-field>0</column-field>
+ <sql with-empty-entry="t">
+ SELECT id, nome FROM tipi_prestazione WHERE status <> 'E' ORDER BY nome
+ </sql>
+ <field type="integer" name="id_tipi_prestazione">
+ </field>
+ </widget>
+
+ <widget type="combobox" name="combobox11" label="label136">
+ <column-field>0</column-field>
+ <sql with-empty-entry="t">
+ SELECT id, nome FROM profili_professionali WHERE status <> 'E' ORDER BY nome
+ </sql>
+ <field type="integer" name="id_profili_professionali">
+ </field>
+ </widget>
+
+ <widget type="entry" name="entry35" label="label131">
+ <field type="datetime" name="da_data">
+ <datetime-type>date</datetime-type>
+ <display-format>%d/%m/%Y</display-format>
+ </field>
+ </widget>
+
+ <widget type="entry" name="entry36" label="label132">
+ <field type="datetime" name="a_data">
+ <datetime-type>date</datetime-type>
+ <display-format>%d/%m/%Y</display-format>
+ </field>
+ </widget>
+
+ <widget type="textview" name="textview15" label="label144">
+ <field type="text" name="descrizione" />
+ </widget>
+
+ <widget type="textview" name="textview14" label="label128">
+ <field type="text" name="note" />
+ </widget>
+
+</gtkform>
</object>
</child>
</object>
- <object class="GtkWindow" id="w_incarico">
+ <object class="GtkWindow" id="w_persona_incarico">
<property name="title" translatable="yes">Incarico - Gestione organigramma</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<object class="GtkEntry" id="entry34">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="max_length">50</property>
+ <property name="max_length">20</property>
<property name="invisible_char">●</property>
</object>
<packing>
-- Dumped from database version 8.4.4
-- Dumped by pg_dump version 9.0.0
--- Started on 2010-10-14 16:40:21
+-- Started on 2010-10-14 17:07:58
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET escape_string_warning = off;
--
--- TOC entry 356 (class 2612 OID 16386)
+-- TOC entry 359 (class 2612 OID 16386)
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: -
--
SET default_with_oids = false;
--
--- TOC entry 1543 (class 1259 OID 59279)
--- Dependencies: 1841 1842 1843 3
+-- TOC entry 1546 (class 1259 OID 59279)
+-- Dependencies: 1845 1846 1847 3
-- Name: nodi; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1559 (class 1259 OID 61295)
--- Dependencies: 1891 1892 1893 1894 3
+-- TOC entry 1567 (class 1259 OID 61344)
+-- Dependencies: 1912 1913 1914 1915 1916 1917 1918 1919 1920 3
+-- Name: persona_incarichi; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE persona_incarichi (
+ id integer NOT NULL,
+ id_persone integer DEFAULT 0,
+ matricola character varying(20) DEFAULT ''::character varying,
+ id_tipi_rapporto_lavoro integer DEFAULT 0,
+ id_posizioni_economiche integer DEFAULT 0,
+ id_tipi_prestazione integer DEFAULT 0,
+ id_profili_professionali integer DEFAULT 0,
+ da_data date,
+ a_data date,
+ descrizione text DEFAULT ''::text,
+ note text DEFAULT ''::text,
+ status character varying(1) DEFAULT ''::character varying
+);
+
+
+--
+-- TOC entry 1562 (class 1259 OID 61295)
+-- Dependencies: 1895 1896 1897 1898 3
-- Name: persona_nodi; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1560 (class 1259 OID 61307)
--- Dependencies: 1895 1896 1897 1898 1899 1900 1901 3
+-- TOC entry 1563 (class 1259 OID 61307)
+-- Dependencies: 1899 1900 1901 1902 1903 1904 1905 3
-- Name: persona_nodo_recapiti; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1557 (class 1259 OID 61266)
--- Dependencies: 1878 1879 1880 1881 1882 1883 3
+-- TOC entry 1560 (class 1259 OID 61266)
+-- Dependencies: 1882 1883 1884 1885 1886 1887 3
-- Name: persona_recapiti; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1556 (class 1259 OID 61243)
--- Dependencies: 1876 1877 3
+-- TOC entry 1559 (class 1259 OID 61243)
+-- Dependencies: 1880 1881 3
-- Name: persona_uffici; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1558 (class 1259 OID 61280)
--- Dependencies: 1884 1885 1886 1887 1888 1889 1890 3
+-- TOC entry 1561 (class 1259 OID 61280)
+-- Dependencies: 1888 1889 1890 1891 1892 1893 1894 3
-- Name: persona_ufficio_recapiti; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1554 (class 1259 OID 61227)
--- Dependencies: 1870 1871 1872 1873 3
+-- TOC entry 1557 (class 1259 OID 61227)
+-- Dependencies: 1874 1875 1876 1877 3
-- Name: persone; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1561 (class 1259 OID 61322)
--- Dependencies: 1902 1903 3
+-- TOC entry 1564 (class 1259 OID 61322)
+-- Dependencies: 1906 1907 3
-- Name: posizioni_economiche; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1563 (class 1259 OID 61336)
--- Dependencies: 1906 1907 3
+-- TOC entry 1566 (class 1259 OID 61336)
+-- Dependencies: 1910 1911 3
-- Name: profili_professionali; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1549 (class 1259 OID 59346)
--- Dependencies: 1857 1858 1859 3
+-- TOC entry 1552 (class 1259 OID 59346)
+-- Dependencies: 1861 1862 1863 3
-- Name: struttura_indirizzi; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1547 (class 1259 OID 59327)
--- Dependencies: 1851 1852 1853 1854 1855 3
+-- TOC entry 1550 (class 1259 OID 59327)
+-- Dependencies: 1855 1856 1857 1858 1859 3
-- Name: strutture; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1544 (class 1259 OID 59290)
--- Dependencies: 1844 1845 3
+-- TOC entry 1547 (class 1259 OID 59290)
+-- Dependencies: 1848 1849 3
-- Name: tipi_nodo; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1562 (class 1259 OID 61329)
--- Dependencies: 1904 1905 3
+-- TOC entry 1565 (class 1259 OID 61329)
+-- Dependencies: 1908 1909 3
-- Name: tipi_prestazione; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1555 (class 1259 OID 61236)
--- Dependencies: 1874 1875 3
+-- TOC entry 1558 (class 1259 OID 61236)
+-- Dependencies: 1878 1879 3
-- Name: tipi_rapporto_lavoro; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1545 (class 1259 OID 59297)
--- Dependencies: 1846 1847 3
+-- TOC entry 1548 (class 1259 OID 59297)
+-- Dependencies: 1850 1851 3
-- Name: tipi_recapito; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1553 (class 1259 OID 61219)
--- Dependencies: 1867 1868 1869 3
+-- TOC entry 1556 (class 1259 OID 61219)
+-- Dependencies: 1871 1872 1873 3
-- Name: titoli; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1546 (class 1259 OID 59311)
--- Dependencies: 1848 1849 1850 3
+-- TOC entry 1549 (class 1259 OID 59311)
+-- Dependencies: 1852 1853 1854 3
-- Name: uffici; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1550 (class 1259 OID 59357)
--- Dependencies: 1860 1861 3
+-- TOC entry 1553 (class 1259 OID 59357)
+-- Dependencies: 1864 1865 3
-- Name: ufficio_nodi; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1551 (class 1259 OID 59399)
--- Dependencies: 1862 1863 3
+-- TOC entry 1554 (class 1259 OID 59399)
+-- Dependencies: 1866 1867 3
-- Name: ufficio_orari; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1552 (class 1259 OID 59409)
--- Dependencies: 1864 1865 1866 3
+-- TOC entry 1555 (class 1259 OID 59409)
+-- Dependencies: 1868 1869 1870 3
-- Name: ufficio_recapiti; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1548 (class 1259 OID 59340)
--- Dependencies: 1856 3
+-- TOC entry 1551 (class 1259 OID 59340)
+-- Dependencies: 1860 3
-- Name: vie; Type: TABLE; Schema: public; Owner: -
--
--
--- TOC entry 1909 (class 2606 OID 59289)
--- Dependencies: 1543 1543
+-- TOC entry 1922 (class 2606 OID 59289)
+-- Dependencies: 1546 1546
-- Name: nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1941 (class 2606 OID 61305)
--- Dependencies: 1559 1559
+-- TOC entry 1964 (class 2606 OID 61360)
+-- Dependencies: 1567 1567
+-- Name: persona_incarichi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY persona_incarichi
+ ADD CONSTRAINT persona_incarichi_pkey PRIMARY KEY (id);
+
+
+--
+-- TOC entry 1954 (class 2606 OID 61305)
+-- Dependencies: 1562 1562
-- Name: persona_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1943 (class 2606 OID 61321)
--- Dependencies: 1560 1560
+-- TOC entry 1956 (class 2606 OID 61321)
+-- Dependencies: 1563 1563
-- Name: persona_nodo_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1937 (class 2606 OID 61279)
--- Dependencies: 1557 1557
+-- TOC entry 1950 (class 2606 OID 61279)
+-- Dependencies: 1560 1560
-- Name: persona_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1935 (class 2606 OID 61252)
--- Dependencies: 1556 1556
+-- TOC entry 1948 (class 2606 OID 61252)
+-- Dependencies: 1559 1559
-- Name: persona_uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1939 (class 2606 OID 61294)
--- Dependencies: 1558 1558
+-- TOC entry 1952 (class 2606 OID 61294)
+-- Dependencies: 1561 1561
-- Name: persona_ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1931 (class 2606 OID 61235)
--- Dependencies: 1554 1554
+-- TOC entry 1944 (class 2606 OID 61235)
+-- Dependencies: 1557 1557
-- Name: persone_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1945 (class 2606 OID 61328)
--- Dependencies: 1561 1561
+-- TOC entry 1958 (class 2606 OID 61328)
+-- Dependencies: 1564 1564
-- Name: posizioni_economiche_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1949 (class 2606 OID 61342)
--- Dependencies: 1563 1563
+-- TOC entry 1962 (class 2606 OID 61342)
+-- Dependencies: 1566 1566
-- Name: profili_professionali_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1921 (class 2606 OID 59356)
--- Dependencies: 1549 1549
+-- TOC entry 1934 (class 2606 OID 59356)
+-- Dependencies: 1552 1552
-- Name: struttura_indirizzi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1917 (class 2606 OID 59339)
--- Dependencies: 1547 1547
+-- TOC entry 1930 (class 2606 OID 59339)
+-- Dependencies: 1550 1550
-- Name: strutture_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1911 (class 2606 OID 59296)
--- Dependencies: 1544 1544
+-- TOC entry 1924 (class 2606 OID 59296)
+-- Dependencies: 1547 1547
-- Name: tipi_nodo_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1947 (class 2606 OID 61335)
--- Dependencies: 1562 1562
+-- TOC entry 1960 (class 2606 OID 61335)
+-- Dependencies: 1565 1565
-- Name: tipi_prestazione_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1933 (class 2606 OID 61242)
--- Dependencies: 1555 1555
+-- TOC entry 1946 (class 2606 OID 61242)
+-- Dependencies: 1558 1558
-- Name: tipi_rapporto_lavoro_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1913 (class 2606 OID 59303)
--- Dependencies: 1545 1545
+-- TOC entry 1926 (class 2606 OID 59303)
+-- Dependencies: 1548 1548
-- Name: tipi_recapito_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1929 (class 2606 OID 61226)
--- Dependencies: 1553 1553
+-- TOC entry 1942 (class 2606 OID 61226)
+-- Dependencies: 1556 1556
-- Name: titoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1915 (class 2606 OID 59321)
--- Dependencies: 1546 1546
+-- TOC entry 1928 (class 2606 OID 59321)
+-- Dependencies: 1549 1549
-- Name: uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1923 (class 2606 OID 59366)
--- Dependencies: 1550 1550
+-- TOC entry 1936 (class 2606 OID 59366)
+-- Dependencies: 1553 1553
-- Name: ufficio_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1925 (class 2606 OID 59408)
--- Dependencies: 1551 1551
+-- TOC entry 1938 (class 2606 OID 59408)
+-- Dependencies: 1554 1554
-- Name: ufficio_orari_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1927 (class 2606 OID 59419)
--- Dependencies: 1552 1552
+-- TOC entry 1940 (class 2606 OID 59419)
+-- Dependencies: 1555 1555
-- Name: ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 1919 (class 2606 OID 59345)
--- Dependencies: 1548 1548
+-- TOC entry 1932 (class 2606 OID 59345)
+-- Dependencies: 1551 1551
-- Name: vie_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ADD CONSTRAINT vie_pkey PRIMARY KEY (id);
--- Completed on 2010-10-14 16:40:22
+-- Completed on 2010-10-14 17:07:58
--
-- PostgreSQL database dump complete
persona.h \
persone.c \
persone.h \
+ personaincarico.c \
+ personaincarico.h \
personanodo.c \
personanodo.h \
personanodorecapito.c \
#include <libgtkform/fielddatetime.h>
#include "persona.h"
+#include "personaincarico.h"
#include "personanodo.h"
#include "personanodorecapito.h"
#include "personaufficio.h"
static void persona_carica (Persona *persona);
static void persona_salva (Persona *persona);
+static void persona_carica_incarichi (Persona *persona);
static void persona_carica_nodi (Persona *persona);
static void persona_carica_nodo_recapiti (Persona *persona);
static void persona_carica_uffici (Persona *persona);
static void persona_carica_ufficio_recapiti (Persona *persona);
static void persona_carica_recapiti (Persona *persona);
-static void persona_ufficio_nodo_modifica (Persona *persona);
+static void persona_incarico_modifica (Persona *persona);
+static void persona_nodo_modifica (Persona *persona);
+static void persona_nodo_recapito_modifica (Persona *persona);
static void persona_ufficio_modifica (Persona *persona);
static void persona_ufficio_recapito_modifica (Persona *persona);
static void persona_recapito_modifica (Persona *persona);
GValue *value,
GParamSpec *pspec);
+static void persona_on_incarico_aggiornato (gpointer instance, gpointer user_data);
static void persona_on_nodo_aggiornato (gpointer instance, gpointer user_data);
static void persona_on_nodo_recapito_aggiornato (gpointer instance, gpointer user_data);
static void persona_on_ufficio_aggiornato (gpointer instance, gpointer user_data);
GdkEvent *event,
gpointer user_data);
+static void persona_on_btn_incarico_nuovo_clicked (GtkButton *button,
+ gpointer user_data);
+static void persona_on_btn_incarico_modifica_clicked (GtkButton *button,
+ gpointer user_data);
+static void persona_on_btn_incarico_elimina_clicked (GtkButton *button,
+ gpointer user_data);
+static void persona_on_trv_incarichi_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *tree_path,
+ GtkTreeViewColumn *column,
+ gpointer user_data);
+
static void persona_on_btn_nodo_nuovo_clicked (GtkButton *button,
gpointer user_data);
static void persona_on_btn_nodo_modifica_clicked (GtkButton *button,
enum
{
LBL_ID,
+ LSTORE_INCARICHI,
LSTORE_NODI,
LSTORE_NODO_RECAPITI,
LSTORE_UFFICI,
LSTORE_RECAPITI
};
+enum
+{
+ INCARICHI_COL_ID,
+ INCARICHI_COL_DA_DATA,
+ INCARICHI_COL_A_DATA,
+ INCARICHI_COL_DESCRIZIONE
+};
+
enum
{
NODI_COL_ID,
GObject **objects;
+ GtkTreeSelection *sel_incarichi;
GtkTreeSelection *sel_nodi;
GtkTreeSelection *sel_nodo_recapiti;
GtkTreeSelection *sel_uffici;
gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
g_strsplit (g_strconcat (
"lstore_titoli"
+ "|lstore_persona_incarichi"
"|lstore_persona_nodi"
"|lstore_persona_nodo_recapiti"
"|lstore_persona_uffici"
priv->objects = gtk_form_get_objects_by_name (priv->form,
"label67",
+ "lstore_persona_incarichi",
"lstore_persona_nodi",
"lstore_persona_nodo_recapiti",
"lstore_persona_uffici",
g_signal_connect (priv->w,
"delete-event", G_CALLBACK (persona_on_w_persona_delete_event), (gpointer *)a);
+ priv->sel_incarichi = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview16")));
priv->sel_nodi = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview13")));
priv->sel_nodo_recapiti = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview14")));
priv->sel_uffici = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview11")));
g_signal_connect (priv->sel_uffici,
"changed", G_CALLBACK (persona_on_uffici_sel_changed), (gpointer)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button79")),
+ "clicked", G_CALLBACK (persona_on_btn_incarico_nuovo_clicked), (gpointer *)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button80")),
+ "clicked", G_CALLBACK (persona_on_btn_incarico_modifica_clicked), (gpointer *)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button81")),
+ "clicked", G_CALLBACK (persona_on_btn_incarico_elimina_clicked), (gpointer *)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview16")),
+ "row-activated", G_CALLBACK (persona_on_trv_incarichi_row_activated), (gpointer *)a);
+
g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button70")),
"clicked", G_CALLBACK (persona_on_btn_nodo_nuovo_clicked), (gpointer *)a);
g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button71")),
if (gtk_form_fill_from_table (priv->form))
{
+ persona_carica_incarichi (persona);
persona_carica_nodi (persona);
persona_carica_nodo_recapiti (persona);
persona_carica_uffici (persona);
}
}
+static void
+persona_carica_incarichi (Persona *persona)
+{
+ gchar *sql;
+ GdaDataModel *dm;
+ guint row;
+ guint rows;
+
+ PersonaPrivate *priv = PERSONA_GET_PRIVATE (persona);
+
+ gtk_list_store_clear (GTK_LIST_STORE (priv->objects[LSTORE_INCARICHI]));
+
+ sql = g_strdup_printf ("SELECT pi.id, pi.da_data, pi.a_data, pi.descrizione"
+ " FROM persona_incarichi AS pi"
+ " WHERE pi.id_persone = %d"
+ " AND pi.status <> 'E'"
+ " ORDER BY pi.da_data, pi.a_data, pi.descrizione",
+ priv->id);
+ dm = gdaex_query (priv->commons->gdaex, sql);
+ if (dm != NULL)
+ {
+ GtkTreeIter iter;
+
+ rows = gda_data_model_get_n_rows (dm);
+ for (row = 0; row < rows; row++)
+ {
+ gtk_list_store_append (GTK_LIST_STORE (priv->objects[LSTORE_INCARICHI]), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (priv->objects[LSTORE_INCARICHI]), &iter,
+ INCARICHI_COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
+ INCARICHI_COL_DA_DATA, gtk_form_field_datetime_get_str_from_tm (gdaex_data_model_get_field_value_tm_at (dm, row, "da_data"), "%d/%m/%Y"),
+ INCARICHI_COL_A_DATA, gtk_form_field_datetime_get_str_from_tm (gdaex_data_model_get_field_value_tm_at (dm, row, "a_data"), "%d/%m/%Y"),
+ INCARICHI_COL_DESCRIZIONE, gdaex_data_model_get_field_value_stringify_at (dm, row, "descrizione"),
+ -1);
+ }
+
+ g_object_unref (dm);
+ }
+ g_free (sql);
+}
+
static void
persona_carica_nodi (Persona *persona)
{
" FROM persona_nodi AS pu INNER JOIN nodi AS u ON pu.id_nodi = u.id"
" INNER JOIN tipi_nodo AS tn ON u.id_tipi_nodo = tn.id"
" WHERE pu.id_persone = %d"
- " AND pu.status <> 'E'",
+ " AND pu.status <> 'E'"
+ " ORDER BY pu.da_data, pu.a_data, tn.nome, u.nome",
priv->id);
dm = gdaex_query (priv->commons->gdaex, sql);
if (dm != NULL)
" FROM persona_uffici AS pu INNER JOIN uffici AS u ON"
" pu.id_uffici = u.id"
" WHERE pu.id_persone = %d"
- " AND pu.status <> 'E'",
+ " AND pu.status <> 'E'"
+ " ORDER BY pu.da_data, pu.a_data, u.nome",
priv->id);
dm = gdaex_query (priv->commons->gdaex, sql);
if (dm != NULL)
g_free (sql);
}
+static void
+persona_incarico_modifica (Persona *persona)
+{
+ GtkTreeIter iter;
+ GtkWidget *dialog;
+
+ PersonaPrivate *priv = PERSONA_GET_PRIVATE (persona);
+
+ if (gtk_tree_selection_get_selected (priv->sel_incarichi, NULL, &iter))
+ {
+ guint id;
+ GtkWidget *w;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->objects[LSTORE_INCARICHI]), &iter,
+ INCARICHI_COL_ID, &id,
+ -1);
+
+ PersonaIncarico *a = persona_incarico_new (priv->commons, id, 0);
+
+ g_signal_connect (G_OBJECT (a), "aggiornato",
+ G_CALLBACK (persona_on_incarico_aggiornato), (gpointer)persona);
+
+ w = persona_incarico_get_widget (a);
+ gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+ gtk_widget_show (w);
+ }
+ else
+ {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare un incarico.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+}
+
static void
persona_nodo_modifica (Persona *persona)
{
}
/* CALLBACK */
+static void
+persona_on_incarico_aggiornato (gpointer instance, gpointer user_data)
+{
+ Persona *persona = (Persona *)user_data;
+ PersonaClass *klass = PERSONA_GET_CLASS (persona);
+
+ persona_carica_incarichi (persona);
+}
+
static void
persona_on_nodo_aggiornato (gpointer instance, gpointer user_data)
{
return !persona_conferma_chiusura ((Persona *)user_data);
}
+static void
+persona_on_btn_incarico_nuovo_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkWidget *w;
+
+ Persona *persona = (Persona *)user_data;
+
+ PersonaPrivate *priv = PERSONA_GET_PRIVATE (persona);
+
+ PersonaIncarico *a = persona_incarico_new (priv->commons, 0, priv->id);
+
+ g_signal_connect (G_OBJECT (a), "aggiornato",
+ G_CALLBACK (persona_on_incarico_aggiornato), (gpointer)persona);
+
+ w = persona_incarico_get_widget (a);
+ gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+ gtk_widget_show (w);
+}
+
+static void
+persona_on_btn_incarico_modifica_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ persona_incarico_modifica ((Persona *)user_data);
+}
+
+static void
+persona_on_btn_incarico_elimina_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkTreeIter iter;
+ GtkWidget *dialog;
+ guint risp;
+
+ Persona *persona = (Persona *)user_data;
+
+ PersonaClass *klass = PERSONA_GET_CLASS (persona);
+ PersonaPrivate *priv = PERSONA_GET_PRIVATE (persona);
+
+ if (gtk_tree_selection_get_selected (priv->sel_incarichi, NULL, &iter))
+ {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ "Sicuro di voler eliminare l'incarico selezionato?");
+ risp = gtk_dialog_run (GTK_DIALOG (dialog));
+ if (risp == GTK_RESPONSE_YES)
+ {
+ guint id;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->objects[LSTORE_INCARICHI]), &iter,
+ INCARICHI_COL_ID, &id,
+ -1);
+
+ gdaex_execute (priv->commons->gdaex,
+ g_strdup_printf ("UPDATE persona_incarichi"
+ " SET status = 'E'"
+ " WHERE id = %d",
+ id));
+
+ persona_carica_incarichi (persona);
+ }
+ gtk_widget_destroy (dialog);
+ }
+ else
+ {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare un incarico.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+}
+
+static void
+persona_on_trv_incarichi_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *tree_path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
+{
+ persona_incarico_modifica ((Persona *)user_data);
+}
+
static void
persona_on_btn_nodo_nuovo_clicked (GtkButton *button,
gpointer user_data)
--- /dev/null
+/*
+ * Copyright (C) 2009 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
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
+#include <libgtkform/form.h>
+
+#include "personaincarico.h"
+#include "nodi.h"
+
+static void persona_incarico_class_init (PersonaIncaricoClass *klass);
+static void persona_incarico_init (PersonaIncarico *persona_incarico);
+
+static void persona_incarico_carica (PersonaIncarico *persona_incarico);
+static void persona_incarico_salva (PersonaIncarico *persona_incarico);
+
+static gboolean persona_incarico_conferma_chiusura (PersonaIncarico *persona_incarico);
+
+static void persona_incarico_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void persona_incarico_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static gboolean persona_incarico_on_w_persona_incarico_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data);
+
+static void persona_incarico_on_btn_annulla_clicked (GtkButton *button,
+ gpointer user_data);
+static void persona_incarico_on_btn_salva_clicked (GtkButton *button,
+ gpointer user_data);
+
+
+#define PERSONA_INCARICO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_PERSONA_INCARICO, PersonaIncaricoPrivate))
+
+enum
+{
+ LBL_ID,
+ LBL_ID_PERSONE
+};
+
+typedef struct _PersonaIncaricoPrivate PersonaIncaricoPrivate;
+struct _PersonaIncaricoPrivate
+ {
+ Commons *commons;
+
+ GtkForm *form;
+
+ GtkWidget *w;
+
+ GObject **objects;
+
+ guint id;
+ };
+
+G_DEFINE_TYPE (PersonaIncarico, persona_incarico, G_TYPE_OBJECT)
+
+static void
+persona_incarico_class_init (PersonaIncaricoClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (PersonaIncaricoPrivate));
+
+ object_class->set_property = persona_incarico_set_property;
+ object_class->get_property = persona_incarico_get_property;
+
+ /**
+ * PersonaIncarico::aggiornato:
+ * @persona_incarico:
+ *
+ */
+ 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
+persona_incarico_init (PersonaIncarico *persona_incarico)
+{
+ PersonaIncaricoPrivate *priv = PERSONA_INCARICO_GET_PRIVATE (persona_incarico);
+}
+
+/**
+ * persona_incarico_new:
+ * @commons:
+ * @id:
+ * @id_persone:
+ *
+ * Returns: the newly created #PersonaIncarico object.
+ */
+PersonaIncarico
+*persona_incarico_new (Commons *commons, guint id, guint id_persone)
+{
+ GError *error;
+
+ PersonaIncarico *a = PERSONA_INCARICO (g_object_new (persona_incarico_get_type (), NULL));
+
+ PersonaIncaricoPrivate *priv = PERSONA_INCARICO_GET_PRIVATE (a);
+
+ priv->commons = commons;
+
+ error = NULL;
+
+ gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
+ g_strsplit (
+ "lstore_tipi_rapporto_lavoro"
+ "|lstore_posizioni_economiche"
+ "|lstore_tipi_prestazione"
+ "|lstore_profili_professionali"
+ "|w_persona_incarico", "|", -1),
+ &error);
+ if (error != NULL)
+ {
+ g_fprintf (stderr, "Errore: %s\n", error->message);
+ return NULL;
+ }
+
+ priv->form = gtk_form_new ();
+ g_object_set (G_OBJECT (priv->form), "gdaex", priv->commons->gdaex, NULL);
+ gtk_form_load_from_file (priv->form, g_build_filename (priv->commons->formdir, "persona_incarico.form", NULL), priv->commons->gtkbuilder);
+
+ priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_persona_incarico"));
+
+ priv->objects = gtk_form_get_objects_by_name (priv->form,
+ "label129",
+ "label130",
+ NULL);
+
+ g_signal_connect (priv->w,
+ "delete-event", G_CALLBACK (persona_incarico_on_w_persona_incarico_delete_event), (gpointer *)a);
+
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button98")),
+ "clicked", G_CALLBACK (persona_incarico_on_btn_annulla_clicked), (gpointer *)a);
+ g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button99")),
+ "clicked", G_CALLBACK (persona_incarico_on_btn_salva_clicked), (gpointer *)a);
+
+ 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_PERSONE]), g_strdup_printf ("%d", id_persone));
+
+ gtk_form_set_as_origin (priv->form);
+ }
+ else
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), g_strdup_printf ("%d", priv->id));
+
+ persona_incarico_carica (a);
+ }
+
+ return a;
+}
+
+/**
+ * persona_incarico_get_widget:
+ * @persona_incarico:
+ *
+ */
+GtkWidget
+*persona_incarico_get_widget (PersonaIncarico *persona_incarico)
+{
+ PersonaIncaricoPrivate *priv = PERSONA_INCARICO_GET_PRIVATE (persona_incarico);
+
+ return priv->w;
+}
+
+/* PRIVATE */
+static void
+persona_incarico_carica (PersonaIncarico *persona_incarico)
+{
+ gchar *sql;
+ GdaDataModel *dm;
+
+ PersonaIncaricoPrivate *priv = PERSONA_INCARICO_GET_PRIVATE (persona_incarico);
+
+ if (gtk_form_fill_from_table (priv->form))
+ {
+ }
+}
+
+static void
+persona_incarico_salva (PersonaIncarico *persona_incarico)
+{
+ gchar *sql;
+ GtkWidget *dialog;
+
+ PersonaIncaricoClass *klass = PERSONA_INCARICO_GET_CLASS (persona_incarico);
+
+ PersonaIncaricoPrivate *priv = PERSONA_INCARICO_GET_PRIVATE (persona_incarico);
+
+ if (!gtk_form_check (priv->form, FALSE, 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_signal_emit (persona_incarico, klass->aggiornato_signal_id, 0);
+
+ if (priv->id == 0)
+ {
+ priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
+ }
+
+ gtk_form_set_as_origin (priv->form);
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ "Salvataggio eseguito con successo.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+ else
+ {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Errore durante il salvataggio.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+}
+
+static void
+persona_incarico_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ PersonaIncarico *persona_incarico = PERSONA_INCARICO (object);
+
+ PersonaIncaricoPrivate *priv = PERSONA_INCARICO_GET_PRIVATE (persona_incarico);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+persona_incarico_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ PersonaIncarico *persona_incarico = PERSONA_INCARICO (object);
+
+ PersonaIncaricoPrivate *priv = PERSONA_INCARICO_GET_PRIVATE (persona_incarico);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static gboolean
+persona_incarico_conferma_chiusura (PersonaIncarico *persona_incarico)
+{
+ GtkWidget *dialog;
+
+ gboolean ret;
+
+ PersonaIncaricoPrivate *priv = PERSONA_INCARICO_GET_PRIVATE (persona_incarico);
+
+ ret = TRUE;
+
+ if (gtk_form_is_changed (priv->form))
+ {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ "Sicuro di voler chiudere senza salvare?");
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_NO)
+ {
+ ret = FALSE;
+ }
+ gtk_widget_destroy (dialog);
+ }
+
+ return ret;
+}
+
+/* CALLBACK */
+static gboolean
+persona_incarico_on_w_persona_incarico_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ return !persona_incarico_conferma_chiusura ((PersonaIncarico *)user_data);
+}
+
+static void
+persona_incarico_on_btn_annulla_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ PersonaIncarico *persona_incarico = (PersonaIncarico *)user_data;
+
+ PersonaIncaricoPrivate *priv = PERSONA_INCARICO_GET_PRIVATE (persona_incarico);
+
+ if (persona_incarico_conferma_chiusura (persona_incarico)) gtk_widget_destroy (priv->w);
+}
+
+static void
+persona_incarico_on_btn_salva_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ persona_incarico_salva ((PersonaIncarico *)user_data);
+}
--- /dev/null
+/*
+ * Copyright (C) 2009 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 __PERSONA_INCARICO_H__
+#define __PERSONA_INCARICO_H__
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+#include "commons.h"
+
+G_BEGIN_DECLS
+
+
+#define TYPE_PERSONA_INCARICO (persona_incarico_get_type ())
+#define PERSONA_INCARICO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PERSONA_INCARICO, PersonaIncarico))
+#define PERSONA_INCARICO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PERSONA_INCARICO, PersonaIncaricoClass))
+#define IS_PERSONA_INCARICO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PERSONA_INCARICO))
+#define IS_PERSONA_INCARICO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PERSONA_INCARICO))
+#define PERSONA_INCARICO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PERSONA_INCARICO, PersonaIncaricoClass))
+
+
+typedef struct _PersonaIncarico PersonaIncarico;
+typedef struct _PersonaIncaricoClass PersonaIncaricoClass;
+
+struct _PersonaIncarico
+ {
+ GObject parent;
+ };
+
+struct _PersonaIncaricoClass
+ {
+ GObjectClass parent_class;
+
+ guint aggiornato_signal_id;
+ };
+
+GType persona_incarico_get_type (void) G_GNUC_CONST;
+
+PersonaIncarico *persona_incarico_new (Commons *commons, guint id, guint id_persone);
+
+GtkWidget *persona_incarico_get_widget (PersonaIncarico *persona_incarico);
+
+
+G_END_DECLS
+
+#endif /* __PERSONA_INCARICO_H__ */