<?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>
<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">
#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"
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,
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);
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);
}
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);
}
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);
}
}
/* 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)
{
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,