]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Tolta la combobox tipo recapito in persona recapito (closes #645 refs #646).
authorAndrea Zagli <azagli@libero.it>
Thu, 8 Dec 2016 09:26:20 +0000 (10:26 +0100)
committerAndrea Zagli <azagli@libero.it>
Thu, 8 Dec 2016 09:26:20 +0000 (10:26 +0100)
data/organigramma/form/persona_recapito.form
data/organigramma/gui/organigramma.gui
src/personarecapito.c

index 8bb7d19c8a6af8862665495a97f0ba0538e97034..993b2fe82a7f5a57b681f58da7fec6520e6581e3 100644 (file)
                </field>
        </widget>
 
-       <widget type="combobox" name="combobox6" label="label102">
-               <column-field>0</column-field>
-               <sql with-empty-entry="t">
-                       SELECT id, nome FROM tipi_recapito WHERE status &lt;&gt; 'E' ORDER BY nome
-               </sql>
+       <widget type="decoder" name="gtkformdecoder10" label="label102">
+               <decoder>
+                       <sql>
+                               SELECT a.nome
+                               FROM tipi_recapito AS a
+                               WHERE a.id = ##key0::gint
+                       </sql>
+               </decoder>
                <field type="integer" name="id_tipi_recapito">
                        <obligatory>t</obligatory>
                </field>
index e599634eb5eaa3226713421ffe6faae8068a352c..8458403604375f65b2ecec6cb808538498ab19d2 100644 (file)
                 <property name="top_attach">1</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkComboBox" id="combobox6">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-                <child>
-                  <object class="GtkCellRendererText" id="cellrenderertext23"/>
-                  <attributes>
-                    <attribute name="text">1</attribute>
-                  </attributes>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkCheckButton" id="checkbutton10">
                 <property name="visible">True</property>
                 <property name="top_attach">4</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkFormDecoder" id="gtkformdecoder10">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">True</property>
index 03a499910438cd628bd0ad5efb4d96f1ece044a3..5ecb8be097467efce956cdad2f74436bf6e4e5bc 100644 (file)
 
 #include <libzakautho/autoz.h>
 #include <libgtkform/form.h>
+#include <libgtkformui/gtkformdecoder.h>
 #include <libsolipa/utils.h>
 
 #include "personarecapito.h"
+#include "tipirecapito.h"
 
 static void organigramma_persona_recapito_class_init (OrganigrammaPersonaRecapitoClass *klass);
 static void organigramma_persona_recapito_init (OrganigrammaPersonaRecapito *organigramma_persona_recapito);
@@ -35,6 +37,8 @@ static void organigramma_persona_recapito_init (OrganigrammaPersonaRecapito *org
 static void organigramma_persona_recapito_carica (OrganigrammaPersonaRecapito *organigramma_persona_recapito);
 static void organigramma_persona_recapito_salva (OrganigrammaPersonaRecapito *organigramma_persona_recapito, gboolean chiudi);
 
+static void organigramma_persona_recapito_on_tipo_recapito_selezionato (gpointer instance, guint id, gpointer user_data);
+
 static gboolean organigramma_persona_recapito_conferma_chiusura (OrganigrammaPersonaRecapito *organigramma_persona_recapito);
 
 static void organigramma_persona_recapito_set_property (GObject *object,
@@ -50,6 +54,9 @@ static gboolean organigramma_persona_recapito_on_w_organigramma_persona_recapito
                                GdkEvent *event,
                                gpointer user_data);
 
+static void organigramma_persona_recapito_on_btn_tipo_recapito_clicked (GtkButton *button,
+                      gpointer user_data);
+
 static void organigramma_persona_recapito_on_btn_annulla_clicked (GtkButton *button,
                                     gpointer user_data);
 static void organigramma_persona_recapito_on_btn_salva_clicked (GtkButton *button,
@@ -159,6 +166,9 @@ OrganigrammaPersonaRecapito
        g_signal_connect (priv->w,
                          "delete-event", G_CALLBACK (organigramma_persona_recapito_on_w_organigramma_persona_recapito_delete_event), (gpointer)a);
 
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "gtkformdecoder10"),
+                         "btn-browse-clicked", G_CALLBACK (organigramma_persona_recapito_on_btn_tipo_recapito_clicked), (gpointer)a);
+
        g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button87")),
                          "clicked", G_CALLBACK (organigramma_persona_recapito_on_btn_annulla_clicked), (gpointer)a);
        g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button88")),
@@ -326,6 +336,16 @@ organigramma_persona_recapito_conferma_chiusura (OrganigrammaPersonaRecapito *or
 }
 
 /* CALLBACK */
+static void
+organigramma_persona_recapito_on_tipo_recapito_selezionato (gpointer instance, guint id, gpointer user_data)
+{
+       OrganigrammaPersonaRecapito *f = (OrganigrammaPersonaRecapito *)user_data;
+       OrganigrammaPersonaRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_RECAPITO_GET_PRIVATE (f);
+
+       gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "gtkformdecoder10"),
+                                            g_strdup_printf ("%d", id));
+}
+
 static gboolean
 organigramma_persona_recapito_on_w_organigramma_persona_recapito_delete_event (GtkWidget *widget,
                                GdkEvent *event,
@@ -352,6 +372,25 @@ organigramma_persona_recapito_on_btn_salva_clicked (GtkButton *button,
        organigramma_persona_recapito_salva ((OrganigrammaPersonaRecapito *)user_data, FALSE);
 }
 
+static void
+organigramma_persona_recapito_on_btn_tipo_recapito_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       GtkWidget *w;
+
+       OrganigrammaPersonaRecapito *rf = (OrganigrammaPersonaRecapito *)user_data;
+       OrganigrammaPersonaRecapitoPrivate *priv = ORGANIGRAMMA_PERSONA_RECAPITO_GET_PRIVATE (rf);
+
+       OrganigrammaTipiRecapito *c = organigramma_tipi_recapito_new (priv->commons, TRUE);
+
+       g_signal_connect (G_OBJECT (c), "selezionato",
+                         G_CALLBACK (organigramma_persona_recapito_on_tipo_recapito_selezionato), user_data);
+
+       w = organigramma_tipi_recapito_get_widget (c);
+       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+       gtk_widget_show (w);
+}
+
 static void
 organigramma_persona_recapito_on_btn_salvaechiudi_clicked (GtkButton *button,
                       gpointer user_data)