]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Migrazione a solipa_message_dialog (closes #).
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Wed, 28 Nov 2012 11:57:03 +0000 (12:57 +0100)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Wed, 28 Nov 2012 11:57:03 +0000 (12:57 +0100)
35 files changed:
.project
data/organigramma/gui/organigramma.gui
src/nodi.c
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/persone.c
src/posizioneeconomica.c
src/posizionieconomiche.c
src/profiliprofessionali.c
src/profiloprofessionale.c
src/struttura.c
src/strutturaindirizzo.c
src/strutture.c
src/tipinodo.c
src/tipiprestazione.c
src/tipirapportolavoro.c
src/tipirecapito.c
src/tiponodo.c
src/tipoprestazione.c
src/tiporapportolavoro.c
src/tiporecapito.c
src/titoli.c
src/titolo.c
src/uffici.c
src/ufficio.c
src/ufficionodo.c
src/ufficioorario.c
src/ufficiorecapito.c
src/ufficiostanza.c

index b78b2d7b4699fdb8c3d83822fef26f06dbb3f84a..29a662fdfd5b977a85b9a5e03f712853f58b8aa3 100644 (file)
--- a/.project
+++ b/.project
@@ -69,7 +69,7 @@
        </natures>
        <filteredResources>
                <filter>
-                       <id>1354028400899</id>
+                       <id>1354096536862</id>
                        <name></name>
                        <type>30</type>
                        <matcher>
@@ -78,7 +78,7 @@
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400903</id>
+                       <id>1354096536867</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
@@ -87,7 +87,7 @@
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400914</id>
+                       <id>1354096536875</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
@@ -96,7 +96,7 @@
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400924</id>
+                       <id>1354096536881</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400927</id>
+                       <id>1354096536887</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400933</id>
+                       <id>1354096536890</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400939</id>
+                       <id>1354096536895</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400943</id>
+                       <id>1354096536899</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400947</id>
+                       <id>1354096536927</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400951</id>
+                       <id>1354096536930</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400954</id>
+                       <id>1354096536933</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400961</id>
+                       <id>1354096536984</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400966</id>
+                       <id>1354096536986</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400969</id>
+                       <id>1354096536989</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400974</id>
+                       <id>1354096536991</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400978</id>
+                       <id>1354096537019</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400983</id>
+                       <id>1354096537041</id>
                        <name></name>
                        <type>22</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400987</id>
+                       <id>1354096537062</id>
                        <name></name>
                        <type>30</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400991</id>
+                       <id>1354096537089</id>
                        <name></name>
                        <type>30</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400995</id>
+                       <id>1354096537110</id>
                        <name></name>
                        <type>30</type>
                        <matcher>
                        </matcher>
                </filter>
                <filter>
-                       <id>1354028400998</id>
+                       <id>1354096537133</id>
                        <name></name>
                        <type>30</type>
                        <matcher>
                                <arguments>1.0-name-matches-false-false-*~</arguments>
                        </matcher>
                </filter>
+               <filter>
+                       <id>1354096537157</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-libtool</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1354096537180</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-ltmain.sh</arguments>
+                       </matcher>
+               </filter>
        </filteredResources>
 </projectDescription>
index 541b02a5c7a8f8295d0c097d10de2e458b514b8a..bbba4b368af600059a9a713bd0996b86ecf908bd 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.16"/>
+  <requires lib="gtk+" version="2.24"/>
   <!-- interface-naming-policy project-wide -->
   <object class="GtkAdjustment" id="adj_dmon">
     <property name="upper">31</property>
     <property name="title" translatable="yes">Persona - Gestione organigramma</property>
     <property name="modal">True</property>
     <property name="window_position">center-on-parent</property>
-    <property name="default_width">500</property>
+    <property name="default_width">550</property>
     <property name="destroy_with_parent">True</property>
     <child>
       <object class="GtkVBox" id="vbox11">
index 7af0b1c860bb41e7d82da628ce03bec012661280..707b0c6ffbe51eb7e87fdf61abbab8d4f4274ec7 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "nodi.h"
 #include "nodo.h"
 
@@ -320,13 +322,10 @@ organigramma_nodi_modifica (OrganigrammaNodi *nodi)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un nodo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo");
                }
 }
 
@@ -343,7 +342,7 @@ organigramma_nodi_selezionato (OrganigrammaNodi *nodi)
                {
                        gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_nodi), &iter,
                                            COL_ID, &id,
-                                                               -1);
+                                           -1);
 
                        g_signal_emit (G_OBJECT (nodi), klass->selezionato_signal_id, 0, id);
 
@@ -352,13 +351,10 @@ organigramma_nodi_selezionato (OrganigrammaNodi *nodi)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un nodo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo");
                }
 }
 
@@ -427,9 +423,6 @@ static void
 organigramma_nodi_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        guint id;
 
@@ -438,14 +431,11 @@ organigramma_nodi_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_QUESTION,
-                                                        GTK_BUTTONS_YES_NO,
-                                                        "Sicuro di voler eliminare il nodo selezionato?\n\n"
-                                                        "ATTENZIONE: i nodi figli non saranno più visibili; se occorre, spostarli prima.");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il nodo selezionato?\n\n"
+                                                  "ATTENZIONE: i nodi figli non saranno più visibili; se occorre, spostarli prima.") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_nodi), &iter,
                                                            COL_ID, &id,
@@ -456,17 +446,13 @@ organigramma_nodi_on_btn_elimina_clicked (GtkButton *button,
 
                                        organigramma_nodi_carica (nodi);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un nodo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo");
                }
 }
 
index fe12ac61ddafc6947d299e9c36f5507fcd3ac5ba..e87e88911e603503cb8ec00c4b1d415fbcf0e731 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "nodo.h"
 #include "nodi.h"
@@ -209,12 +210,7 @@ organigramma_nodo_carica (OrganigrammaNodo *nodo)
 static void
 organigramma_nodo_salva (OrganigrammaNodo *nodo)
 {
-       GError *error = NULL;
        gchar *sql;
-       GtkWidget *dialog;
-
-       GDate *da;
-       GDate *a;
 
        OrganigrammaNodoClass *klass = ORGANIGRAMMA_NODO_GET_CLASS (nodo);
 
@@ -245,13 +241,10 @@ organigramma_nodo_salva (OrganigrammaNodo *nodo)
                                        priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -260,13 +253,10 @@ organigramma_nodo_salva (OrganigrammaNodo *nodo)
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -274,7 +264,6 @@ static void
 organigramma_nodo_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaNodo *nodo = ORGANIGRAMMA_NODO (object);
-
        OrganigrammaNodoPrivate *priv = ORGANIGRAMMA_NODO_GET_PRIVATE (nodo);
 
        switch (property_id)
@@ -289,7 +278,6 @@ static void
 organigramma_nodo_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaNodo *nodo = ORGANIGRAMMA_NODO (object);
-
        OrganigrammaNodoPrivate *priv = ORGANIGRAMMA_NODO_GET_PRIVATE (nodo);
 
        switch (property_id)
@@ -303,8 +291,6 @@ organigramma_nodo_get_property (GObject *object, guint property_id, GValue *valu
 static gboolean
 organigramma_nodo_conferma_chiusura (OrganigrammaNodo *nodo)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaNodoPrivate *priv = ORGANIGRAMMA_NODO_GET_PRIVATE (nodo);
@@ -312,16 +298,13 @@ organigramma_nodo_conferma_chiusura (OrganigrammaNodo *nodo)
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index f812ee6b0587c219ec292c3b2a2846374d2d06a6..1cb904f1ad32683818132bc34bd9593172d50931 100644 (file)
@@ -452,7 +452,6 @@ static void
 organigramma_persona_salva (OrganigrammaPersona *persona)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaClass *klass = ORGANIGRAMMA_PERSONA_GET_CLASS (persona);
 
@@ -494,13 +493,10 @@ organigramma_persona_salva (OrganigrammaPersona *persona)
                                        gtk_form_set_sensitive_by_name (priv->form, TRUE, "notebook1", NULL);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -509,13 +505,10 @@ organigramma_persona_salva (OrganigrammaPersona *persona)
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -538,6 +531,7 @@ organigramma_persona_carica_incarichi (OrganigrammaPersona *persona)
                               " ORDER BY pi.da_data, pi.a_data, pi.descrizione",
                               priv->id);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        GtkTreeIter iter;
@@ -556,7 +550,6 @@ organigramma_persona_carica_incarichi (OrganigrammaPersona *persona)
 
                        g_object_unref (dm);
                }
-       g_free (sql);
 }
 
 static void
@@ -580,6 +573,7 @@ organigramma_persona_carica_nodi (OrganigrammaPersona *persona)
                               " ORDER BY pu.da_data, pu.a_data, tn.nome, u.nome",
                               priv->id);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        GtkTreeIter iter;
@@ -599,7 +593,6 @@ organigramma_persona_carica_nodi (OrganigrammaPersona *persona)
 
                        g_object_unref (dm);
                }
-       g_free (sql);
 }
 
 static void
@@ -635,6 +628,7 @@ organigramma_persona_carica_nodo_recapiti (OrganigrammaPersona *persona)
                               priv->id,
                               id_nodi);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        GtkTreeIter iter;
@@ -652,7 +646,6 @@ organigramma_persona_carica_nodo_recapiti (OrganigrammaPersona *persona)
 
                        g_object_unref (dm);
                }
-       g_free (sql);
 }
 
 static void
@@ -676,6 +669,7 @@ organigramma_persona_carica_uffici (OrganigrammaPersona *persona)
                               " ORDER BY pu.da_data, pu.a_data, u.nome",
                               priv->id);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        GtkTreeIter iter;
@@ -694,7 +688,6 @@ organigramma_persona_carica_uffici (OrganigrammaPersona *persona)
 
                        g_object_unref (dm);
                }
-       g_free (sql);
 }
 
 static void
@@ -730,6 +723,7 @@ organigramma_persona_carica_ufficio_recapiti (OrganigrammaPersona *persona)
                               priv->id,
                               id_uffici);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        GtkTreeIter iter;
@@ -747,7 +741,6 @@ organigramma_persona_carica_ufficio_recapiti (OrganigrammaPersona *persona)
 
                        g_object_unref (dm);
                }
-       g_free (sql);
 }
 
 static void
@@ -771,6 +764,7 @@ organigramma_persona_carica_recapiti (OrganigrammaPersona *persona)
                               " ORDER BY tr.nome, pr.recapito",
                               priv->id);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        GtkTreeIter iter;
@@ -788,14 +782,12 @@ organigramma_persona_carica_recapiti (OrganigrammaPersona *persona)
 
                        g_object_unref (dm);
                }
-       g_free (sql);
 }
 
 static void
 organigramma_persona_incarico_modifica (OrganigrammaPersona *persona)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (persona);
 
@@ -819,13 +811,10 @@ organigramma_persona_incarico_modifica (OrganigrammaPersona *persona)
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un incarico.");
                }
 }
 
@@ -871,7 +860,6 @@ static void
 organigramma_persona_nodo_recapito_modifica (OrganigrammaPersona *persona)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (persona);
 
@@ -885,13 +873,10 @@ organigramma_persona_nodo_recapito_modifica (OrganigrammaPersona *persona)
 
        if (id_nodi == 0)
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un nodo.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo.");
                        return;
                }
 
@@ -915,13 +900,10 @@ organigramma_persona_nodo_recapito_modifica (OrganigrammaPersona *persona)
                }
        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 nodo.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo.");
                }
 }
 
@@ -929,7 +911,6 @@ static void
 organigramma_persona_ufficio_modifica (OrganigrammaPersona *persona)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (persona);
 
@@ -953,13 +934,10 @@ organigramma_persona_ufficio_modifica (OrganigrammaPersona *persona)
                }
        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 ufficio.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un ufficio.");
                }
 }
 
@@ -967,7 +945,6 @@ static void
 organigramma_persona_ufficio_recapito_modifica (OrganigrammaPersona *persona)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (persona);
 
@@ -981,13 +958,10 @@ organigramma_persona_ufficio_recapito_modifica (OrganigrammaPersona *persona)
 
        if (id_uffici == 0)
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un ufficio");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un ufficio");
                        return;
                }
 
@@ -1011,13 +985,10 @@ organigramma_persona_ufficio_recapito_modifica (OrganigrammaPersona *persona)
                }
        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 recapito.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un recapito.");
                }
 }
 
@@ -1025,7 +996,6 @@ static void
 organigramma_persona_recapito_modifica (OrganigrammaPersona *persona)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (persona);
 
@@ -1049,13 +1019,10 @@ organigramma_persona_recapito_modifica (OrganigrammaPersona *persona)
                }
        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 recapito.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un recapito.");
                }
 }
 
@@ -1063,7 +1030,6 @@ static void
 organigramma_persona_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersona *persona = ORGANIGRAMMA_PERSONA (object);
-
        OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (persona);
 
        switch (property_id)
@@ -1078,7 +1044,6 @@ static void
 organigramma_persona_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersona *persona = ORGANIGRAMMA_PERSONA (object);
-
        OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (persona);
 
        switch (property_id)
@@ -1092,8 +1057,6 @@ organigramma_persona_get_property (GObject *object, guint property_id, GValue *v
 static gboolean
 organigramma_persona_conferma_chiusura (OrganigrammaPersona *persona)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (persona);
@@ -1101,16 +1064,13 @@ organigramma_persona_conferma_chiusura (OrganigrammaPersona *persona)
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
@@ -1240,8 +1200,6 @@ organigramma_persona_on_btn_incarico_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
 
        OrganigrammaPersona *persona = (OrganigrammaPersona *)user_data;
 
@@ -1250,13 +1208,10 @@ organigramma_persona_on_btn_incarico_elimina_clicked (GtkButton *button,
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare l'incarico selezionato?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -1272,17 +1227,13 @@ organigramma_persona_on_btn_incarico_elimina_clicked (GtkButton *button,
 
                                        organigramma_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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un incarico.");
                }
 }
 
@@ -1327,8 +1278,6 @@ organigramma_persona_on_btn_nodo_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
 
        OrganigrammaPersona *persona = (OrganigrammaPersona *)user_data;
 
@@ -1337,13 +1286,10 @@ organigramma_persona_on_btn_nodo_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->sel_nodi, 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 il nodo selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il nodo selezionato?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -1359,17 +1305,13 @@ organigramma_persona_on_btn_nodo_elimina_clicked (GtkButton *button,
 
                                        organigramma_persona_carica_nodi (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 nodo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo");
                }
 }
 
@@ -1410,13 +1352,10 @@ organigramma_persona_on_btn_nodo_recapito_nuovo_clicked (GtkButton *button,
 
        if (id_nodi == 0)
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un nodo.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo.");
                        return;
                }
 
@@ -1442,8 +1381,6 @@ organigramma_persona_on_btn_nodo_recapito_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
        guint id_nodi;
 
        OrganigrammaPersona *persona = (OrganigrammaPersona *)user_data;
@@ -1460,25 +1397,19 @@ organigramma_persona_on_btn_nodo_recapito_elimina_clicked (GtkButton *button,
 
        if (id_nodi == 0)
                {
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un nodo.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo.");
                        return;
                }
 
        if (gtk_tree_selection_get_selected (priv->sel_nodo_recapiti, 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 il recapito selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il recapito selezionato?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -1494,17 +1425,13 @@ organigramma_persona_on_btn_nodo_recapito_elimina_clicked (GtkButton *button,
 
                                        organigramma_persona_carica_nodo_recapiti (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 recapito.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un recapito.");
                }
 }
 
@@ -1549,8 +1476,6 @@ organigramma_persona_on_btn_ufficio_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
 
        OrganigrammaPersona *persona = (OrganigrammaPersona *)user_data;
 
@@ -1559,13 +1484,10 @@ organigramma_persona_on_btn_ufficio_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->sel_uffici, 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'ufficio selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare l'ufficio selezionato?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -1581,17 +1503,13 @@ organigramma_persona_on_btn_ufficio_elimina_clicked (GtkButton *button,
 
                                        organigramma_persona_carica_uffici (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 ufficio");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un ufficio");
                }
 }
 
@@ -1632,13 +1550,10 @@ organigramma_persona_on_btn_ufficio_recapito_nuovo_clicked (GtkButton *button,
 
        if (id_uffici == 0)
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un ufficio");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un ufficio");
                        return;
                }
 
@@ -1664,8 +1579,6 @@ organigramma_persona_on_btn_ufficio_recapito_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
        guint id_uffici;
 
        OrganigrammaPersona *persona = (OrganigrammaPersona *)user_data;
@@ -1682,25 +1595,19 @@ organigramma_persona_on_btn_ufficio_recapito_elimina_clicked (GtkButton *button,
 
        if (id_uffici == 0)
                {
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un ufficio");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un ufficio");
                        return;
                }
 
        if (gtk_tree_selection_get_selected (priv->sel_ufficio_recapiti, 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 il recapito selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il recapito selezionato?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -1716,17 +1623,13 @@ organigramma_persona_on_btn_ufficio_recapito_elimina_clicked (GtkButton *button,
 
                                        organigramma_persona_carica_ufficio_recapiti (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 recapito");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un recapito");
                }
 }
 
@@ -1771,8 +1674,6 @@ organigramma_persona_on_btn_recapito_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
 
        OrganigrammaPersona *persona = (OrganigrammaPersona *)user_data;
 
@@ -1781,13 +1682,10 @@ organigramma_persona_on_btn_recapito_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->sel_recapiti, 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 il recapito selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il recapito selezionato?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -1803,17 +1701,13 @@ organigramma_persona_on_btn_recapito_elimina_clicked (GtkButton *button,
 
                                        organigramma_persona_carica_recapiti (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 recapito.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un recapito.");
                }
 }
 
index ac60ed156b02254d06bc5543a873135d259b1946..547c342505824d452bbe6f8f646820a632d545d7 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "personaincarico.h"
 #include "nodi.h"
@@ -212,7 +213,6 @@ static void
 organigramma_persona_incarico_salva (OrganigrammaPersonaIncarico *organigramma_persona_incarico)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaIncaricoClass *klass = ORGANIGRAMMA_PERSONA_INCARICO_GET_CLASS (organigramma_persona_incarico);
 
@@ -243,23 +243,17 @@ organigramma_persona_incarico_salva (OrganigrammaPersonaIncarico *organigramma_p
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -267,7 +261,6 @@ static void
 organigramma_persona_incarico_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersonaIncarico *organigramma_persona_incarico = ORGANIGRAMMA_PERSONA_INCARICO (object);
-
        OrganigrammaPersonaIncaricoPrivate *priv = ORGANIGRAMMA_PERSONA_INCARICO_GET_PRIVATE (organigramma_persona_incarico);
 
        switch (property_id)
@@ -282,7 +275,6 @@ static void
 organigramma_persona_incarico_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersonaIncarico *organigramma_persona_incarico = ORGANIGRAMMA_PERSONA_INCARICO (object);
-
        OrganigrammaPersonaIncaricoPrivate *priv = ORGANIGRAMMA_PERSONA_INCARICO_GET_PRIVATE (organigramma_persona_incarico);
 
        switch (property_id)
@@ -296,8 +288,6 @@ organigramma_persona_incarico_get_property (GObject *object, guint property_id,
 static gboolean
 organigramma_persona_incarico_conferma_chiusura (OrganigrammaPersonaIncarico *organigramma_persona_incarico)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaPersonaIncaricoPrivate *priv = ORGANIGRAMMA_PERSONA_INCARICO_GET_PRIVATE (organigramma_persona_incarico);
@@ -306,16 +296,13 @@ organigramma_persona_incarico_conferma_chiusura (OrganigrammaPersonaIncarico *or
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 609a2258f5b8333a1235bdb57423fd8064e49f5f..2b6108134d05ee0677a00b265d177f58ec79a837 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "personanodo.h"
 #include "nodi.h"
@@ -217,7 +218,6 @@ static void
 organigramma_persona_nodo_salva (OrganigrammaPersonaNodo *organigramma_persona_nodo)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaNodoClass *klass = ORGANIGRAMMA_PERSONA_NODO_GET_CLASS (organigramma_persona_nodo);
 
@@ -248,23 +248,17 @@ organigramma_persona_nodo_salva (OrganigrammaPersonaNodo *organigramma_persona_n
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -309,8 +303,6 @@ organigramma_persona_nodo_get_property (GObject *object, guint property_id, GVal
 static gboolean
 organigramma_persona_nodo_conferma_chiusura (OrganigrammaPersonaNodo *organigramma_persona_nodo)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaPersonaNodoPrivate *priv = ORGANIGRAMMA_PERSONA_NODO_GET_PRIVATE (organigramma_persona_nodo);
@@ -319,16 +311,13 @@ organigramma_persona_nodo_conferma_chiusura (OrganigrammaPersonaNodo *organigram
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index ee29bc274055369ae67374469096415bf111edd4..64b2a5b18547493a6bec9a1f64d747c8e53ecfb3 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "personanodorecapito.h"
 
@@ -210,7 +211,6 @@ static void
 organigramma_persona_nodo_recapito_salva (OrganigrammaPersonaNodoRecapito *organigramma_persona_nodo_recapito)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaNodoRecapitoClass *klass = ORGANIGRAMMA_PERSONA_NODO_RECAPITO_GET_CLASS (organigramma_persona_nodo_recapito);
 
@@ -241,23 +241,17 @@ organigramma_persona_nodo_recapito_salva (OrganigrammaPersonaNodoRecapito *organ
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -265,7 +259,6 @@ static void
 organigramma_persona_nodo_recapito_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersonaNodoRecapito *organigramma_persona_nodo_recapito = ORGANIGRAMMA_PERSONA_NODO_RECAPITO (object);
-
        OrganigrammaPersonaNodoRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_NODO_RECAPITO_GET_PRIVATE (organigramma_persona_nodo_recapito);
 
        switch (property_id)
@@ -280,7 +273,6 @@ static void
 organigramma_persona_nodo_recapito_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersonaNodoRecapito *organigramma_persona_nodo_recapito = ORGANIGRAMMA_PERSONA_NODO_RECAPITO (object);
-
        OrganigrammaPersonaNodoRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_NODO_RECAPITO_GET_PRIVATE (organigramma_persona_nodo_recapito);
 
        switch (property_id)
@@ -294,8 +286,6 @@ organigramma_persona_nodo_recapito_get_property (GObject *object, guint property
 static gboolean
 organigramma_persona_nodo_recapito_conferma_chiusura (OrganigrammaPersonaNodoRecapito *organigramma_persona_nodo_recapito)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaPersonaNodoRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_NODO_RECAPITO_GET_PRIVATE (organigramma_persona_nodo_recapito);
@@ -304,16 +294,13 @@ organigramma_persona_nodo_recapito_conferma_chiusura (OrganigrammaPersonaNodoRec
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 003a17e2b693d08567d07f1608240455e806242d..142ecd8d8885bf02fb9de0035430a146ae2647e6 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "personarecapito.h"
 
@@ -206,7 +207,6 @@ static void
 organigramma_persona_recapito_salva (OrganigrammaPersonaRecapito *organigramma_persona_recapito)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaRecapitoClass *klass = ORGANIGRAMMA_PERSONA_RECAPITO_GET_CLASS (organigramma_persona_recapito);
 
@@ -237,23 +237,17 @@ organigramma_persona_recapito_salva (OrganigrammaPersonaRecapito *organigramma_p
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -261,7 +255,6 @@ static void
 organigramma_persona_recapito_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersonaRecapito *organigramma_persona_recapito = ORGANIGRAMMA_PERSONA_RECAPITO (object);
-
        OrganigrammaPersonaRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_RECAPITO_GET_PRIVATE (organigramma_persona_recapito);
 
        switch (property_id)
@@ -276,7 +269,6 @@ static void
 organigramma_persona_recapito_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersonaRecapito *organigramma_persona_recapito = ORGANIGRAMMA_PERSONA_RECAPITO (object);
-
        OrganigrammaPersonaRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_RECAPITO_GET_PRIVATE (organigramma_persona_recapito);
 
        switch (property_id)
@@ -290,8 +282,6 @@ organigramma_persona_recapito_get_property (GObject *object, guint property_id,
 static gboolean
 organigramma_persona_recapito_conferma_chiusura (OrganigrammaPersonaRecapito *organigramma_persona_recapito)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaPersonaRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_RECAPITO_GET_PRIVATE (organigramma_persona_recapito);
@@ -300,16 +290,13 @@ organigramma_persona_recapito_conferma_chiusura (OrganigrammaPersonaRecapito *or
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 5e9129074a5f34c1d3e2c62f67b536fddc05a5b2..56c8592e0c8f5600ceaab13fdebe1e1835eabc81 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "personaufficio.h"
 #include "uffici.h"
@@ -217,7 +218,6 @@ static void
 organigramma_persona_ufficio_salva (OrganigrammaPersonaUfficio *organigramma_persona_ufficio)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaUfficioClass *klass = ORGANIGRAMMA_PERSONA_UFFICIO_GET_CLASS (organigramma_persona_ufficio);
 
@@ -248,23 +248,17 @@ organigramma_persona_ufficio_salva (OrganigrammaPersonaUfficio *organigramma_per
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -282,7 +276,6 @@ static void
 organigramma_persona_ufficio_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersonaUfficio *organigramma_persona_ufficio = ORGANIGRAMMA_PERSONA_UFFICIO (object);
-
        OrganigrammaPersonaUfficioPrivate *priv = ORGANIGRAMMA_PERSONA_UFFICIO_GET_PRIVATE (organigramma_persona_ufficio);
 
        switch (property_id)
@@ -297,7 +290,6 @@ static void
 organigramma_persona_ufficio_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersonaUfficio *organigramma_persona_ufficio = ORGANIGRAMMA_PERSONA_UFFICIO (object);
-
        OrganigrammaPersonaUfficioPrivate *priv = ORGANIGRAMMA_PERSONA_UFFICIO_GET_PRIVATE (organigramma_persona_ufficio);
 
        switch (property_id)
@@ -311,8 +303,6 @@ organigramma_persona_ufficio_get_property (GObject *object, guint property_id, G
 static gboolean
 organigramma_persona_ufficio_conferma_chiusura (OrganigrammaPersonaUfficio *organigramma_persona_ufficio)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaPersonaUfficioPrivate *priv = ORGANIGRAMMA_PERSONA_UFFICIO_GET_PRIVATE (organigramma_persona_ufficio);
@@ -321,16 +311,13 @@ organigramma_persona_ufficio_conferma_chiusura (OrganigrammaPersonaUfficio *orga
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 1a5eaa7e3f630cecac494ffb4652fc52e987fc45..9232c8d0b95f20b750bfe6fa83e8d5c21abf39ec 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "personaufficiorecapito.h"
 
@@ -210,7 +211,6 @@ static void
 organigramma_persona_ufficio_recapito_salva (OrganigrammaPersonaUfficioRecapito *organigramma_persona_ufficio_recapito)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaPersonaUfficioRecapitoClass *klass = ORGANIGRAMMA_PERSONA_UFFICIO_RECAPITO_GET_CLASS (organigramma_persona_ufficio_recapito);
 
@@ -241,23 +241,17 @@ organigramma_persona_ufficio_recapito_salva (OrganigrammaPersonaUfficioRecapito
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -265,7 +259,6 @@ static void
 organigramma_persona_ufficio_recapito_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersonaUfficioRecapito *organigramma_persona_ufficio_recapito = ORGANIGRAMMA_PERSONA_UFFICIO_RECAPITO (object);
-
        OrganigrammaPersonaUfficioRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_UFFICIO_RECAPITO_GET_PRIVATE (organigramma_persona_ufficio_recapito);
 
        switch (property_id)
@@ -280,7 +273,6 @@ static void
 organigramma_persona_ufficio_recapito_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersonaUfficioRecapito *organigramma_persona_ufficio_recapito = ORGANIGRAMMA_PERSONA_UFFICIO_RECAPITO (object);
-
        OrganigrammaPersonaUfficioRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_UFFICIO_RECAPITO_GET_PRIVATE (organigramma_persona_ufficio_recapito);
 
        switch (property_id)
@@ -294,8 +286,6 @@ organigramma_persona_ufficio_recapito_get_property (GObject *object, guint prope
 static gboolean
 organigramma_persona_ufficio_recapito_conferma_chiusura (OrganigrammaPersonaUfficioRecapito *organigramma_persona_ufficio_recapito)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaPersonaUfficioRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_UFFICIO_RECAPITO_GET_PRIVATE (organigramma_persona_ufficio_recapito);
@@ -304,16 +294,13 @@ organigramma_persona_ufficio_recapito_conferma_chiusura (OrganigrammaPersonaUffi
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 8d6aa5a9d2281237a0bc098a9c34e1d1319a8cd0..361d471ee0ca38f5d74e8e982cfb815d1179b874 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "persone.h"
 #include "persona.h"
 
@@ -199,6 +201,8 @@ static void
 organigramma_persone_carica (OrganigrammaPersone *persone)
 {
        GtkTreeIter iter;
+
+       gchar *sql;
        GdaDataModel *dm;
 
        gint rows;
@@ -208,18 +212,18 @@ organigramma_persone_carica (OrganigrammaPersone *persone)
 
        gtk_list_store_clear (priv->lstore_persone);
 
-       dm = gdaex_query (priv->commons->gdaex,
-                         "SELECT c.id, c.cognome || ' ' || c.nome AS cognome_nome"
+       sql = g_strdup_printf ("SELECT c.id, c.cognome || ' ' || c.nome AS cognome_nome"
                          " FROM persone AS c"
                          " WHERE c.status <> 'E'"
                          " ORDER BY c.cognome, c.nome");
+       dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        rows = gda_data_model_get_n_rows (dm);
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_persone, &iter);
-
                                        gtk_list_store_set (priv->lstore_persone, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
                                                            COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "cognome_nome"),
@@ -257,13 +261,10 @@ organigramma_persone_modifica (OrganigrammaPersone *persone)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare una persona");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una persona");
                }
 }
 
@@ -289,13 +290,10 @@ organigramma_persone_selezionato (OrganigrammaPersone *persone)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare una persona");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una persona");
                }
 }
 
@@ -309,7 +307,6 @@ static void
 organigramma_persone_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersone *persone = ORGANIGRAMMA_PERSONE (object);
-
        OrganigrammaPersonePrivate *priv = ORGANIGRAMMA_PERSONE_GET_PRIVATE (persone);
 
        switch (property_id)
@@ -324,7 +321,6 @@ static void
 organigramma_persone_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPersone *persone = ORGANIGRAMMA_PERSONE (object);
-
        OrganigrammaPersonePrivate *priv = ORGANIGRAMMA_PERSONE_GET_PRIVATE (persone);
 
        switch (property_id)
@@ -366,9 +362,6 @@ static void
 organigramma_persone_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        guint id;
 
@@ -377,13 +370,10 @@ organigramma_persone_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_QUESTION,
-                                                        GTK_BUTTONS_YES_NO,
-                                                        "Sicuro di voler eliminare la persona selezionata?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare la persona selezionata?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_persone), &iter,
                                                            COL_ID, &id,
@@ -394,17 +384,13 @@ organigramma_persone_on_btn_elimina_clicked (GtkButton *button,
 
                                        organigramma_persone_carica (persone);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare una persona");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una persona");
                }
 }
 
index 09b7bed83ae742958ada305d9bbef1a4e555909d..89da28b5d6e3b659c42bcad9ee6e78301650b5cc 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "posizioneeconomica.h"
 
@@ -190,12 +191,7 @@ organigramma_posizione_economica_carica (OrganigrammaPosizioneEconomica *posizio
 static void
 organigramma_posizione_economica_salva (OrganigrammaPosizioneEconomica *posizione_economica)
 {
-       GError *error = NULL;
        gchar *sql;
-       GtkWidget *dialog;
-
-       GDate *da;
-       GDate *a;
 
        OrganigrammaPosizioneEconomicaClass *klass = POSIZIONE_ECONOMICA_GET_CLASS (posizione_economica);
 
@@ -226,13 +222,10 @@ organigramma_posizione_economica_salva (OrganigrammaPosizioneEconomica *posizion
                                        priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -241,13 +234,10 @@ organigramma_posizione_economica_salva (OrganigrammaPosizioneEconomica *posizion
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -255,7 +245,6 @@ static void
 organigramma_posizione_economica_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPosizioneEconomica *posizione_economica = POSIZIONE_ECONOMICA (object);
-
        OrganigrammaPosizioneEconomicaPrivate *priv = POSIZIONE_ECONOMICA_GET_PRIVATE (posizione_economica);
 
        switch (property_id)
@@ -270,7 +259,6 @@ static void
 organigramma_posizione_economica_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPosizioneEconomica *posizione_economica = POSIZIONE_ECONOMICA (object);
-
        OrganigrammaPosizioneEconomicaPrivate *priv = POSIZIONE_ECONOMICA_GET_PRIVATE (posizione_economica);
 
        switch (property_id)
@@ -284,8 +272,6 @@ organigramma_posizione_economica_get_property (GObject *object, guint property_i
 static gboolean
 organigramma_posizione_economica_conferma_chiusura (OrganigrammaPosizioneEconomica *posizione_economica)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaPosizioneEconomicaPrivate *priv = POSIZIONE_ECONOMICA_GET_PRIVATE (posizione_economica);
@@ -293,16 +279,13 @@ organigramma_posizione_economica_conferma_chiusura (OrganigrammaPosizioneEconomi
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 07154c37ab72f30b34f8c43a8b6ed1265024aeaf..964b94d2eb41a17113f15b96535b4ac80603d215 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "posizionieconomiche.h"
 #include "posizioneeconomica.h"
 
@@ -199,6 +201,8 @@ static void
 organigramma_posizioni_economiche_carica (OrganigrammaPosizioniEconomiche *posizioni_economiche)
 {
        GtkTreeIter iter;
+
+       gchar *sql;
        GdaDataModel *dm;
 
        gint rows;
@@ -208,18 +212,18 @@ organigramma_posizioni_economiche_carica (OrganigrammaPosizioniEconomiche *posiz
 
        gtk_list_store_clear (priv->lstore_posizioni_economiche);
 
-       dm = gdaex_query (priv->commons->gdaex,
-                         "SELECT c.id, c.nome"
-                         " FROM posizioni_economiche AS c"
-                         " WHERE c.status <> 'E'"
-                         " ORDER BY c.nome");
+       sql = g_strdup_printf ("SELECT c.id, c.nome"
+                              " FROM posizioni_economiche AS c"
+                              " WHERE c.status <> 'E'"
+                              " ORDER BY c.nome");
+       dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        rows = gda_data_model_get_n_rows (dm);
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_posizioni_economiche, &iter);
-
                                        gtk_list_store_set (priv->lstore_posizioni_economiche, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_stringify_at (dm, row, "id"),
                                                            COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
@@ -244,7 +248,7 @@ organigramma_posizioni_economiche_modifica (OrganigrammaPosizioniEconomiche *pos
 
                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_posizioni_economiche), &iter,
                                            COL_ID, &id,
-                                                               -1);
+                                           -1);
 
                        OrganigrammaPosizioneEconomica *c = organigramma_posizione_economica_new (priv->commons, strtol (id, NULL, 10));
 
@@ -252,25 +256,15 @@ organigramma_posizioni_economiche_modifica (OrganigrammaPosizioniEconomiche *pos
                                          G_CALLBACK (organigramma_posizioni_economiche_on_posizione_aggiornato), (gpointer)posizioni_economiche);
 
                        w = organigramma_posizione_economica_get_widget (c);
-                       if (priv->selezione)
-                               {
-                                       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->widget));
-                               }
-                       else
-                               {
-                                       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")));
-                               }
+                       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->wtransient));
                        gtk_widget_show (w);
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare una posizione economica.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una posizione economica.");
                }
 }
 
@@ -296,13 +290,10 @@ organigramma_posizioni_economiche_selezionato (OrganigrammaPosizioniEconomiche *
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare una posizione economica.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una posizione economica.");
                }
 }
 
@@ -316,7 +307,6 @@ static void
 organigramma_posizioni_economiche_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPosizioniEconomiche *posizioni_economiche = ORGANIGRAMMA_POSIZIONI_ECONOMICHE (object);
-
        OrganigrammaPosizioniEconomichePrivate *priv = ORGANIGRAMMA_POSIZIONI_ECONOMICHE_GET_PRIVATE (posizioni_economiche);
 
        switch (property_id)
@@ -331,7 +321,6 @@ static void
 organigramma_posizioni_economiche_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaPosizioniEconomiche *posizioni_economiche = ORGANIGRAMMA_POSIZIONI_ECONOMICHE (object);
-
        OrganigrammaPosizioniEconomichePrivate *priv = ORGANIGRAMMA_POSIZIONI_ECONOMICHE_GET_PRIVATE (posizioni_economiche);
 
        switch (property_id)
@@ -373,9 +362,6 @@ static void
 organigramma_posizioni_economiche_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        gchar *id;
 
@@ -384,13 +370,10 @@ organigramma_posizioni_economiche_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_QUESTION,
-                                                        GTK_BUTTONS_YES_NO,
-                                                        "Sicuro di voler eliminare la posizione economica selezionata?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare la posizione economica selezionata?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_posizioni_economiche), &iter,
                                                            COL_ID, &id,
@@ -401,17 +384,13 @@ organigramma_posizioni_economiche_on_btn_elimina_clicked (GtkButton *button,
 
                                        organigramma_posizioni_economiche_carica (posizioni_economiche);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare una posizione economica.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una posizione economica.");
                }
 }
 
index 461f81b9376f0659cf2fe1a470b2d2b48d859b71..1cf1b1fafe8b853570408fdc66a72657289b05db 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "profiliprofessionali.h"
 #include "profiloprofessionale.h"
 
@@ -250,16 +252,16 @@ organigramma_profili_professionali_carica (OrganigrammaProfiliProfessionali *pro
                          "%s"
                          " ORDER BY c.nome", sql_where);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        rows = gda_data_model_get_n_rows (dm);
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_profili_professionali, &iter);
-
                                        gtk_list_store_set (priv->lstore_profili_professionali, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_stringify_at (dm, row, "id"),
-                                                                               COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
+                                                           COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
                                                            -1);
                                }
 
@@ -301,13 +303,10 @@ organigramma_profili_professionali_modifica (OrganigrammaProfiliProfessionali *p
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un profilo professionale.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un profilo professionale.");
                }
 }
 
@@ -324,7 +323,7 @@ organigramma_profili_professionali_selezionato (OrganigrammaProfiliProfessionali
                {
                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_profili_professionali), &iter,
                                            COL_ID, &id,
-                                                               -1);
+                                           -1);
 
                        g_signal_emit (G_OBJECT (profili_professionali), klass->selezionato_signal_id, 0, id);
 
@@ -333,13 +332,10 @@ organigramma_profili_professionali_selezionato (OrganigrammaProfiliProfessionali
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un profilo professionale.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un profilo professionale.");
                }
 }
 
@@ -353,7 +349,6 @@ static void
 organigramma_profili_professionali_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaProfiliProfessionali *profili_professionali = ORGANIGRAMMA_PROFILI_PROFESSIONALI (object);
-
        OrganigrammaProfiliProfessionaliPrivate *priv = ORGANIGRAMMA_PROFILI_PROFESSIONALI_GET_PRIVATE (profili_professionali);
 
        switch (property_id)
@@ -368,7 +363,6 @@ static void
 organigramma_profili_professionali_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaProfiliProfessionali *profili_professionali = ORGANIGRAMMA_PROFILI_PROFESSIONALI (object);
-
        OrganigrammaProfiliProfessionaliPrivate *priv = ORGANIGRAMMA_PROFILI_PROFESSIONALI_GET_PRIVATE (profili_professionali);
 
        switch (property_id)
@@ -417,9 +411,6 @@ static void
 organigramma_profili_professionali_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        gchar *id;
 
@@ -428,42 +419,35 @@ organigramma_profili_professionali_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_QUESTION,
-                                                                                        GTK_BUTTONS_YES_NO,
-                                                                                        "Sicuro di voler eliminare il profilo professionale selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il profilo professionale selezionato?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_profili_professionali), &iter,
-                                                                                       COL_ID, &id,
-                                                                                       -1);
+                                                           COL_ID, &id,
+                                                           -1);
 
                                        gdaex_execute (priv->commons->gdaex,
                                                       g_strdup_printf ("UPDATE profili_professionali SET status = 'E' WHERE id = %d", strtol (id, NULL, 10)));
 
                                        organigramma_profili_professionali_carica (profili_professionali);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un profilo professionale.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un profilo professionale.");
                }
 }
 
 static void
 organigramma_profili_professionali_on_trv_organigramma_profili_professionali_row_activated (GtkTreeView *tree_view,
                                              GtkTreePath *tree_path,
-                                                                                        GtkTreeViewColumn *column,
-                                                                                        gpointer user_data)
+                                             GtkTreeViewColumn *column,
+                                             gpointer user_data)
 {
        OrganigrammaProfiliProfessionaliPrivate *priv = ORGANIGRAMMA_PROFILI_PROFESSIONALI_GET_PRIVATE ((OrganigrammaProfiliProfessionali *)user_data);
 
index c6944b6e63ab1c3b6c2c17fde4de93d021997703..a6ecb51ffa36a1156989cbc66300e3fbc2f3fe8d 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <libgtkform/form.h>
 #include <libgtkform/fielddatetime.h>
+#include <libsolipa/utils.h>
 
 #include "profiloprofessionale.h"
 
@@ -193,12 +194,7 @@ organigramma_profilo_professionale_carica (OrganigrammaProfiloProfessionale *pro
 static void
 organigramma_profilo_professionale_salva (OrganigrammaProfiloProfessionale *profilo_professionale)
 {
-       GError *error = NULL;
        gchar *sql;
-       GtkWidget *dialog;
-
-       GDate *da;
-       GDate *a;
 
        OrganigrammaProfiloProfessionaleClass *klass = ORGANIGRAMMA_PROFILO_PROFESSIONALE_GET_CLASS (profilo_professionale);
 
@@ -229,13 +225,10 @@ organigramma_profilo_professionale_salva (OrganigrammaProfiloProfessionale *prof
                                        priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -244,13 +237,10 @@ organigramma_profilo_professionale_salva (OrganigrammaProfiloProfessionale *prof
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -258,7 +248,6 @@ static void
 organigramma_profilo_professionale_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaProfiloProfessionale *profilo_professionale = ORGANIGRAMMA_PROFILO_PROFESSIONALE (object);
-
        OrganigrammaProfiloProfessionalePrivate *priv = ORGANIGRAMMA_PROFILO_PROFESSIONALE_GET_PRIVATE (profilo_professionale);
 
        switch (property_id)
@@ -273,7 +262,6 @@ static void
 organigramma_profilo_professionale_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaProfiloProfessionale *profilo_professionale = ORGANIGRAMMA_PROFILO_PROFESSIONALE (object);
-
        OrganigrammaProfiloProfessionalePrivate *priv = ORGANIGRAMMA_PROFILO_PROFESSIONALE_GET_PRIVATE (profilo_professionale);
 
        switch (property_id)
@@ -287,8 +275,6 @@ organigramma_profilo_professionale_get_property (GObject *object, guint property
 static gboolean
 organigramma_profilo_professionale_conferma_chiusura (OrganigrammaProfiloProfessionale *profilo_professionale)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaProfiloProfessionalePrivate *priv = ORGANIGRAMMA_PROFILO_PROFESSIONALE_GET_PRIVATE (profilo_professionale);
@@ -296,16 +282,13 @@ organigramma_profilo_professionale_conferma_chiusura (OrganigrammaProfiloProfess
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 550013e53300c77b7bc16b2506b8762156e4ea11..962177d9e45154bd7103f93a93b395272cdff747 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <libgtkform/form.h>
 #include <libterritorio/via.h>
+#include <libsolipa/utils.h>
 
 #include "struttura.h"
 #include "strutturaindirizzo.h"
@@ -239,12 +240,7 @@ organigramma_struttura_carica (OrganigrammaStruttura *struttura)
 static void
 organigramma_struttura_salva (OrganigrammaStruttura *struttura)
 {
-       GError *error = NULL;
        gchar *sql;
-       GtkWidget *dialog;
-
-       GDate *da;
-       GDate *a;
 
        OrganigrammaStrutturaClass *klass = ORGANIGRAMMA_STRUTTURA_GET_CLASS (struttura);
 
@@ -276,13 +272,10 @@ organigramma_struttura_salva (OrganigrammaStruttura *struttura)
                                        gtk_form_set_sensitive_by_name (priv->form, TRUE, "frame3", NULL);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -291,13 +284,10 @@ organigramma_struttura_salva (OrganigrammaStruttura *struttura)
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -350,7 +340,6 @@ static void
 organigramma_struttura_indirizzo_modifica (OrganigrammaStruttura *struttura)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
 
        OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (struttura);
 
@@ -374,13 +363,10 @@ organigramma_struttura_indirizzo_modifica (OrganigrammaStruttura *struttura)
                }
        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 indirizzo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un indirizzo");
                }
 }
 
@@ -415,8 +401,6 @@ organigramma_struttura_get_property (GObject *object, guint property_id, GValue
 static gboolean
 organigramma_struttura_conferma_chiusura (OrganigrammaStruttura *struttura)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaStrutturaPrivate *priv = ORGANIGRAMMA_STRUTTURA_GET_PRIVATE (struttura);
@@ -424,16 +408,13 @@ organigramma_struttura_conferma_chiusura (OrganigrammaStruttura *struttura)
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
@@ -489,8 +470,6 @@ organigramma_struttura_on_btn_indirizzo_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
 
        OrganigrammaStruttura *struttura = (OrganigrammaStruttura *)user_data;
 
@@ -499,13 +478,10 @@ organigramma_struttura_on_btn_indirizzo_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->sel_indirizzi, 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'indirizzo selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare l'indirizzo selezionato?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -521,25 +497,21 @@ organigramma_struttura_on_btn_indirizzo_elimina_clicked (GtkButton *button,
 
                                        organigramma_struttura_carica_indirizzi (struttura);
                                }
-                       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 indirizzo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un indirizzo");
                }
 }
 
 static void
 organigramma_struttura_on_trv_indirizzi_row_activated (GtkTreeView *tree_view,
                                              GtkTreePath *tree_path,
-                                                                                        GtkTreeViewColumn *column,
-                                                                                        gpointer user_data)
+                                             GtkTreeViewColumn *column,
+                                             gpointer user_data)
 {
        organigramma_struttura_indirizzo_modifica ((OrganigrammaStruttura *)user_data);
 }
index 4c4fac234815052fa7df076ee186868866e5aa55..148efb0bb14a1175b8a6e147db70e0e020461fc0 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <libgtkform/form.h>
 #include <libterritorio/vie.h>
+#include <libsolipa/utils.h>
 
 #include "strutturaindirizzo.h"
 
@@ -207,9 +208,6 @@ GtkWidget
 static void
 organigramma_struttura_indirizzo_carica (OrganigrammaStrutturaIndirizzo *struttura_indirizzo)
 {
-       gchar *sql;
-       GdaDataModel *dm;
-
        OrganigrammaStrutturaIndirizzoPrivate *priv = ORGANIGRAMMA_STRUTTURA_INDIRIZZO_GET_PRIVATE (struttura_indirizzo);
 
        if (gtk_form_fill_from_table (priv->form))
@@ -221,7 +219,6 @@ static void
 organigramma_struttura_indirizzo_salva (OrganigrammaStrutturaIndirizzo *struttura_indirizzo)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaStrutturaIndirizzoClass *klass = ORGANIGRAMMA_STRUTTURA_INDIRIZZO_GET_CLASS (struttura_indirizzo);
 
@@ -252,23 +249,17 @@ organigramma_struttura_indirizzo_salva (OrganigrammaStrutturaIndirizzo *struttur
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio");
                }
 }
 
@@ -276,7 +267,6 @@ static void
 organigramma_struttura_indirizzo_on_vie_selezionato (gpointer instance, guint id, gpointer user_data)
 {
        OrganigrammaStrutturaIndirizzo *ia = (OrganigrammaStrutturaIndirizzo *)user_data;
-
        OrganigrammaStrutturaIndirizzoPrivate *priv = ORGANIGRAMMA_STRUTTURA_INDIRIZZO_GET_PRIVATE (ia);
 
        gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label46"), g_strdup_printf ("%d", id));
@@ -313,8 +303,6 @@ organigramma_struttura_indirizzo_get_property (GObject *object, guint property_i
 static gboolean
 organigramma_struttura_indirizzo_conferma_chiusura (OrganigrammaStrutturaIndirizzo *struttura_indirizzo)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaStrutturaIndirizzoPrivate *priv = ORGANIGRAMMA_STRUTTURA_INDIRIZZO_GET_PRIVATE (struttura_indirizzo);
@@ -323,16 +311,13 @@ organigramma_struttura_indirizzo_conferma_chiusura (OrganigrammaStrutturaIndiriz
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index d96345286b03549f39ac0226145c1bb4c93c7e98..ef1297a3ac0972fffb98d60dee28315a3876a1c8 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "strutture.h"
 #include "struttura.h"
 
@@ -199,6 +201,8 @@ static void
 organigramma_strutture_carica (OrganigrammaStrutture *strutture)
 {
        GtkTreeIter iter;
+
+       gchar *sql;
        GdaDataModel *dm;
 
        gint rows;
@@ -208,18 +212,18 @@ organigramma_strutture_carica (OrganigrammaStrutture *strutture)
 
        gtk_list_store_clear (priv->lstore_strutture);
 
-       dm = gdaex_query (priv->commons->gdaex,
-                         "SELECT c.id, c.nome"
-                         " FROM strutture AS c"
-                         " WHERE c.status <> 'E'"
-                         " ORDER BY c.nome");
+       sql = g_strdup_printf ("SELECT c.id, c.nome"
+                              " FROM strutture AS c"
+                              " WHERE c.status <> 'E'"
+                              " ORDER BY c.nome");
+       dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        rows = gda_data_model_get_n_rows (dm);
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_strutture, &iter);
-
                                        gtk_list_store_set (priv->lstore_strutture, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
                                                            COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
@@ -257,13 +261,10 @@ organigramma_strutture_modifica (OrganigrammaStrutture *strutture)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare una struttura");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una struttura");
                }
 }
 
@@ -289,13 +290,10 @@ organigramma_strutture_selezionato (OrganigrammaStrutture *strutture)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare una struttura");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una struttura");
                }
 }
 
@@ -309,7 +307,6 @@ static void
 organigramma_strutture_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaStrutture *strutture = ORGANIGRAMMA_STRUTTURE (object);
-
        OrganigrammaStrutturePrivate *priv = ORGANIGRAMMA_STRUTTURE_GET_PRIVATE (strutture);
 
        switch (property_id)
@@ -324,7 +321,6 @@ static void
 organigramma_strutture_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaStrutture *strutture = ORGANIGRAMMA_STRUTTURE (object);
-
        OrganigrammaStrutturePrivate *priv = ORGANIGRAMMA_STRUTTURE_GET_PRIVATE (strutture);
 
        switch (property_id)
@@ -366,9 +362,6 @@ static void
 organigramma_strutture_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        guint id;
 
@@ -377,13 +370,10 @@ organigramma_strutture_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_QUESTION,
-                                                        GTK_BUTTONS_YES_NO,
-                                                        "Sicuro di voler eliminare la struttura selezionata?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare la struttura selezionata?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_strutture), &iter,
                                                            COL_ID, &id,
@@ -394,17 +384,13 @@ organigramma_strutture_on_btn_elimina_clicked (GtkButton *button,
 
                                        organigramma_strutture_carica (strutture);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare una struttura");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una struttura");
                }
 }
 
index d272de89a2d6d23b9681a469070a86d04246fabc..449d7e1a11545a1ddc2a63dcef2d68c856566896 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "tipinodo.h"
 #include "tiponodo.h"
 
@@ -250,6 +252,8 @@ organigramma_tipi_nodo_carica (OrganigrammaTipiNodo *tipi_nodo)
                          "%s"
                          " ORDER BY c.nome", sql_where);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql_where);
+       g_free (sql);
        if (dm != NULL)
                {
                        rows = gda_data_model_get_n_rows (dm);
@@ -301,13 +305,10 @@ organigramma_tipi_nodo_modifica (OrganigrammaTipiNodo *tipi_nodo)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un tipo nodo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo nodo");
                }
 }
 
@@ -333,13 +334,10 @@ organigramma_tipi_nodo_selezionato (OrganigrammaTipiNodo *tipi_nodo)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un tipo nodo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo nodo");
                }
 }
 
@@ -415,9 +413,6 @@ static void
 organigramma_tipi_nodo_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        gchar *id;
 
@@ -426,13 +421,10 @@ organigramma_tipi_nodo_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_QUESTION,
-                                                                                        GTK_BUTTONS_YES_NO,
-                                                                                        "Sicuro di voler eliminare il tipo nodo selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il tipo nodo selezionato?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_nodo), &iter,
                                                            COL_ID, &id,
@@ -443,25 +435,21 @@ organigramma_tipi_nodo_on_btn_elimina_clicked (GtkButton *button,
 
                                        organigramma_tipi_nodo_carica (tipi_nodo);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un tipo nodo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo nodo");
                }
 }
 
 static void
 organigramma_tipi_nodo_on_trv_organigramma_tipi_nodo_row_activated (GtkTreeView *tree_view,
                                              GtkTreePath *tree_path,
-                                                                                        GtkTreeViewColumn *column,
-                                                                                        gpointer user_data)
+                                             GtkTreeViewColumn *column,
+                                             gpointer user_data)
 {
        OrganigrammaTipiNodoPrivate *priv = ORGANIGRAMMA_TIPI_NODO_GET_PRIVATE ((OrganigrammaTipiNodo *)user_data);
 
index 207b8259d40a0717646090e547d5dfcdcaf8dce2..0c9f006400b6495ffd74535a892f9ad93f846bdf 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "tipiprestazione.h"
 #include "tipoprestazione.h"
 
@@ -250,16 +252,17 @@ organigramma_tipi_prestazione_carica (OrganigrammaTipiPrestazione *tipi_prestazi
                          "%s"
                          " ORDER BY c.nome", sql_where);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql_where);
+       g_free (sql);
        if (dm != NULL)
                {
                        rows = gda_data_model_get_n_rows (dm);
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_tipi_prestazione, &iter);
-
                                        gtk_list_store_set (priv->lstore_tipi_prestazione, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_stringify_at (dm, row, "id"),
-                                                                               COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
+                                                           COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
                                                            -1);
                                }
 
@@ -281,7 +284,7 @@ organigramma_tipi_prestazione_modifica (OrganigrammaTipiPrestazione *tipi_presta
 
                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_prestazione), &iter,
                                            COL_ID, &id,
-                                                               -1);
+                                           -1);
 
                        OrganigrammaTipoPrestazione *c = organigramma_tipo_prestazione_new (priv->commons, strtol (id, NULL, 10));
 
@@ -301,13 +304,10 @@ organigramma_tipi_prestazione_modifica (OrganigrammaTipiPrestazione *tipi_presta
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un tipo prestazione.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo prestazione.");
                }
 }
 
@@ -324,7 +324,7 @@ organigramma_tipi_prestazione_selezionato (OrganigrammaTipiPrestazione *tipi_pre
                {
                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_prestazione), &iter,
                                            COL_ID, &id,
-                                                               -1);
+                                           -1);
 
                        g_signal_emit (G_OBJECT (tipi_prestazione), klass->selezionato_signal_id, 0, id);
 
@@ -333,13 +333,10 @@ organigramma_tipi_prestazione_selezionato (OrganigrammaTipiPrestazione *tipi_pre
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un tipo prestazione.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo prestazione.");
                }
 }
 
@@ -353,7 +350,6 @@ static void
 organigramma_tipi_prestazione_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipiPrestazione *tipi_prestazione = ORGANIGRAMMA_TIPI_PRESTAZIONE (object);
-
        OrganigrammaTipiPrestazionePrivate *priv = ORGANIGRAMMA_TIPI_PRESTAZIONE_GET_PRIVATE (tipi_prestazione);
 
        switch (property_id)
@@ -368,7 +364,6 @@ static void
 organigramma_tipi_prestazione_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipiPrestazione *tipi_prestazione = ORGANIGRAMMA_TIPI_PRESTAZIONE (object);
-
        OrganigrammaTipiPrestazionePrivate *priv = ORGANIGRAMMA_TIPI_PRESTAZIONE_GET_PRIVATE (tipi_prestazione);
 
        switch (property_id)
@@ -417,9 +412,6 @@ static void
 organigramma_tipi_prestazione_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        gchar *id;
 
@@ -428,42 +420,35 @@ organigramma_tipi_prestazione_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_QUESTION,
-                                                                                        GTK_BUTTONS_YES_NO,
-                                                                                        "Sicuro di voler eliminare il tipo prestazione selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il tipo prestazione selezionato?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_prestazione), &iter,
-                                                                                       COL_ID, &id,
-                                                                                       -1);
+                                                           COL_ID, &id,
+                                                           -1);
 
                                        gdaex_execute (priv->commons->gdaex,
                                                       g_strdup_printf ("UPDATE tipi_prestazione SET status = 'E' WHERE id = %d", strtol (id, NULL, 10)));
 
                                        organigramma_tipi_prestazione_carica (tipi_prestazione);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare un tipo prestazione.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->selezione ? priv->widget : GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo prestazione.");
                }
 }
 
 static void
 organigramma_tipi_prestazione_on_trv_organigramma_tipi_prestazione_row_activated (GtkTreeView *tree_view,
                                              GtkTreePath *tree_path,
-                                                                                        GtkTreeViewColumn *column,
-                                                                                        gpointer user_data)
+                                             GtkTreeViewColumn *column,
+                                             gpointer user_data)
 {
        OrganigrammaTipiPrestazionePrivate *priv = ORGANIGRAMMA_TIPI_PRESTAZIONE_GET_PRIVATE ((OrganigrammaTipiPrestazione *)user_data);
 
index c265e681975f04742771837bbba920ad65d75154..9867702ab1ad5cb94884bedce16249153af64f9b 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "tipirapportolavoro.h"
 #include "tiporapportolavoro.h"
 
@@ -199,6 +201,8 @@ static void
 organigramma_tipi_rapporto_lavoro_carica (OrganigrammaTipiRapportoLavoro *tipi_rapporto_lavoro)
 {
        GtkTreeIter iter;
+
+       gchar *sql;
        GdaDataModel *dm;
 
        gint rows;
@@ -208,18 +212,18 @@ organigramma_tipi_rapporto_lavoro_carica (OrganigrammaTipiRapportoLavoro *tipi_r
 
        gtk_list_store_clear (priv->lstore_tipi_rapporto_lavoro);
 
-       dm = gdaex_query (priv->commons->gdaex,
-                         "SELECT c.id, c.nome"
+       sql = g_strdup_printf ("SELECT c.id, c.nome"
                          " FROM tipi_rapporto_lavoro AS c"
                          " WHERE c.status <> 'E'"
                          " ORDER BY c.nome");
+       dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        rows = gda_data_model_get_n_rows (dm);
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_tipi_rapporto_lavoro, &iter);
-
                                        gtk_list_store_set (priv->lstore_tipi_rapporto_lavoro, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_stringify_at (dm, row, "id"),
                                                            COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
@@ -244,7 +248,7 @@ organigramma_tipi_rapporto_lavoro_modifica (OrganigrammaTipiRapportoLavoro *tipi
 
                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_rapporto_lavoro), &iter,
                                            COL_ID, &id,
-                                                               -1);
+                                           -1);
 
                        OrganigrammaTipoRapportoLavoro *c = organigramma_tipo_rapporto_lavoro_new (priv->commons, strtol (id, NULL, 10));
 
@@ -252,25 +256,15 @@ organigramma_tipi_rapporto_lavoro_modifica (OrganigrammaTipiRapportoLavoro *tipi
                                          G_CALLBACK (organigramma_tipi_rapporto_lavoro_on_costo_aggiornato), (gpointer)tipi_rapporto_lavoro);
 
                        w = organigramma_tipo_rapporto_lavoro_get_widget (c);
-                       if (priv->selezione)
-                               {
-                                       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->widget));
-                               }
-                       else
-                               {
-                                       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")));
-                               }
+                       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->wtransient));
                        gtk_widget_show (w);
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare un tipo rapporto lavoro.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo rapporto lavoro.");
                }
 }
 
@@ -296,13 +290,10 @@ organigramma_tipi_rapporto_lavoro_selezionato (OrganigrammaTipiRapportoLavoro *t
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un tipo rapporto lavoro.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo rapporto lavoro.");
                }
 }
 
@@ -316,7 +307,6 @@ static void
 organigramma_tipi_rapporto_lavoro_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipiRapportoLavoro *tipi_rapporto_lavoro = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO (object);
-
        OrganigrammaTipiRapportoLavoroPrivate *priv = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO_GET_PRIVATE (tipi_rapporto_lavoro);
 
        switch (property_id)
@@ -331,7 +321,6 @@ static void
 organigramma_tipi_rapporto_lavoro_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipiRapportoLavoro *tipi_rapporto_lavoro = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO (object);
-
        OrganigrammaTipiRapportoLavoroPrivate *priv = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO_GET_PRIVATE (tipi_rapporto_lavoro);
 
        switch (property_id)
@@ -373,9 +362,6 @@ static void
 organigramma_tipi_rapporto_lavoro_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        gchar *id;
 
@@ -384,13 +370,10 @@ organigramma_tipi_rapporto_lavoro_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_QUESTION,
-                                                        GTK_BUTTONS_YES_NO,
-                                                        "Sicuro di voler eliminare il tipo rapporto lavoro selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il tipo rapporto lavoro selezionato?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_rapporto_lavoro), &iter,
                                                            COL_ID, &id,
@@ -401,17 +384,13 @@ organigramma_tipi_rapporto_lavoro_on_btn_elimina_clicked (GtkButton *button,
 
                                        organigramma_tipi_rapporto_lavoro_carica (tipi_rapporto_lavoro);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un tipo rapporto di lavoro.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo rapporto di lavoro.");
                }
 }
 
@@ -433,7 +412,6 @@ organigramma_tipi_rapporto_lavoro_on_trv_organigramma_tipi_rapporto_lavoro_row_a
                }
 }
 
-
 static void
 organigramma_tipi_rapporto_lavoro_on_btn_annulla_clicked (GtkButton *button,
                         gpointer user_data)
index 4aaf455cd81bbb9aa9593237486219a58fcfb8c5..88241b2f6fa3c73895d98b155c021fb931dc0423 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "tipirecapito.h"
 #include "tiporecapito.h"
 
@@ -199,6 +201,8 @@ static void
 organigramma_tipi_recapito_carica (OrganigrammaTipiRecapito *tipi_recapito)
 {
        GtkTreeIter iter;
+
+       gchar *sql;
        GdaDataModel *dm;
 
        gint rows;
@@ -208,18 +212,18 @@ organigramma_tipi_recapito_carica (OrganigrammaTipiRecapito *tipi_recapito)
 
        gtk_list_store_clear (priv->lstore_tipi_recapito);
 
-       dm = gdaex_query (priv->commons->gdaex,
-                         "SELECT c.id, c.nome"
-                         " FROM tipi_recapito AS c"
-                         " WHERE c.status <> 'E'"
-                         " ORDER BY c.nome");
+       sql = g_strdup_printf ("SELECT c.id, c.nome"
+                              " FROM tipi_recapito AS c"
+                              " WHERE c.status <> 'E'"
+                              " ORDER BY c.nome");
+       dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        rows = gda_data_model_get_n_rows (dm);
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_tipi_recapito, &iter);
-
                                        gtk_list_store_set (priv->lstore_tipi_recapito, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_stringify_at (dm, row, "id"),
                                                            COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
@@ -244,7 +248,7 @@ organigramma_tipi_recapito_modifica (OrganigrammaTipiRecapito *tipi_recapito)
 
                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_recapito), &iter,
                                            COL_ID, &id,
-                                                               -1);
+                                           -1);
 
                        OrganigrammaTipoRecapito *c = organigramma_tipo_recapito_new (priv->commons, strtol (id, NULL, 10));
 
@@ -252,25 +256,15 @@ organigramma_tipi_recapito_modifica (OrganigrammaTipiRecapito *tipi_recapito)
                                          G_CALLBACK (organigramma_tipi_recapito_on_costo_aggiornato), (gpointer)tipi_recapito);
 
                        w = organigramma_tipo_recapito_get_widget (c);
-                       if (priv->selezione)
-                               {
-                                       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->widget));
-                               }
-                       else
-                               {
-                                       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")));
-                               }
+                       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->wtransient));
                        gtk_widget_show (w);
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare un tipo recapito");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo recapito");
                }
 }
 
@@ -296,13 +290,10 @@ organigramma_tipi_recapito_selezionato (OrganigrammaTipiRecapito *tipi_recapito)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un tipo recapito");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo recapito");
                }
 }
 
@@ -316,7 +307,6 @@ static void
 organigramma_tipi_recapito_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipiRecapito *tipi_recapito = ORGANIGRAMMA_TIPI_RECAPITO (object);
-
        OrganigrammaTipiRecapitoPrivate *priv = ORGANIGRAMMA_TIPI_RECAPITO_GET_PRIVATE (tipi_recapito);
 
        switch (property_id)
@@ -331,7 +321,6 @@ static void
 organigramma_tipi_recapito_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipiRecapito *tipi_recapito = ORGANIGRAMMA_TIPI_RECAPITO (object);
-
        OrganigrammaTipiRecapitoPrivate *priv = ORGANIGRAMMA_TIPI_RECAPITO_GET_PRIVATE (tipi_recapito);
 
        switch (property_id)
@@ -373,9 +362,6 @@ static void
 organigramma_tipi_recapito_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        gchar *id;
 
@@ -384,13 +370,10 @@ organigramma_tipi_recapito_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_QUESTION,
-                                                        GTK_BUTTONS_YES_NO,
-                                                        "Sicuro di voler eliminare il tipo recapito selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il tipo recapito selezionato?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_recapito), &iter,
                                                            COL_ID, &id,
@@ -401,17 +384,13 @@ organigramma_tipi_recapito_on_btn_elimina_clicked (GtkButton *button,
 
                                        organigramma_tipi_recapito_carica (tipi_recapito);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un tipo recapito");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un tipo recapito");
                }
 }
 
index 91e4c624c2d7ecad1ccf0eeeec2c0b12821cac95..81ff640bfccbbf1ff201aa1f8c8a94b96147a380 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <libgtkform/form.h>
 #include <libgtkform/fielddatetime.h>
+#include <libsolipa/utils.h>
 
 #include "tiponodo.h"
 
@@ -193,12 +194,7 @@ organigramma_tipo_nodo_carica (OrganigrammaTipoNodo *organigramma_tipo_nodo)
 static void
 organigramma_tipo_nodo_salva (OrganigrammaTipoNodo *organigramma_tipo_nodo)
 {
-       GError *error = NULL;
        gchar *sql;
-       GtkWidget *dialog;
-
-       GDate *da;
-       GDate *a;
 
        OrganigrammaTipoNodoClass *klass = ORGANIGRAMMA_TIPO_NODO_GET_CLASS (organigramma_tipo_nodo);
 
@@ -229,13 +225,10 @@ organigramma_tipo_nodo_salva (OrganigrammaTipoNodo *organigramma_tipo_nodo)
                                        priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -244,13 +237,10 @@ organigramma_tipo_nodo_salva (OrganigrammaTipoNodo *organigramma_tipo_nodo)
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -258,7 +248,6 @@ static void
 organigramma_tipo_nodo_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipoNodo *organigramma_tipo_nodo = ORGANIGRAMMA_TIPO_NODO (object);
-
        OrganigrammaTipoNodoPrivate *priv = ORGANIGRAMMA_TIPO_NODO_GET_PRIVATE (organigramma_tipo_nodo);
 
        switch (property_id)
@@ -273,7 +262,6 @@ static void
 organigramma_tipo_nodo_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipoNodo *organigramma_tipo_nodo = ORGANIGRAMMA_TIPO_NODO (object);
-
        OrganigrammaTipoNodoPrivate *priv = ORGANIGRAMMA_TIPO_NODO_GET_PRIVATE (organigramma_tipo_nodo);
 
        switch (property_id)
@@ -287,8 +275,6 @@ organigramma_tipo_nodo_get_property (GObject *object, guint property_id, GValue
 static gboolean
 organigramma_tipo_nodo_conferma_chiusura (OrganigrammaTipoNodo *organigramma_tipo_nodo)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaTipoNodoPrivate *priv = ORGANIGRAMMA_TIPO_NODO_GET_PRIVATE (organigramma_tipo_nodo);
@@ -296,16 +282,13 @@ organigramma_tipo_nodo_conferma_chiusura (OrganigrammaTipoNodo *organigramma_tip
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index e56841f97979ea42b315f81878d0a04f9b842018..e4ab3b0712de79772f0abaeba3502a73c6c87a46 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <libgtkform/form.h>
 #include <libgtkform/fielddatetime.h>
+#include <libsolipa/utils.h>
 
 #include "tipoprestazione.h"
 
@@ -193,12 +194,7 @@ organigramma_tipo_prestazione_carica (OrganigrammaTipoPrestazione *tipo_prestazi
 static void
 organigramma_tipo_prestazione_salva (OrganigrammaTipoPrestazione *tipo_prestazione)
 {
-       GError *error = NULL;
        gchar *sql;
-       GtkWidget *dialog;
-
-       GDate *da;
-       GDate *a;
 
        OrganigrammaTipoPrestazioneClass *klass = ORGANIGRAMMA_TIPO_PRESTAZIONE_GET_CLASS (tipo_prestazione);
 
@@ -229,13 +225,10 @@ organigramma_tipo_prestazione_salva (OrganigrammaTipoPrestazione *tipo_prestazio
                                        priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -244,13 +237,10 @@ organigramma_tipo_prestazione_salva (OrganigrammaTipoPrestazione *tipo_prestazio
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -258,7 +248,6 @@ static void
 organigramma_tipo_prestazione_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipoPrestazione *tipo_prestazione = ORGANIGRAMMA_TIPO_PRESTAZIONE (object);
-
        OrganigrammaTipoPrestazionePrivate *priv = ORGANIGRAMMA_TIPO_PRESTAZIONE_GET_PRIVATE (tipo_prestazione);
 
        switch (property_id)
@@ -273,7 +262,6 @@ static void
 organigramma_tipo_prestazione_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipoPrestazione *tipo_prestazione = ORGANIGRAMMA_TIPO_PRESTAZIONE (object);
-
        OrganigrammaTipoPrestazionePrivate *priv = ORGANIGRAMMA_TIPO_PRESTAZIONE_GET_PRIVATE (tipo_prestazione);
 
        switch (property_id)
@@ -287,8 +275,6 @@ organigramma_tipo_prestazione_get_property (GObject *object, guint property_id,
 static gboolean
 organigramma_tipo_prestazione_conferma_chiusura (OrganigrammaTipoPrestazione *tipo_prestazione)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaTipoPrestazionePrivate *priv = ORGANIGRAMMA_TIPO_PRESTAZIONE_GET_PRIVATE (tipo_prestazione);
@@ -296,16 +282,13 @@ organigramma_tipo_prestazione_conferma_chiusura (OrganigrammaTipoPrestazione *ti
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 1208333f6574a72ef271ba76041f68103edfa8ba..8c597e7dbec48598543db59e41a0d5c3fdd3f039 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "tiporapportolavoro.h"
 
@@ -190,12 +191,7 @@ organigramma_tipo_rapporto_lavoro_carica (OrganigrammaTipoRapportoLavoro *tipo_r
 static void
 organigramma_tipo_rapporto_lavoro_salva (OrganigrammaTipoRapportoLavoro *tipo_rapporto_lavoro)
 {
-       GError *error = NULL;
        gchar *sql;
-       GtkWidget *dialog;
-
-       GDate *da;
-       GDate *a;
 
        OrganigrammaTipoRapportoLavoroClass *klass = ORGANIGRAMMA_TIPO_RAPPORTO_LAVORO_GET_CLASS (tipo_rapporto_lavoro);
 
@@ -226,13 +222,10 @@ organigramma_tipo_rapporto_lavoro_salva (OrganigrammaTipoRapportoLavoro *tipo_ra
                                        priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -241,13 +234,10 @@ organigramma_tipo_rapporto_lavoro_salva (OrganigrammaTipoRapportoLavoro *tipo_ra
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -255,7 +245,6 @@ static void
 organigramma_tipo_rapporto_lavoro_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipoRapportoLavoro *tipo_rapporto_lavoro = ORGANIGRAMMA_TIPO_RAPPORTO_LAVORO (object);
-
        OrganigrammaTipoRapportoLavoroPrivate *priv = ORGANIGRAMMA_TIPO_RAPPORTO_LAVORO_GET_PRIVATE (tipo_rapporto_lavoro);
 
        switch (property_id)
@@ -270,7 +259,6 @@ static void
 organigramma_tipo_rapporto_lavoro_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipoRapportoLavoro *tipo_rapporto_lavoro = ORGANIGRAMMA_TIPO_RAPPORTO_LAVORO (object);
-
        OrganigrammaTipoRapportoLavoroPrivate *priv = ORGANIGRAMMA_TIPO_RAPPORTO_LAVORO_GET_PRIVATE (tipo_rapporto_lavoro);
 
        switch (property_id)
@@ -284,8 +272,6 @@ organigramma_tipo_rapporto_lavoro_get_property (GObject *object, guint property_
 static gboolean
 organigramma_tipo_rapporto_lavoro_conferma_chiusura (OrganigrammaTipoRapportoLavoro *tipo_rapporto_lavoro)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaTipoRapportoLavoroPrivate *priv = ORGANIGRAMMA_TIPO_RAPPORTO_LAVORO_GET_PRIVATE (tipo_rapporto_lavoro);
@@ -293,16 +279,13 @@ organigramma_tipo_rapporto_lavoro_conferma_chiusura (OrganigrammaTipoRapportoLav
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index ebdc12454fb84f28585efe0a6e597689324b1b8c..db12e05263fee260017875eea121aa90e3922077 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "tiporecapito.h"
 
@@ -190,12 +191,7 @@ organigramma_tipo_recapito_carica (OrganigrammaTipoRecapito *tipo_recapito)
 static void
 organigramma_tipo_recapito_salva (OrganigrammaTipoRecapito *tipo_recapito)
 {
-       GError *error = NULL;
        gchar *sql;
-       GtkWidget *dialog;
-
-       GDate *da;
-       GDate *a;
 
        OrganigrammaTipoRecapitoClass *klass = ORGANIGRAMMA_TIPO_RECAPITO_GET_CLASS (tipo_recapito);
 
@@ -226,13 +222,10 @@ organigramma_tipo_recapito_salva (OrganigrammaTipoRecapito *tipo_recapito)
                                        priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -241,13 +234,10 @@ organigramma_tipo_recapito_salva (OrganigrammaTipoRecapito *tipo_recapito)
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -255,7 +245,6 @@ static void
 organigramma_tipo_recapito_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipoRecapito *tipo_recapito = ORGANIGRAMMA_TIPO_RECAPITO (object);
-
        OrganigrammaTipoRecapitoPrivate *priv = ORGANIGRAMMA_TIPO_RECAPITO_GET_PRIVATE (tipo_recapito);
 
        switch (property_id)
@@ -270,7 +259,6 @@ static void
 organigramma_tipo_recapito_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTipoRecapito *tipo_recapito = ORGANIGRAMMA_TIPO_RECAPITO (object);
-
        OrganigrammaTipoRecapitoPrivate *priv = ORGANIGRAMMA_TIPO_RECAPITO_GET_PRIVATE (tipo_recapito);
 
        switch (property_id)
@@ -284,8 +272,6 @@ organigramma_tipo_recapito_get_property (GObject *object, guint property_id, GVa
 static gboolean
 organigramma_tipo_recapito_conferma_chiusura (OrganigrammaTipoRecapito *tipo_recapito)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaTipoRecapitoPrivate *priv = ORGANIGRAMMA_TIPO_RECAPITO_GET_PRIVATE (tipo_recapito);
@@ -293,16 +279,13 @@ organigramma_tipo_recapito_conferma_chiusura (OrganigrammaTipoRecapito *tipo_rec
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 5ecd53dcd7763c8a2f8e2b159616f3bb27a8eeee..0537a0d0b2448ef52d2cd7ab149b16fbbd9fdcf2 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "titoli.h"
 #include "titolo.h"
 
@@ -200,6 +202,8 @@ static void
 organigramma_titoli_carica (OrganigrammaTitoli *titoli)
 {
        GtkTreeIter iter;
+
+       gchar *sql;
        GdaDataModel *dm;
 
        gint rows;
@@ -209,18 +213,18 @@ organigramma_titoli_carica (OrganigrammaTitoli *titoli)
 
        gtk_list_store_clear (priv->lstore_titoli);
 
-       dm = gdaex_query (priv->commons->gdaex,
-                         "SELECT c.id, c.sigla, c.descrizione"
-                         " FROM titoli AS c"
-                         " WHERE c.status <> 'E'"
-                         " ORDER BY c.sigla");
+       sql = g_strdup_printf ("SELECT c.id, c.sigla, c.descrizione"
+                              " FROM titoli AS c"
+                              " WHERE c.status <> 'E'"
+                              " ORDER BY c.sigla");
+       dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        rows = gda_data_model_get_n_rows (dm);
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_titoli, &iter);
-
                                        gtk_list_store_set (priv->lstore_titoli, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_stringify_at (dm, row, "id"),
                                                            COL_SIGLA, gdaex_data_model_get_field_value_stringify_at (dm, row, "sigla"),
@@ -259,13 +263,10 @@ organigramma_titoli_modifica (OrganigrammaTitoli *titoli)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare un titolo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un titolo");
                }
 }
 
@@ -291,13 +292,10 @@ organigramma_titoli_selezionato (OrganigrammaTitoli *titoli)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un titolo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un titolo");
                }
 }
 
@@ -311,7 +309,6 @@ static void
 organigramma_titoli_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTitoli *titoli = ORGANIGRAMMA_TITOLI (object);
-
        OrganigrammaTitoliPrivate *priv = ORGANIGRAMMA_TITOLI_GET_PRIVATE (titoli);
 
        switch (property_id)
@@ -326,7 +323,6 @@ static void
 organigramma_titoli_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTitoli *titoli = ORGANIGRAMMA_TITOLI (object);
-
        OrganigrammaTitoliPrivate *priv = ORGANIGRAMMA_TITOLI_GET_PRIVATE (titoli);
 
        switch (property_id)
@@ -368,9 +364,6 @@ static void
 organigramma_titoli_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        gchar *id;
 
@@ -379,34 +372,28 @@ organigramma_titoli_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_QUESTION,
-                                                        GTK_BUTTONS_YES_NO,
-                                                        "Sicuro di voler eliminare il titolo selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il titolo selezionato?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_titoli), &iter,
                                                            COL_ID, &id,
                                                            -1);
 
                                        gdaex_execute (priv->commons->gdaex,
-                                                      g_strdup_printf ("UPDATE titoli SET status = 'E' WHERE id = %d", strtol (id, NULL, 10)));
+                                                      g_strdup_printf ("UPDATE titoli SET status = 'E' WHERE id = %d",
+                                                                       strtol (id, NULL, 10)));
 
                                        organigramma_titoli_carica (titoli);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un titolo.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un titolo.");
                }
 }
 
index 08b10d422da4d63023495449a52fff5eff9a22bc..486cda7875facb4366fd3082cc6ecbb70ff6b7df 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "titolo.h"
 
@@ -192,12 +193,7 @@ organigramma_titolo_carica (OrganigrammaTitolo *titolo)
 static void
 organigramma_titolo_salva (OrganigrammaTitolo *titolo)
 {
-       GError *error = NULL;
        gchar *sql;
-       GtkWidget *dialog;
-
-       GDate *da;
-       GDate *a;
 
        OrganigrammaTitoloClass *klass = ORGANIGRAMMA_TITOLO_GET_CLASS (titolo);
 
@@ -228,13 +224,10 @@ organigramma_titolo_salva (OrganigrammaTitolo *titolo)
                                        priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -243,13 +236,10 @@ organigramma_titolo_salva (OrganigrammaTitolo *titolo)
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -257,7 +247,6 @@ static void
 organigramma_titolo_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTitolo *titolo = ORGANIGRAMMA_TITOLO (object);
-
        OrganigrammaTitoloPrivate *priv = ORGANIGRAMMA_TITOLO_GET_PRIVATE (titolo);
 
        switch (property_id)
@@ -272,7 +261,6 @@ static void
 organigramma_titolo_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaTitolo *titolo = ORGANIGRAMMA_TITOLO (object);
-
        OrganigrammaTitoloPrivate *priv = ORGANIGRAMMA_TITOLO_GET_PRIVATE (titolo);
 
        switch (property_id)
@@ -286,8 +274,6 @@ organigramma_titolo_get_property (GObject *object, guint property_id, GValue *va
 static gboolean
 organigramma_titolo_conferma_chiusura (OrganigrammaTitolo *titolo)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaTitoloPrivate *priv = ORGANIGRAMMA_TITOLO_GET_PRIVATE (titolo);
@@ -295,16 +281,13 @@ organigramma_titolo_conferma_chiusura (OrganigrammaTitolo *titolo)
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index bfcbce34118d648e4bca882d19f336e1a77cf6e9..575df2351bbdc67539e5a8327f05279ffb5a353a 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include <libsolipa/utils.h>
+
 #include "uffici.h"
 #include "ufficio.h"
 
@@ -199,6 +201,8 @@ static void
 organigramma_uffici_carica (OrganigrammaUffici *uffici)
 {
        GtkTreeIter iter;
+
+       gchar *sql;
        GdaDataModel *dm;
 
        gint rows;
@@ -208,18 +212,18 @@ organigramma_uffici_carica (OrganigrammaUffici *uffici)
 
        gtk_list_store_clear (priv->lstore_uffici);
 
-       dm = gdaex_query (priv->commons->gdaex,
-                         "SELECT c.id, c.nome"
-                         " FROM uffici AS c"
-                         " WHERE c.status <> 'E'"
-                         " ORDER BY c.nome");
+       sql = g_strdup_printf ("SELECT c.id, c.nome"
+                              " FROM uffici AS c"
+                              " WHERE c.status <> 'E'"
+                              " ORDER BY c.nome");
+       dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        rows = gda_data_model_get_n_rows (dm);
                        for (row = 0; row < rows; row++)
                                {
                                        gtk_list_store_append (priv->lstore_uffici, &iter);
-
                                        gtk_list_store_set (priv->lstore_uffici, &iter,
                                                            COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"),
                                                            COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
@@ -257,13 +261,10 @@ organigramma_uffici_modifica (OrganigrammaUffici *uffici)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                                   GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                   GTK_MESSAGE_WARNING,
-                                                                   GTK_BUTTONS_OK,
-                                                                   "Occorre prima selezionare un ufficio");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un ufficio");
                }
 }
 
@@ -289,13 +290,10 @@ organigramma_uffici_selezionato (OrganigrammaUffici *uffici)
                }
        else
                {
-                       GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un ufficio");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un ufficio");
                }
 }
 
@@ -309,7 +307,6 @@ static void
 organigramma_uffici_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUffici *uffici = ORGANIGRAMMA_UFFICI (object);
-
        OrganigrammaUfficiPrivate *priv = ORGANIGRAMMA_UFFICI_GET_PRIVATE (uffici);
 
        switch (property_id)
@@ -324,7 +321,6 @@ static void
 organigramma_uffici_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUffici *uffici = ORGANIGRAMMA_UFFICI (object);
-
        OrganigrammaUfficiPrivate *priv = ORGANIGRAMMA_UFFICI_GET_PRIVATE (uffici);
 
        switch (property_id)
@@ -366,9 +362,6 @@ static void
 organigramma_uffici_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
-       GtkWidget *dialog;
-       gboolean risp;
-
        GtkTreeIter iter;
        guint id;
 
@@ -377,13 +370,10 @@ organigramma_uffici_on_btn_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_QUESTION,
-                                                        GTK_BUTTONS_YES_NO,
-                                                        "Sicuro di voler eliminare l'ufficio selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare l'ufficio selezionato?") == GTK_RESPONSE_YES)
                                {
                                        gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_uffici), &iter,
                                                            COL_ID, &id,
@@ -394,17 +384,13 @@ organigramma_uffici_on_btn_elimina_clicked (GtkButton *button,
 
                                        organigramma_uffici_carica (uffici);
                                }
-                       gtk_widget_destroy (dialog);
                }
        else
                {
-                       dialog = gtk_message_dialog_new (priv->wtransient,
-                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                        GTK_MESSAGE_WARNING,
-                                                        GTK_BUTTONS_OK,
-                                                        "Occorre prima selezionare un ufficio");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un ufficio");
                }
 }
 
index 9952bb43514e115c01aaf1e0fc477088082b812b..eea9c821215b33a0c6508d18268735329eebb028 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "ufficio.h"
 #include "strutture.h"
@@ -359,12 +360,7 @@ organigramma_ufficio_carica (OrganigrammaUfficio *ufficio)
 static void
 organigramma_ufficio_salva (OrganigrammaUfficio *ufficio)
 {
-       GError *error = NULL;
        gchar *sql;
-       GtkWidget *dialog;
-
-       GDate *da;
-       GDate *a;
 
        OrganigrammaUfficioClass *klass = ORGANIGRAMMA_UFFICIO_GET_CLASS (ufficio);
 
@@ -396,13 +392,10 @@ organigramma_ufficio_salva (OrganigrammaUfficio *ufficio)
                                        gtk_form_set_sensitive_by_name (priv->form, TRUE, "frame2", "frame12", "frame1", "frame4", NULL);
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        else
                {
@@ -411,13 +404,10 @@ organigramma_ufficio_salva (OrganigrammaUfficio *ufficio)
                                        gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
                                }
 
-                       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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -441,6 +431,7 @@ organigramma_ufficio_carica_nodi (OrganigrammaUfficio *ufficio)
                               " AND si.status <> 'E'",
                               priv->id);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        GtkTreeIter iter;
@@ -458,7 +449,6 @@ organigramma_ufficio_carica_nodi (OrganigrammaUfficio *ufficio)
 
                        g_object_unref (dm);
                }
-       g_free (sql);
 }
 
 static void
@@ -480,6 +470,7 @@ organigramma_ufficio_carica_stanze (OrganigrammaUfficio *ufficio)
                               " ORDER BY us.piano, us.da_stanza, us.a_stanza",
                               priv->id);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        GtkTreeIter iter;
@@ -498,7 +489,6 @@ organigramma_ufficio_carica_stanze (OrganigrammaUfficio *ufficio)
 
                        g_object_unref (dm);
                }
-       g_free (sql);
 }
 
 static void
@@ -520,6 +510,7 @@ organigramma_ufficio_carica_recapiti (OrganigrammaUfficio *ufficio)
                               " AND si.status <> 'E'",
                               priv->id);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        GtkTreeIter iter;
@@ -537,7 +528,6 @@ organigramma_ufficio_carica_recapiti (OrganigrammaUfficio *ufficio)
 
                        g_object_unref (dm);
                }
-       g_free (sql);
 }
 
 static void
@@ -558,6 +548,7 @@ organigramma_ufficio_carica_orari (OrganigrammaUfficio *ufficio)
                               " AND si.status <> 'E'",
                               priv->id);
        dm = gdaex_query (priv->commons->gdaex, sql);
+       g_free (sql);
        if (dm != NULL)
                {
                        GtkTreeIter iter;
@@ -574,14 +565,12 @@ organigramma_ufficio_carica_orari (OrganigrammaUfficio *ufficio)
 
                        g_object_unref (dm);
                }
-       g_free (sql);
 }
 
 static void
 organigramma_ufficio_nodo_modifica (OrganigrammaUfficio *ufficio)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
 
        OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (ufficio);
 
@@ -605,13 +594,10 @@ organigramma_ufficio_nodo_modifica (OrganigrammaUfficio *ufficio)
                }
        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 nodo.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo.");
                }
 }
 
@@ -619,7 +605,6 @@ static void
 organigramma_ufficio_stanza_modifica (OrganigrammaUfficio *ufficio)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
 
        OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (ufficio);
 
@@ -643,13 +628,10 @@ organigramma_ufficio_stanza_modifica (OrganigrammaUfficio *ufficio)
                }
        else
                {
-                       dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
-                                                                                        GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                                                        GTK_MESSAGE_WARNING,
-                                                                                        GTK_BUTTONS_OK,
-                                                                                        "Occorre prima selezionare una stanza.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una stanza.");
                }
 }
 
@@ -657,7 +639,6 @@ static void
 organigramma_ufficio_recapito_modifica (OrganigrammaUfficio *ufficio)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
 
        OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (ufficio);
 
@@ -681,13 +662,10 @@ organigramma_ufficio_recapito_modifica (OrganigrammaUfficio *ufficio)
                }
        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 nodo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo");
                }
 }
 
@@ -695,7 +673,6 @@ static void
 organigramma_ufficio_orario_modifica (OrganigrammaUfficio *ufficio)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
 
        OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (ufficio);
 
@@ -719,13 +696,10 @@ organigramma_ufficio_orario_modifica (OrganigrammaUfficio *ufficio)
                }
        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 orario");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un orario");
                }
 }
 
@@ -733,7 +707,6 @@ static void
 organigramma_ufficio_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUfficio *ufficio = ORGANIGRAMMA_UFFICIO (object);
-
        OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (ufficio);
 
        switch (property_id)
@@ -748,7 +721,6 @@ static void
 organigramma_ufficio_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUfficio *ufficio = ORGANIGRAMMA_UFFICIO (object);
-
        OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (ufficio);
 
        switch (property_id)
@@ -762,8 +734,6 @@ organigramma_ufficio_get_property (GObject *object, guint property_id, GValue *v
 static gboolean
 organigramma_ufficio_conferma_chiusura (OrganigrammaUfficio *ufficio)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (ufficio);
@@ -771,16 +741,13 @@ organigramma_ufficio_conferma_chiusura (OrganigrammaUfficio *ufficio)
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
@@ -892,8 +859,6 @@ organigramma_ufficio_on_btn_nodo_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
 
        OrganigrammaUfficio *ufficio = (OrganigrammaUfficio *)user_data;
 
@@ -902,13 +867,10 @@ organigramma_ufficio_on_btn_nodo_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->sel_nodi, 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'nodo selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il nodo selezionato?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -924,25 +886,21 @@ organigramma_ufficio_on_btn_nodo_elimina_clicked (GtkButton *button,
 
                                        organigramma_ufficio_carica_nodi (ufficio);
                                }
-                       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 nodo");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un nodo");
                }
 }
 
 static void
 organigramma_ufficio_on_trv_nodi_row_activated (GtkTreeView *tree_view,
                                              GtkTreePath *tree_path,
-                                                                                        GtkTreeViewColumn *column,
-                                                                                        gpointer user_data)
+                                             GtkTreeViewColumn *column,
+                                             gpointer user_data)
 {
        organigramma_ufficio_nodo_modifica ((OrganigrammaUfficio *)user_data);
 }
@@ -979,8 +937,6 @@ organigramma_ufficio_on_btn_stanza_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
 
        OrganigrammaUfficio *ufficio = (OrganigrammaUfficio *)user_data;
 
@@ -989,13 +945,10 @@ organigramma_ufficio_on_btn_stanza_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->sel_stanze, 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 la stanza selezionata?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare la stanza selezionata?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -1011,25 +964,21 @@ organigramma_ufficio_on_btn_stanza_elimina_clicked (GtkButton *button,
 
                                        organigramma_ufficio_carica_stanze (ufficio);
                                }
-                       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 una stanza.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare una stanza.");
                }
 }
 
 static void
 organigramma_ufficio_on_trv_stanze_row_activated (GtkTreeView *tree_view,
                                              GtkTreePath *tree_path,
-                                                                                        GtkTreeViewColumn *column,
-                                                                                        gpointer user_data)
+                                             GtkTreeViewColumn *column,
+                                             gpointer user_data)
 {
        organigramma_ufficio_stanza_modifica ((OrganigrammaUfficio *)user_data);
 }
@@ -1066,8 +1015,6 @@ organigramma_ufficio_on_btn_recapito_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
 
        OrganigrammaUfficio *ufficio = (OrganigrammaUfficio *)user_data;
 
@@ -1076,13 +1023,10 @@ organigramma_ufficio_on_btn_recapito_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->sel_recapiti, 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 il recapito selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare il recapito selezionato?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -1098,25 +1042,21 @@ organigramma_ufficio_on_btn_recapito_elimina_clicked (GtkButton *button,
 
                                        organigramma_ufficio_carica_recapiti (ufficio);
                                }
-                       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 recapito.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un recapito.");
                }
 }
 
 static void
 organigramma_ufficio_on_trv_recapiti_row_activated (GtkTreeView *tree_view,
                                              GtkTreePath *tree_path,
-                                                                                        GtkTreeViewColumn *column,
-                                                                                        gpointer user_data)
+                                             GtkTreeViewColumn *column,
+                                             gpointer user_data)
 {
        organigramma_ufficio_recapito_modifica ((OrganigrammaUfficio *)user_data);
 }
@@ -1153,8 +1093,6 @@ organigramma_ufficio_on_btn_orario_elimina_clicked (GtkButton *button,
                                     gpointer user_data)
 {
        GtkTreeIter iter;
-       GtkWidget *dialog;
-       guint risp;
 
        OrganigrammaUfficio *ufficio = (OrganigrammaUfficio *)user_data;
 
@@ -1163,13 +1101,10 @@ organigramma_ufficio_on_btn_orario_elimina_clicked (GtkButton *button,
 
        if (gtk_tree_selection_get_selected (priv->sel_orari, 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'orario selezionato?");
-                       risp = gtk_dialog_run (GTK_DIALOG (dialog));
-                       if (risp == GTK_RESPONSE_YES)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler eliminare l'orario selezionato?") == GTK_RESPONSE_YES)
                                {
                                        guint id;
 
@@ -1185,25 +1120,21 @@ organigramma_ufficio_on_btn_orario_elimina_clicked (GtkButton *button,
 
                                        organigramma_ufficio_carica_orari (ufficio);
                                }
-                       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 orario.");
-                       gtk_dialog_run (GTK_DIALOG (dialog));
-                       gtk_widget_destroy (dialog);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Occorre prima selezionare un orario.");
                }
 }
 
 static void
 organigramma_ufficio_on_trv_orari_row_activated (GtkTreeView *tree_view,
                                              GtkTreePath *tree_path,
-                                                                                        GtkTreeViewColumn *column,
-                                                                                        gpointer user_data)
+                                             GtkTreeViewColumn *column,
+                                             gpointer user_data)
 {
        organigramma_ufficio_orario_modifica ((OrganigrammaUfficio *)user_data);
 }
index ebd54fa4ba9d60603247c148fc5ff88fc31a2b7e..2779982d5be053849699c973ba5417edfafd6f61 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "ufficionodo.h"
 #include "nodi.h"
@@ -219,7 +220,6 @@ static void
 organigramma_ufficio_nodo_salva (OrganigrammaUfficioNodo *organigramma_ufficio_nodo)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaUfficioNodoClass *klass = ORGANIGRAMMA_UFFICIO_NODO_GET_CLASS (organigramma_ufficio_nodo);
 
@@ -250,23 +250,17 @@ organigramma_ufficio_nodo_salva (OrganigrammaUfficioNodo *organigramma_ufficio_n
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio");
                }
 }
 
@@ -274,7 +268,6 @@ static void
 organigramma_ufficio_nodo_on_nodo_selezionato (gpointer instance, guint id, gpointer user_data)
 {
        OrganigrammaUfficioNodo *ia = (OrganigrammaUfficioNodo *)user_data;
-
        OrganigrammaUfficioNodoPrivate *priv = ORGANIGRAMMA_UFFICIO_NODO_GET_PRIVATE (ia);
 
        gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label37"), g_strdup_printf ("%d", id));
@@ -284,7 +277,6 @@ static void
 organigramma_ufficio_nodo_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUfficioNodo *organigramma_ufficio_nodo = ORGANIGRAMMA_UFFICIO_NODO (object);
-
        OrganigrammaUfficioNodoPrivate *priv = ORGANIGRAMMA_UFFICIO_NODO_GET_PRIVATE (organigramma_ufficio_nodo);
 
        switch (property_id)
@@ -299,7 +291,6 @@ static void
 organigramma_ufficio_nodo_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUfficioNodo *organigramma_ufficio_nodo = ORGANIGRAMMA_UFFICIO_NODO (object);
-
        OrganigrammaUfficioNodoPrivate *priv = ORGANIGRAMMA_UFFICIO_NODO_GET_PRIVATE (organigramma_ufficio_nodo);
 
        switch (property_id)
@@ -313,8 +304,6 @@ organigramma_ufficio_nodo_get_property (GObject *object, guint property_id, GVal
 static gboolean
 organigramma_ufficio_nodo_conferma_chiusura (OrganigrammaUfficioNodo *organigramma_ufficio_nodo)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaUfficioNodoPrivate *priv = ORGANIGRAMMA_UFFICIO_NODO_GET_PRIVATE (organigramma_ufficio_nodo);
@@ -323,16 +312,13 @@ organigramma_ufficio_nodo_conferma_chiusura (OrganigrammaUfficioNodo *organigram
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 61cd946ba6dc6a2454922877bddcdd67a48f656f..827e137f983b491b3ebaf28dc03c557671e96596 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "ufficioorario.h"
 
@@ -206,7 +207,6 @@ static void
 organigramma_ufficio_orario_salva (OrganigrammaUfficioOrario *organigramma_ufficio_orario)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaUfficioOrarioClass *klass = ORGANIGRAMMA_UFFICIO_ORARIO_GET_CLASS (organigramma_ufficio_orario);
 
@@ -237,23 +237,17 @@ organigramma_ufficio_orario_salva (OrganigrammaUfficioOrario *organigramma_uffic
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio");
                }
 }
 
@@ -261,7 +255,6 @@ static void
 organigramma_ufficio_orario_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUfficioOrario *organigramma_ufficio_orario = ORGANIGRAMMA_UFFICIO_ORARIO (object);
-
        OrganigrammaUfficioOrarioPrivate *priv = ORGANIGRAMMA_UFFICIO_ORARIO_GET_PRIVATE (organigramma_ufficio_orario);
 
        switch (property_id)
@@ -276,7 +269,6 @@ static void
 organigramma_ufficio_orario_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUfficioOrario *organigramma_ufficio_orario = ORGANIGRAMMA_UFFICIO_ORARIO (object);
-
        OrganigrammaUfficioOrarioPrivate *priv = ORGANIGRAMMA_UFFICIO_ORARIO_GET_PRIVATE (organigramma_ufficio_orario);
 
        switch (property_id)
@@ -290,8 +282,6 @@ organigramma_ufficio_orario_get_property (GObject *object, guint property_id, GV
 static gboolean
 organigramma_ufficio_orario_conferma_chiusura (OrganigrammaUfficioOrario *organigramma_ufficio_orario)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaUfficioOrarioPrivate *priv = ORGANIGRAMMA_UFFICIO_ORARIO_GET_PRIVATE (organigramma_ufficio_orario);
@@ -300,16 +290,13 @@ organigramma_ufficio_orario_conferma_chiusura (OrganigrammaUfficioOrario *organi
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 8f064e5e740ecb2b7d72654706544f53e0408eb1..7a007dca79a1405deba5828b4631694d7f0e9704 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "ufficiorecapito.h"
 
@@ -206,7 +207,6 @@ static void
 organigramma_ufficio_recapito_salva (OrganigrammaUfficioRecapito *organigramma_ufficio_recapito)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaUfficioRecapitoClass *klass = ORGANIGRAMMA_UFFICIO_RECAPITO_GET_CLASS (organigramma_ufficio_recapito);
 
@@ -237,23 +237,17 @@ organigramma_ufficio_recapito_salva (OrganigrammaUfficioRecapito *organigramma_u
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio");
                }
 }
 
@@ -261,7 +255,6 @@ static void
 organigramma_ufficio_recapito_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUfficioRecapito *organigramma_ufficio_recapito = ORGANIGRAMMA_UFFICIO_RECAPITO (object);
-
        OrganigrammaUfficioRecapitoPrivate *priv = ORGANIGRAMMA_UFFICIO_RECAPITO_GET_PRIVATE (organigramma_ufficio_recapito);
 
        switch (property_id)
@@ -276,7 +269,6 @@ static void
 organigramma_ufficio_recapito_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUfficioRecapito *organigramma_ufficio_recapito = ORGANIGRAMMA_UFFICIO_RECAPITO (object);
-
        OrganigrammaUfficioRecapitoPrivate *priv = ORGANIGRAMMA_UFFICIO_RECAPITO_GET_PRIVATE (organigramma_ufficio_recapito);
 
        switch (property_id)
@@ -290,8 +282,6 @@ organigramma_ufficio_recapito_get_property (GObject *object, guint property_id,
 static gboolean
 organigramma_ufficio_recapito_conferma_chiusura (OrganigrammaUfficioRecapito *organigramma_ufficio_recapito)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaUfficioRecapitoPrivate *priv = ORGANIGRAMMA_UFFICIO_RECAPITO_GET_PRIVATE (organigramma_ufficio_recapito);
@@ -300,16 +290,13 @@ organigramma_ufficio_recapito_conferma_chiusura (OrganigrammaUfficioRecapito *or
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;
index 83b62349eddf76344c31376dbe59b42b7fdd2ac7..da299acddbd73e4b4adf46b3dbc6714e3c3ee2fa 100644 (file)
@@ -22,6 +22,7 @@
 #endif
 
 #include <libgtkform/form.h>
+#include <libsolipa/utils.h>
 
 #include "ufficiostanza.h"
 
@@ -206,7 +207,6 @@ static void
 organigramma_ufficio_stanza_salva (OrganigrammaUfficioStanza *organigramma_ufficio_stanza)
 {
        gchar *sql;
-       GtkWidget *dialog;
 
        OrganigrammaUfficioStanzaClass *klass = ORGANIGRAMMA_UFFICIO_STANZA_GET_CLASS (organigramma_ufficio_stanza);
 
@@ -237,23 +237,17 @@ organigramma_ufficio_stanza_salva (OrganigrammaUfficioStanza *organigramma_uffic
 
                        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_INFO,
+                                              GTK_BUTTONS_OK,
+                                              "Salvataggio eseguito con successo.");
                }
        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);
+                       solipa_message_dialog (priv->w,
+                                              GTK_MESSAGE_WARNING,
+                                              GTK_BUTTONS_OK,
+                                              "Errore durante il salvataggio.");
                }
 }
 
@@ -261,7 +255,6 @@ static void
 organigramma_ufficio_stanza_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUfficioStanza *organigramma_ufficio_stanza = ORGANIGRAMMA_UFFICIO_STANZA (object);
-
        OrganigrammaUfficioStanzaPrivate *priv = ORGANIGRAMMA_UFFICIO_STANZA_GET_PRIVATE (organigramma_ufficio_stanza);
 
        switch (property_id)
@@ -276,7 +269,6 @@ static void
 organigramma_ufficio_stanza_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
        OrganigrammaUfficioStanza *organigramma_ufficio_stanza = ORGANIGRAMMA_UFFICIO_STANZA (object);
-
        OrganigrammaUfficioStanzaPrivate *priv = ORGANIGRAMMA_UFFICIO_STANZA_GET_PRIVATE (organigramma_ufficio_stanza);
 
        switch (property_id)
@@ -290,8 +282,6 @@ organigramma_ufficio_stanza_get_property (GObject *object, guint property_id, GV
 static gboolean
 organigramma_ufficio_stanza_conferma_chiusura (OrganigrammaUfficioStanza *organigramma_ufficio_stanza)
 {
-       GtkWidget *dialog;
-
        gboolean ret;
 
        OrganigrammaUfficioStanzaPrivate *priv = ORGANIGRAMMA_UFFICIO_STANZA_GET_PRIVATE (organigramma_ufficio_stanza);
@@ -300,16 +290,13 @@ organigramma_ufficio_stanza_conferma_chiusura (OrganigrammaUfficioStanza *organi
 
        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)
+                       if (solipa_message_dialog (priv->w,
+                                                  GTK_MESSAGE_QUESTION,
+                                                  GTK_BUTTONS_YES_NO,
+                                                  "Sicuro di voler chiudere senza salvare?") == GTK_RESPONSE_NO)
                                {
                                        ret = FALSE;
                                }
-                       gtk_widget_destroy (dialog);
                }
 
        return ret;