]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Tolta la combobox titoli in persana (refs #645 #646).
authorAndrea Zagli <azagli@libero.it>
Sun, 13 Nov 2016 09:49:46 +0000 (10:49 +0100)
committerAndrea Zagli <azagli@libero.it>
Sun, 13 Nov 2016 09:49:46 +0000 (10:49 +0100)
configure.ac
data/organigramma/form/persona.form
data/organigramma/gui/organigramma.gui
src/persona.c

index 2003879cb1b98e4450ae658d3a5bfb49669f7acd..6300c9175258da2b7f42d0373a59d85a25f8b26f 100644 (file)
@@ -47,6 +47,7 @@ PKG_CHECK_MODULES(ORGANIGRAMMA, [gio-2.0 >= 2.36
                                  libzakutils
                                  libgdaexgrid
                                  libgtkform >= 0.5.0
+                                 libgtkformui >= 0.5.0
                                  libzakconfi >= 0.10.0
                                  libzakauthe >= 0.5.99
                                  libzakautho >= 0.0.5
index fcb243b73f76aa8762a29a245147b7bfe96fa2e6..50999e314991bd0a3645431231c95c0bd2c04476 100644 (file)
                </field>
        </widget>
 
-       <widget type="combobox" name="combobox4" label="label73">
-               <column-field>0</column-field>
-               <sql with-empty-entry="t">
-                       SELECT id, descrizione FROM titoli WHERE status &lt;&gt; 'E' ORDER BY descrizione
-               </sql>
+       <widget type="decoder" name="gtkformdecoder24" label="label73">
+               <decoder>
+                       <sql>
+                               SELECT a.descrizione
+                               FROM titoli AS a
+                               WHERE a.id = ##key0::gint
+                       </sql>
+               </decoder>
                <field type="integer" name="id_titoli">
                </field>
        </widget>
index 02dc7ff62fdd5fb1bcb0a20a81a5380db359b1df..42c6a4939f4181a349a1a6a78c4bb021c7e2599c 100644 (file)
                 <property name="top_attach">2</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkComboBox" id="combobox4">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-                <child>
-                  <object class="GtkCellRendererText" id="cellrenderertext38"/>
-                  <attributes>
-                    <attribute name="text">1</attribute>
-                  </attributes>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">3</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkNotebook" id="notebook1">
                 <property name="visible">True</property>
                 <property name="top_attach">0</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkFormDecoder" id="gtkformdecoder24">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">3</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">True</property>
index a6ad87b849423e97b17d4c1e25eac65ec720cb83..410853623c1ddf8cf2bcc1b2da283d8d3cf54866 100644 (file)
@@ -24,6 +24,7 @@
 #include <libzakautho/autoz.h>
 #include <libgtkform/form.h>
 #include <libgtkform/fielddatetime.h>
+#include <libgtkformui/gtkformdecoder.h>
 #include <libsolipa/utils.h>
 
 #include <libterritorio/comuni.h>
@@ -35,6 +36,7 @@
 #include "personaufficio.h"
 #include "personaufficiorecapito.h"
 #include "personarecapito.h"
+#include "titoli.h"
 
 static void organigramma_persona_class_init (OrganigrammaPersonaClass *klass);
 static void organigramma_persona_init (OrganigrammaPersona *persona);
@@ -74,12 +76,15 @@ static void organigramma_persona_on_ufficio_aggiornato (gpointer instance, gpoin
 static void organigramma_persona_on_ufficio_recapito_aggiornato (gpointer instance, gpointer user_data);
 static void organigramma_persona_on_recapito_aggiornato (gpointer instance, gpointer user_data);
 
+static void organigramma_persona_on_titolo_selezionato (gpointer instance, guint id, gpointer user_data);
 static void organigramma_persona_on_comune_selezionato (gpointer instance, guint id, gpointer user_data);
 
 static gboolean organigramma_persona_on_w_organigramma_persona_delete_event (GtkWidget *widget,
                                GdkEvent *event,
                                gpointer user_data);
 
+static void organigramma_persona_on_btn_ricerca_titolo_clicked (GtkButton *button,
+                                    gpointer user_data);
 static void organigramma_persona_on_btn_ricerca_comune_clicked (GtkButton *button,
                                     gpointer user_data);
 
@@ -297,8 +302,7 @@ OrganigrammaPersona
        error = NULL;
        gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
                                           g_strsplit (g_strconcat (
-                                          "lstore_titoli"
-                                          "|lstore_persona_incarichi"
+                                          "lstore_persona_incarichi"
                                           "|lstore_persona_nodi"
                                           "|lstore_persona_nodo_recapiti"
                                           "|lstore_persona_uffici"
@@ -344,6 +348,8 @@ OrganigrammaPersona
        g_signal_connect (priv->sel_uffici,
                          "changed", G_CALLBACK (organigramma_persona_on_uffici_sel_changed), (gpointer)a);
 
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "gtkformdecoder24"),
+                         "btn-browse-clicked", G_CALLBACK (organigramma_persona_on_btn_ricerca_titolo_clicked), (gpointer)a);
        g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button89")),
                          "clicked", G_CALLBACK (organigramma_persona_on_btn_ricerca_comune_clicked), (gpointer)a);
 
@@ -1188,6 +1194,17 @@ organigramma_persona_on_recapito_aggiornato (gpointer instance, gpointer user_da
        organigramma_persona_carica_recapiti (persona);
 }
 
+static void
+organigramma_persona_on_titolo_selezionato (gpointer instance, guint id, gpointer user_data)
+{
+       OrganigrammaPersona *ia = (OrganigrammaPersona *)user_data;
+
+       OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (ia);
+
+       gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "gtkformdecoder24"),
+                                            g_strdup_printf ("%d", id));
+}
+
 static void
 organigramma_persona_on_comune_selezionato (gpointer instance, guint id, gpointer user_data)
 {
@@ -1206,6 +1223,25 @@ organigramma_persona_on_w_organigramma_persona_delete_event (GtkWidget *widget,
        return !organigramma_persona_conferma_chiusura ((OrganigrammaPersona *)user_data);
 }
 
+static void
+organigramma_persona_on_btn_ricerca_titolo_clicked (GtkButton *button,
+                        gpointer user_data)
+{
+       GtkWidget *w;
+
+       OrganigrammaPersona *ia = (OrganigrammaPersona *)user_data;
+       OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (ia);
+
+       OrganigrammaTitoli *c = organigramma_titoli_new (priv->commons, TRUE);
+
+       g_signal_connect (G_OBJECT (c), "selezionato",
+                         G_CALLBACK (organigramma_persona_on_titolo_selezionato), user_data);
+
+       w = organigramma_titoli_get_widget (c);
+       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+       gtk_widget_show (w);
+}
+
 static void
 organigramma_persona_on_btn_ricerca_comune_clicked (GtkButton *button,
                                     gpointer user_data)