From: Andrea Zagli Date: Sat, 21 Dec 2019 09:55:01 +0000 (+0100) Subject: Migrato il form tipo_aggregazione_territoriale a zakform. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=d899c91d882033b3c4ccf4365d13d6789a4ee01c;p=solipa%2Fterritorio Migrato il form tipo_aggregazione_territoriale a zakform. --- diff --git a/data/territorio/form/tipo_aggregazione_territoriale.form b/data/territorio/form/tipo_aggregazione_territoriale.form index 4d08478..9b5fe43 100644 --- a/data/territorio/form/tipo_aggregazione_territoriale.form +++ b/data/territorio/form/tipo_aggregazione_territoriale.form @@ -1,19 +1,18 @@ - - - tipi_aggregazione_territoriale
- - - - t - t - - - - - - t - - - -
+ + + id + integer + + TRUE + label28 + + + + nome + string + + entry13 + + + diff --git a/data/territorio/gui/territorio.gui b/data/territorio/gui/territorio.gui index df456b3..46b0e00 100644 --- a/data/territorio/gui/territorio.gui +++ b/data/territorio/gui/territorio.gui @@ -1,5 +1,5 @@ - + @@ -13,9 +13,12 @@ normal Territorio 0.0.3 - Andrea Zagli <azagli@libero.it> 2010-2018 + Andrea Zagli <azagli@libero.it> 2010-2019 Andrea Zagli <azagli@libero.it> image-missing + + + True @@ -40,9 +43,6 @@ - - - @@ -62,6 +62,9 @@ 550 400 True + + + True @@ -240,9 +243,6 @@ - - - @@ -270,6 +270,9 @@ True center-on-parent True + + + True @@ -430,9 +433,6 @@ - - - @@ -458,6 +458,9 @@ 550 400 True + + + True @@ -679,9 +682,6 @@ - - - False @@ -689,6 +689,9 @@ True center-on-parent True + + + True @@ -926,9 +929,6 @@ - - - False @@ -938,6 +938,9 @@ 550 400 True + + + True @@ -1078,9 +1081,6 @@ - - - False @@ -1089,6 +1089,9 @@ 600 400 + + + True @@ -1355,9 +1358,6 @@ - - - False @@ -1367,6 +1367,9 @@ 550 400 True + + + True @@ -1507,9 +1510,6 @@ - - - False @@ -1517,6 +1517,9 @@ True center-on-parent True + + + True @@ -1728,9 +1731,6 @@ - - - False @@ -1738,6 +1738,9 @@ True center-on-parent True + + + True @@ -1896,9 +1899,6 @@ - - - False @@ -1908,6 +1908,9 @@ 550 400 True + + + True @@ -2033,9 +2036,6 @@ - - - False @@ -2043,6 +2043,9 @@ True center-on-parent True + + + True @@ -2193,9 +2196,6 @@ - - - False @@ -2203,6 +2203,9 @@ True center-on-parent True + + + True @@ -2338,9 +2341,6 @@ - - - False @@ -2348,6 +2348,9 @@ True center-on-parent True + + + True @@ -2513,9 +2516,6 @@ - - - False @@ -2525,6 +2525,9 @@ 550 400 True + + + True @@ -2679,9 +2682,6 @@ - - - False @@ -2690,6 +2690,9 @@ center-on-parent 550 True + + + True @@ -2755,9 +2758,6 @@ - - - False @@ -2765,6 +2765,9 @@ True center-on-parent True + + + True @@ -3003,9 +3006,6 @@ - - - False @@ -3015,6 +3015,9 @@ 550 400 True + + + True @@ -3140,9 +3143,6 @@ - - - False @@ -3150,6 +3150,9 @@ True center-on-parent True + + + True @@ -3281,9 +3284,6 @@ - - - False @@ -3291,6 +3291,9 @@ True center-on-parent True + + + True @@ -3475,12 +3478,12 @@ - - - False + + + True @@ -3620,8 +3623,5 @@ - - - diff --git a/src/tipoaggregazioneterritoriale.c b/src/tipoaggregazioneterritoriale.c index ee525b6..f42e2bf 100644 --- a/src/tipoaggregazioneterritoriale.c +++ b/src/tipoaggregazioneterritoriale.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2018 Andrea Zagli + * Copyright (C) 2010-2019 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,7 +17,9 @@ * */ -#include +#include +#include +#include #include #include @@ -63,7 +65,8 @@ struct _TerritorioTipoAggregazioneTerritorialePrivate { TerritorioCommons *commons; - GtkForm *form; + ZakFormGtkForm *form; + ZakFormGdaexProvider *form_provider; GtkWidget *w; @@ -135,13 +138,15 @@ TerritorioTipoAggregazioneTerritoriale 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); @@ -155,13 +160,14 @@ TerritorioTipoAggregazioneTerritoriale 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 { @@ -197,7 +203,7 @@ territorio_tipo_aggregazione_territoriale_carica (TerritorioTipoAggregazioneTerr { 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))) { } } @@ -205,31 +211,42 @@ territorio_tipo_aggregazione_territoriale_carica (TerritorioTipoAggregazioneTerr 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) { @@ -298,7 +315,7 @@ territorio_tipo_aggregazione_territoriale_conferma_chiusura (TerritorioTipoAggre 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,