]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Tolta la combobox tipo rapporto lavoro in persona incarico (refs #645 #646).
authorAndrea Zagli <azagli@libero.it>
Sun, 13 Nov 2016 10:14:50 +0000 (11:14 +0100)
committerAndrea Zagli <azagli@libero.it>
Sun, 13 Nov 2016 10:14:50 +0000 (11:14 +0100)
data/organigramma/form/persona_incarico.form
data/organigramma/gui/organigramma.gui
src/personaincarico.c

index 1036218e10bc6cb82761dac5c9b7f5896a72ee56..23abe28903599fb57b848e3bacb6f564ac8858d1 100644 (file)
                </field>
        </widget>
 
-       <widget type="combobox" name="combobox8" label="label133">
-               <column-field>0</column-field>
-               <sql with-empty-entry="t">
-                       SELECT id, nome FROM tipi_rapporto_lavoro WHERE status &lt;&gt; 'E' ORDER BY nome
-               </sql>
+       <widget type="decoder" name="gtkformdecoder2" label="label133">
+               <decoder>
+                       <sql>
+                               SELECT a.nome
+                               FROM tipi_rapporto_lavoro AS a
+                               WHERE a.id = ##key0::gint
+                       </sql>
+               </decoder>
                <field type="integer" name="id_tipi_rapporto_lavoro">
                </field>
        </widget>
index 42c6a4939f4181a349a1a6a78c4bb021c7e2599c..36d97d3f3c3b5428bdd798fdcd712b9161f33ebd 100644 (file)
                 <property name="top_attach">9</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkComboBox" id="combobox8">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-                <child>
-                  <object class="GtkCellRendererText" id="cellrenderertext32"/>
-                  <attributes>
-                    <attribute name="text">1</attribute>
-                  </attributes>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkComboBox" id="combobox9">
                 <property name="visible">True</property>
                 <property name="top_attach">9</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkFormDecoder" id="gtkformdecoder2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">True</property>
index 3df78ee1e38e159c976a541b4dc7e42a7bebd53c..d86db582fd9bae1ee3f3912b6691edb8e09ec0d7 100644 (file)
 
 #include <libzakautho/autoz.h>
 #include <libgtkform/form.h>
+#include <libgtkformui/gtkformdecoder.h>
 #include <libsolipa/utils.h>
 
 #include "personaincarico.h"
 #include "nodi.h"
+#include "tipirapportolavoro.h"
 
 static void organigramma_persona_incarico_class_init (OrganigrammaPersonaIncaricoClass *klass);
 static void organigramma_persona_incarico_init (OrganigrammaPersonaIncarico *organigramma_persona_incarico);
@@ -51,6 +53,11 @@ static gboolean organigramma_persona_incarico_on_w_organigramma_persona_incarico
                                GdkEvent *event,
                                gpointer user_data);
 
+static void organigramma_persona_incarico_on_tipo_rapporto_lavoro_selezionato (gpointer instance, guint id, gpointer user_data);
+
+static void organigramma_persona_incarico_on_btn_ricerca_tipo_rapporto_lavoro_clicked (GtkButton *button,
+                                    gpointer user_data);
+
 static void organigramma_persona_incarico_on_btn_annulla_clicked (GtkButton *button,
                                     gpointer user_data);
 static void organigramma_persona_incarico_on_btn_salva_clicked (GtkButton *button,
@@ -139,8 +146,7 @@ OrganigrammaPersonaIncarico
 
        gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
                                           g_strsplit (
-                                          "lstore_tipi_rapporto_lavoro"
-                                          "|lstore_posizioni_economiche"
+                                          "lstore_posizioni_economiche"
                                           "|lstore_tipi_prestazione"
                                           "|lstore_profili_professionali"
                                           "|w_persona_incarico", "|", -1),
@@ -165,6 +171,9 @@ OrganigrammaPersonaIncarico
        g_signal_connect (priv->w,
                          "delete-event", G_CALLBACK (organigramma_persona_incarico_on_w_organigramma_persona_incarico_delete_event), (gpointer)a);
 
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "gtkformdecoder2"),
+                         "btn-browse-clicked", G_CALLBACK (organigramma_persona_incarico_on_btn_ricerca_tipo_rapporto_lavoro_clicked), (gpointer)a);
+
        g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button98")),
                          "clicked", G_CALLBACK (organigramma_persona_incarico_on_btn_annulla_clicked), (gpointer)a);
        g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button99")),
@@ -338,6 +347,36 @@ organigramma_persona_incarico_on_w_organigramma_persona_incarico_delete_event (G
        return !organigramma_persona_incarico_conferma_chiusura ((OrganigrammaPersonaIncarico *)user_data);
 }
 
+static void
+organigramma_persona_incarico_on_tipo_rapporto_lavoro_selezionato (gpointer instance, guint id, gpointer user_data)
+{
+       OrganigrammaPersonaIncarico *ia = (OrganigrammaPersonaIncarico *)user_data;
+
+       OrganigrammaPersonaIncaricoPrivate *priv = ORGANIGRAMMA_PERSONA_INCARICO_GET_PRIVATE (ia);
+
+       gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "gtkformdecoder2"),
+                                            g_strdup_printf ("%d", id));
+}
+
+static void
+organigramma_persona_incarico_on_btn_ricerca_tipo_rapporto_lavoro_clicked (GtkButton *button,
+                        gpointer user_data)
+{
+       GtkWidget *w;
+
+       OrganigrammaPersonaIncarico *ia = (OrganigrammaPersonaIncarico *)user_data;
+       OrganigrammaPersonaIncaricoPrivate *priv = ORGANIGRAMMA_PERSONA_INCARICO_GET_PRIVATE (ia);
+
+       OrganigrammaTipiRapportoLavoro *c = organigramma_tipi_rapporto_lavoro_new (priv->commons, TRUE);
+
+       g_signal_connect (G_OBJECT (c), "selezionato",
+                         G_CALLBACK (organigramma_persona_incarico_on_tipo_rapporto_lavoro_selezionato), user_data);
+
+       w = organigramma_tipi_rapporto_lavoro_get_widget (c);
+       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+       gtk_widget_show (w);
+}
+
 static void
 organigramma_persona_incarico_on_btn_annulla_clicked (GtkButton *button,
                         gpointer user_data)