<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<requires lib="gtkformui" version="0.0"/>
<property name="type_hint">normal</property>
<property name="program_name">Territorio</property>
<property name="version">0.0.3</property>
- <property name="copyright" translatable="yes">Andrea Zagli <azagli@libero.it> 2010-2018</property>
+ <property name="copyright" translatable="yes">Andrea Zagli <azagli@libero.it> 2010-2019</property>
<property name="authors">Andrea Zagli <azagli@libero.it></property>
<property name="logo_icon_name">image-missing</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="visible">True</property>
</child>
</object>
</child>
- <child>
- <placeholder/>
- </child>
</object>
<object class="GtkListStore" id="lstore_aggregazioni_territoriali">
<columns>
<property name="default_width">550</property>
<property name="default_height">400</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox12">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkListStore" id="lstore_province">
<columns>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox13">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkListStore" id="lstore_vie">
<columns>
<property name="default_width">550</property>
<property name="default_height">400</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox14">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_comune">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox9">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_comuni">
<property name="can_focus">False</property>
<property name="default_width">550</property>
<property name="default_height">400</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox8">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_main">
<property name="can_focus">False</property>
<property name="default_width">600</property>
<property name="default_height">400</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox1">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_province">
<property name="can_focus">False</property>
<property name="default_width">550</property>
<property name="default_height">400</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox6">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_provincia">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox7">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_regione">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox5">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_regioni">
<property name="can_focus">False</property>
<property name="default_width">550</property>
<property name="default_height">400</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox4">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_ricerca_comuni">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox17">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_ricerca_province">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox16">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_ricerca_vie">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox18">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_stati">
<property name="can_focus">False</property>
<property name="default_width">550</property>
<property name="default_height">400</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox2">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_stati_qe">
<property name="can_focus">False</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">550</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox19">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_stato">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox3">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_tipi_aggregazione_territoriale">
<property name="can_focus">False</property>
<property name="default_width">550</property>
<property name="default_height">400</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox10">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_tipo_aggregazione_territoriale">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox11">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_via">
<property name="can_focus">False</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="destroy_with_parent">True</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkBox" id="vbox15">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
<object class="GtkWindow" id="w_widget">
<property name="can_focus">False</property>
+ <child type="titlebar">
+ <placeholder/>
+ </child>
<child>
<object class="GtkGrid" id="table11">
<property name="visible">True</property>
</child>
</object>
</child>
- <child type="titlebar">
- <placeholder/>
- </child>
</object>
</interface>
/*
- * Copyright (C) 2010-2018 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2019 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
*
*/
-#include <libgtkform/form.h>
+#include <libzakform/libzakform.h>
+#include <libzakformgtk/libzakformgtk.h>
+#include <libzakformgdaex/libzakformgdaex.h>
#include <libzakautho/autho.h>
#include <libsolipa/libsolipa.h>
{
TerritorioCommons *commons;
- GtkForm *form;
+ ZakFormGtkForm *form;
+ ZakFormGdaexProvider *form_provider;
GtkWidget *w;
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, "tipo_aggregazione_territoriale.form", NULL), priv->commons->gtkbuilder);
+ priv->form = zak_form_gtk_form_new ();
+ zak_form_gtk_form_set_gtkbuilder (priv->form, priv->commons->gtkbuilder);
+ zak_form_form_load_from_file (ZAK_FORM_FORM (priv->form), g_build_filename (priv->commons->formdir, "tipo_aggregazione_territoriale.form", NULL));
+
+ priv->form_provider = zak_form_gdaex_provider_new (priv->commons->gdaex, "tipi_aggregazione_territoriale");
priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_tipo_aggregazione_territoriale"));
- priv->objects = gtk_form_get_objects_by_name (priv->form,
+ priv->objects = zak_form_gtk_form_get_gobjects_by_name (priv->form,
"label28",
NULL);
g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button77"),
"clicked", G_CALLBACK (territorio_tipo_aggregazione_territoriale_on_btn_salva_chiudi_clicked), (gpointer)a);
- priv->id = id;
+ zak_form_form_clear (ZAK_FORM_FORM (priv->form));
+ priv->id = id;
if (priv->id == 0)
{
gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
- gtk_form_set_as_origin (priv->form);
+ zak_form_form_set_as_original (ZAK_FORM_FORM (priv->form));
}
else
{
{
TerritorioTipoAggregazioneTerritorialePrivate *priv = TERRITORIO_TIPO_AGGREGAZIONE_TERRITORIALE_GET_PRIVATE (territorio_tipo_aggregazione_territoriale);
- if (gtk_form_fill_from_table (priv->form))
+ if (zak_form_form_load (ZAK_FORM_FORM (priv->form), ZAK_FORM_IPROVIDER (priv->form_provider)))
{
}
}
static void
territorio_tipo_aggregazione_territoriale_salva (TerritorioTipoAggregazioneTerritoriale *territorio_tipo_aggregazione_territoriale, gboolean chiudi)
{
- gchar *sql;
+ gboolean success;
TerritorioTipoAggregazioneTerritorialeClass *klass = TERRITORIO_TIPO_AGGREGAZIONE_TERRITORIALE_GET_CLASS (territorio_tipo_aggregazione_territoriale);
TerritorioTipoAggregazioneTerritorialePrivate *priv = TERRITORIO_TIPO_AGGREGAZIONE_TERRITORIALE_GET_PRIVATE (territorio_tipo_aggregazione_territoriale);
- if (!gtk_form_check (priv->form, (priv->id != 0), NULL, TRUE, priv->w, TRUE))
+ if (!zak_form_gtk_form_is_valid (priv->form, priv->w))
{
return;
}
+ success = FALSE;
+
if (priv->id == 0)
{
- sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_INSERT);
+ guint new_id;
+
+ new_id = gdaex_get_new_id (priv->commons->gdaex,
+ "tipi_aggregazione_territoriale",
+ "id",
+ NULL);
+
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), g_strdup_printf ("%d", new_id));
+
+ success = zak_form_form_insert (ZAK_FORM_FORM (priv->form), ZAK_FORM_IPROVIDER (priv->form_provider));
}
else
{
- sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_UPDATE);
+ success = zak_form_form_update (ZAK_FORM_FORM (priv->form), ZAK_FORM_IPROVIDER (priv->form_provider));
}
- if (gdaex_execute (priv->commons->gdaex, sql) == 1)
+ if (success)
{
g_signal_emit (territorio_tipo_aggregazione_territoriale, klass->aggiornato_signal_id, 0);
- gtk_form_set_as_origin (priv->form);
+ zak_form_form_set_as_original (ZAK_FORM_FORM (priv->form));
if (priv->id == 0)
{
ret = TRUE;
if (gtk_widget_get_sensitive (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "button35")))
- && gtk_form_is_changed (priv->form))
+ && zak_form_form_is_changed (ZAK_FORM_FORM (priv->form)))
{
if (solipa_message_dialog (priv->w,
GTK_MESSAGE_QUESTION,