]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Merge branch 'zakform' into develop
authorAndrea Zagli <azagli@libero.it>
Sat, 2 Dec 2017 11:38:42 +0000 (12:38 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 2 Dec 2017 11:38:42 +0000 (12:38 +0100)
27 files changed:
1  2 
configure.ac
data/organigramma/form/persona.form
data/organigramma/gui/organigramma.gui
liborganigramma.pc.in
src/nodo.c
src/persona.c
src/personaincarico.c
src/personanodo.c
src/personanodorecapito.c
src/personarecapito.c
src/personaufficio.c
src/personaufficiorecapito.c
src/posizioneeconomica.c
src/profiloprofessionale.c
src/struttura.c
src/strutturaallegato.c
src/strutturacollegamento.c
src/tiponodo.c
src/tipoprestazione.c
src/tiporapportolavoro.c
src/ufficio.c
src/ufficioallegato.c
src/ufficiocollegamento.c
src/ufficionodo.c
src/ufficioorario.c
src/ufficiorecapito.c
src/ufficiostanza.c

diff --cc configure.ac
index 6300c9175258da2b7f42d0373a59d85a25f8b26f,0f1fb0f418572738d992c1c0fd01be3d5adb50e7..b94eaf66c2a1bc1ddc2ee6a789e983bdd15ee4f2
@@@ -46,8 -46,12 +46,10 @@@ PKG_CHECK_MODULES(ORGANIGRAMMA, [gio-2.
                                   gtk+-3.0 >= 3.0
                                   libzakutils
                                   libgdaexgrid
--                                 libgtkform >= 0.5.0
--                                 libgtkformui >= 0.5.0
+                                  libzakform
+                                  libzakformgtk
+                                  libzakformgdaex
+                                  libzakformgtkdecoder
                                   libzakconfi >= 0.10.0
                                   libzakauthe >= 0.5.99
                                   libzakautho >= 0.0.5
index 50999e314991bd0a3645431231c95c0bd2c04476,170afd2b42194c4939f9833f70239d704dea7b85..8f5efb1c7e614d080723dd034aba58208f8af40a
@@@ -1,77 -1,75 +1,68 @@@
  <?xml version="1.0"?>
- <gtkform>
-       <table>persone</table>
-       <widget type="label" name="label67" label="label68">
-               <field type="integer" name="id">
-                       <is-key>t</is-key>
-                       <auto-increment>t</auto-increment>
-               </field>
-       </widget>
-       <widget type="entry" name="entry14" label="label65">
-               <field type="text" name="nome" />
-       </widget>
-       <widget type="entry" name="entry17" label="label72">
-               <field type="text" name="cognome">
-                       <obligatory>t</obligatory>
-               </field>
-       </widget>
-       <widget type="decoder" name="gtkformdecoder24" label="label73">
-               <decoder>
-                       <sql>
-                               SELECT a.descrizione
-                               FROM titoli AS a
-                               WHERE a.id = ##key0::gint
-                       </sql>
-               </decoder>
-               <field type="integer" name="id_titoli">
-               </field>
-       </widget>
-       <widget type="entry" name="entry20" label="label84">
-               <field type="datetime" name="data_nascita">
-                       <datetime-type>date</datetime-type>
-                       <display-format>%d/%m/%Y</display-format>
-               </field>
-       </widget>
-       <widget type="entry" name="entry26" label="label108">
-               <field type="text" name="indirizzo"/>
-       </widget>
-       <widget type="entry" name="entry27">
-               <field type="text" name="citta">
-                       <to-load>f</to-load>
-                       <to-save>f</to-save>
-               </field>
-       </widget>
-       <widget type="label" name="label110" label="label109">
-               <on-change what="update" when="after">
-                       <widget-name>entry27</widget-name>
-                       <connection-name>territorio</connection-name>
-                       <sql>
-                               SELECT c.nome FROM comuni AS c WHERE c.id = ##label110::gint
-                       </sql>
-               </on-change>
-               <field type="integer" name="id_citta">
-               </field>
-       </widget>
-       <widget type="entry" name="entry29" label="label112">
-               <field type="text" name="cap"/>
-       </widget>
-       <widget type="entry" name="entry28" label="label111">
-               <field type="text" name="codice_fiscale"/>
-       </widget>
-       <widget type="textview" name="textview8" label="label66">
-               <field type="text" name="descrizione" />
-       </widget>
- </gtkform>
+ <zakform>
+   <element type="zak_form_gtk_form_element_label">
+     <name>id</name>
+     <type>integer</type>
+     <label>label68</label>
+     <is-key>TRUE</is-key>
+     <widget>label67</widget>
+   </element>
+   <element type="zak_form_gtk_form_element_entry">
+     <name>nome</name>
+     <type>string</type>
+     <label>label65</label>
+     <widget>entry14</widget>
+   </element>
+   <element type="zak_form_gtk_form_element_entry">
+     <name>cognome</name>
+     <type>string</type>
+     <label>label72</label>
+     <widget>entry17</widget>
+     <validator type="zak_form_element_validator_notempty"/>
+   </element>
 -  <element type="">
++  <element type="zak_form_gtk_form_element_decoder">
+     <name>id_titoli</name>
+     <type>integer</type>
+     <label>label73</label>
 -    <widget>gtkformdecoder24</widget>
++    <widget>zakgtkdecoder17</widget>
+   </element>
+   <element type="zak_form_gtk_form_element_entry">
+     <name>data_nascita</name>
+     <type>datetime</type>
+     <label>label84</label>
+     <widget>entry20</widget>
+     <format>%d/%m/%Y</format>
+     <validator type="zak_form_element_validator_date">%d/%m/%Y</validator>
+   </element>
+   <element type="zak_form_gtk_form_element_entry">
+     <name>indirizzo</name>
+     <type>string</type>
+     <label>label108</label>
+     <widget>entry26</widget>
+   </element>
 -  <element type="zak_form_gtk_form_element_entry">
 -    <name>citta</name>
 -    <type>string</type>
 -    <to-load>FALSE</to-load>
 -    <to-save>FALSE</to-save>
 -    <widget>entry27</widget>
 -  </element>
 -  <element type="zak_form_gtk_form_element_label">
++  <element type="zak_form_gtk_form_element_decoder">
+     <name>id_citta</name>
+     <type>integer</type>
+     <label>label109</label>
 -    <widget>label110</widget>
++    <widget>zakgtkdecoder18</widget>
+   </element>
+   <element type="zak_form_gtk_form_element_entry">
+     <name>cap</name>
+     <type>string</type>
+     <label>label112</label>
+     <widget>entry29</widget>
+   </element>
+   <element type="zak_form_gtk_form_element_entry">
+     <name>codice_fiscale</name>
+     <type>string</type>
+     <label>label111</label>
+     <widget>entry28</widget>
+     <validator type="solipa_zak_form_element_validator_codfisc"/>
+   </element>
+   <element type="zak_form_gtk_form_element_textview">
+     <name>descrizione</name>
+     <type>string</type>
+     <label>label66</label>
+     <widget>textview8</widget>
+   </element>
+ </zakform>
index 8b60a18a8bc47701361e8e4e8c6adb884cd2de08,aff230653922940d90c885527b0856f18a8140a0..9175dd2cfb75be2f3ba80828a85b2ea4eb0df61b
                          <property name="top_attach">0</property>
                        </packing>
                      </child>
--                    <child>
--                      <object class="GtkBox" id="hbox17">
--                        <property name="visible">True</property>
--                        <property name="can_focus">False</property>
--                        <property name="hexpand">True</property>
--                        <property name="spacing">5</property>
--                        <child>
--                          <object class="GtkEntry" id="entry27">
--                            <property name="visible">True</property>
--                            <property name="can_focus">True</property>
--                            <property name="hexpand">True</property>
--                            <property name="editable">False</property>
--                            <property name="invisible_char">●</property>
--                            <property name="primary_icon_activatable">False</property>
--                            <property name="secondary_icon_activatable">False</property>
--                          </object>
--                          <packing>
--                            <property name="expand">True</property>
--                            <property name="fill">True</property>
--                            <property name="position">0</property>
--                          </packing>
--                        </child>
--                        <child>
--                          <object class="GtkButton" id="button89">
--                            <property name="label" translatable="yes">...</property>
--                            <property name="visible">True</property>
--                            <property name="can_focus">True</property>
--                            <property name="receives_default">True</property>
--                          </object>
--                          <packing>
--                            <property name="expand">False</property>
--                            <property name="fill">True</property>
--                            <property name="position">1</property>
--                          </packing>
--                        </child>
--                        <child>
--                          <object class="GtkLabel" id="label110">
--                            <property name="can_focus">False</property>
--                            <property name="label" translatable="yes">lbl_id_citta</property>
--                          </object>
--                          <packing>
--                            <property name="expand">False</property>
--                            <property name="fill">True</property>
--                            <property name="position">2</property>
--                          </packing>
--                        </child>
--                      </object>
--                      <packing>
--                        <property name="left_attach">1</property>
--                        <property name="top_attach">1</property>
--                      </packing>
--                    </child>
                      <child>
                        <object class="GtkEntry" id="entry29">
                          <property name="visible">True</property>
                          <property name="top_attach">2</property>
                        </packing>
                      </child>
++                    <child>
++                      <object class="ZakGtkDecoder" id="zakgtkdecoder18">
++                        <property name="visible">True</property>
++                        <property name="can_focus">False</property>
++                      </object>
++                      <packing>
++                        <property name="left_attach">1</property>
++                        <property name="top_attach">1</property>
++                      </packing>
++                    </child>
                    </object>
                  </child>
                  <child type="label">
index 7e9982adb2d1cfbc256786773c824bdf73f78be5,17265fd1595a8250a65b5524b0a85f7694873f28..aae95adb5d702a8f29e34e0235d0b9f1f8fb11eb
@@@ -6,6 -6,6 +6,6 @@@ includedir=@includedir
  Name: @PACKAGE_NAME@
  Description: Libreria con l'interfaccia per la gestione dell'organigramma.
  Version: @PACKAGE_VERSION@
- Requires: libgdaex >= 0.5.0 libgtkform >= 0.5.0 libgtkformui >= 0.5.0 libzakauthe libzakautho >= 0.0.5 libsolipa >= 0.5.0 libterritorio libpq
 -Requires: libzakutils libgdaex >= 0.5.0 libgtkform >= 0.5.0 libgtkformui >= 0.5.0 libzakform libzakformgtk libzakformgdaex libzakformgtkdecoder libzakconfi libzakauthe libzakautho >= 0.0.5 libsolipa >= 0.5.0 libterritorio libpq
++Requires: libzakutils libgdaex >= 0.5.0 libzakform libzakformgtk libzakformgdaex libzakformgtkdecoder libzakconfi libzakauthe libzakautho >= 0.0.5 libsolipa >= 0.5.0 libterritorio libpq
  Libs: -L${libdir} -lorganigramma
  Cflags: -I${includedir}
diff --cc src/nodo.c
Simple merge
diff --cc src/persona.c
index 6451cf33c43e61684d354fddf53ebd2da0625e50,c0da1123fda19f8bd765c73b653feb9417ab188a..8e958b3136c02dd2fb309f86402a02b877718bd3
  #endif
  
  #include <libzakautho/autho.h>
- #include <libgtkform/form.h>
- #include <libgtkform/fielddatetime.h>
- #include <libgtkformui/gtkformdecoder.h>
+ #include <libzakgtkdecoder/libzakgtkdecoder.h>
+ #include <libzakform/libzakform.h>
+ #include <libzakformgtk/libzakformgtk.h>
+ #include <libzakformgdaex/libzakformgdaex.h>
+ #include <libzakformgtkdecoder/libzakformgtkdecoder.h>
  #include <libsolipa/utils.h>
++#include <libzakutils/datetime.h>
  
  #include <libterritorio/comuni.h>
++#include <libterritorio/comune.h>
  
  #include "persona.h"
  #include "personaincarico.h"
@@@ -77,7 -79,8 +81,9 @@@ static void organigramma_persona_on_uff
  static void organigramma_persona_on_recapito_aggiornato (gpointer instance, gpointer user_data);
  
  static void organigramma_persona_on_titolo_selezionato (gpointer instance, guint id, gpointer user_data);
+ static gchar *organigramma_persona_on_titolo_decode (gpointer instance, gchar *key, gpointer user_data);
  static void organigramma_persona_on_comune_selezionato (gpointer instance, guint id, gpointer user_data);
++static gchar *organigramma_persona_on_comune_decode (gpointer instance, gchar *key, gpointer user_data);
  
  static gboolean organigramma_persona_on_w_organigramma_persona_delete_event (GtkWidget *widget,
                                 GdkEvent *event,
@@@ -348,10 -353,13 +356,15 @@@ OrganigrammaPerson
        g_signal_connect (priv->sel_uffici,
                          "changed", G_CALLBACK (organigramma_persona_on_uffici_sel_changed), (gpointer)a);
  
-       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "gtkformdecoder24"),
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "zakgtkdecoder17"),
                          "btn-browse-clicked", G_CALLBACK (organigramma_persona_on_btn_ricerca_titolo_clicked), (gpointer)a);
-       g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button89")),
-                         "clicked", G_CALLBACK (organigramma_persona_on_btn_ricerca_comune_clicked), (gpointer)a);
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "zakgtkdecoder17"),
+                         "decode", G_CALLBACK (organigramma_persona_on_titolo_decode), (gpointer)a);
 -      g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button89")),
 -                        "clicked", G_CALLBACK (organigramma_persona_on_btn_ricerca_comune_clicked), (gpointer)a);
++      g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "zakgtkdecoder18")),
++                        "btn-browse-clicked", G_CALLBACK (organigramma_persona_on_btn_ricerca_comune_clicked), (gpointer)a);
++      g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "zakgtkdecoder18"),
++                        "decode", G_CALLBACK (organigramma_persona_on_comune_decode), (gpointer)a);
  
        g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button79")),
                          "clicked", G_CALLBACK (organigramma_persona_on_btn_incarico_nuovo_clicked), (gpointer)a);
@@@ -604,8 -613,8 +618,8 @@@ organigramma_persona_carica_incarichi (
                                        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_DA_DATA, zak_utils_tm_format (gdaex_data_model_get_field_value_tm_at (dm, row, "da_data"), "%d/%m/%Y"),
++                                                          INCARICHI_COL_A_DATA, zak_utils_tm_format (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);
                                }
@@@ -648,8 -657,8 +662,8 @@@ organigramma_persona_carica_nodi (Organ
                                                            NODI_COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
                                                            NODI_COL_TIPO, gdaex_data_model_get_field_value_stringify_at (dm, row, "tipo_nodo"),
                                                            NODI_COL_NODO, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
--                                                          NODI_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"),
--                                                          NODI_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"),
++                                                          NODI_COL_DA_DATA, zak_utils_tm_format (gdaex_data_model_get_field_value_tm_at (dm, row, "da_data"), "%d/%m/%Y"),
++                                                          NODI_COL_A_DATA, zak_utils_tm_format (gdaex_data_model_get_field_value_tm_at (dm, row, "a_data"), "%d/%m/%Y"),
                                                            -1);
                                }
  
@@@ -744,8 -753,8 +758,8 @@@ organigramma_persona_carica_uffici (Org
                                                            UFFICI_COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
                                                            UFFICI_COL_UFFICIO, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
                                                            UFFICI_COL_RUOLO, gdaex_data_model_get_field_value_stringify_at (dm, row, "ruolo"),
--                                                          UFFICI_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"),
--                                                          UFFICI_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"),
++                                                          UFFICI_COL_DA_DATA, zak_utils_tm_format (gdaex_data_model_get_field_value_tm_at (dm, row, "da_data"), "%d/%m/%Y"),
++                                                          UFFICI_COL_A_DATA, zak_utils_tm_format (gdaex_data_model_get_field_value_tm_at (dm, row, "a_data"), "%d/%m/%Y"),
                                                            -1);
                                }
  
@@@ -1140,6 -1149,42 +1154,73 @@@ organigramma_persona_conferma_chiusura 
  }
  
  /* CALLBACK */
+ static void
+ organigramma_persona_on_titolo_selezionato (gpointer instance, guint id, gpointer user_data)
+ {
+       OrganigrammaPersona *f = (OrganigrammaPersona *)user_data;
+       OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (f);
+       zak_gtk_decoder_set_key (ZAK_GTK_DECODER (gtk_builder_get_object (priv->commons->gtkbuilder, "zakgtkdecoder17")),
+                                            g_strdup_printf ("%d", id));
+ }
+ static gchar
+ *organigramma_persona_on_titolo_decode (gpointer instance, gchar *key, gpointer user_data)
+ {
+       GString *ret;
+       gchar *sql;
+       GdaDataModel *dm;
+       OrganigrammaPersona *f = (OrganigrammaPersona *)user_data;
+       OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (f);
+       ret = g_string_new ("");
+       sql = g_strdup_printf ("SELECT descrizione"
+                                                  " FROM titoli"
+                                                  " WHERE id = %d",
+                                                  strtol (key, NULL, 10));
+       dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
+       if (!gdaex_data_model_is_empty (dm))
+               {
+                       g_string_append (ret, gdaex_data_model_get_value_stringify_at (dm, 0, 0));
+               }
+       return ret->str;
+ }
++static void
++organigramma_persona_on_comune_selezionato (gpointer instance, guint id, gpointer user_data)
++{
++      OrganigrammaPersona *f = (OrganigrammaPersona *)user_data;
++      OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (f);
++
++      zak_gtk_decoder_set_key (ZAK_GTK_DECODER (gtk_builder_get_object (priv->commons->gtkbuilder, "zakgtkdecoder18")),
++                                           g_strdup_printf ("%d", id));
++}
++
++static gchar
++*organigramma_persona_on_comune_decode (gpointer instance, gchar *key, gpointer user_data)
++{
++      GString *ret;
++      GHashTable *ht_comune;
++
++      OrganigrammaPersona *f = (OrganigrammaPersona *)user_data;
++      OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (f);
++
++      ret = g_string_new ("");
++
++      ht_comune = territorio_comune_get_by_id (priv->commons->territorio_commons, strtol (key, NULL, 10));
++
++      if (ht_comune != NULL)
++              {
++                      g_string_append (ret, g_hash_table_lookup (ht_comune, "nome"));
++              }
++
++      return ret->str;
++}
++
  static void
  organigramma_persona_on_incarico_aggiornato (gpointer instance, gpointer user_data)
  {
@@@ -1194,27 -1239,16 +1275,6 @@@ organigramma_persona_on_recapito_aggior
        organigramma_persona_carica_recapiti (persona);
  }
  
- static void
- organigramma_persona_on_titolo_selezionato (gpointer instance, guint id, gpointer user_data)
- {
-       OrganigrammaPersona *ia = (OrganigrammaPersona *)user_data;
-       OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (ia);
-       gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "gtkformdecoder24"),
-                                            g_strdup_printf ("%d", id));
- }
--static void
--organigramma_persona_on_comune_selezionato (gpointer instance, guint id, gpointer user_data)
--{
--      OrganigrammaPersona *ia = (OrganigrammaPersona *)user_data;
--
--      OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (ia);
--
--      gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label110"), g_strdup_printf ("%d", id));
--}
--
  static gboolean
  organigramma_persona_on_w_organigramma_persona_delete_event (GtkWidget *widget,
                                 GdkEvent *event,
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/struttura.c
Simple merge
Simple merge
Simple merge
diff --cc src/tiponodo.c
Simple merge
Simple merge
Simple merge
diff --cc src/ufficio.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge