]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Tolta la combobox tipi nodo in nodo (refs #645 #646).
authorAndrea Zagli <azagli@libero.it>
Sun, 13 Nov 2016 11:56:58 +0000 (12:56 +0100)
committerAndrea Zagli <azagli@libero.it>
Sun, 13 Nov 2016 11:56:58 +0000 (12:56 +0100)
data/organigramma/form/nodo.form
data/organigramma/gui/organigramma.gui
src/nodo.c

index 6cd191d79ad036dce0edaee75cf4355aeb94383b..825623fa108a80a83d6da1e79b0012344ac908d7 100644 (file)
                </field>
        </widget>
 
-       <widget type="combobox" name="combobox1" label="label1">
-               <column-field>0</column-field>
-               <sql with-empty-entry="t">
-                       SELECT id, nome FROM tipi_nodo WHERE status &lt;&gt; 'E' ORDER BY nome
-               </sql>
+       <widget type="decoder" name="gtkformdecoder6" label="label1">
+               <decoder>
+                       <sql>
+                               SELECT a.nome
+                               FROM tipi_nodo AS a
+                               WHERE a.id = ##key0::gint
+                       </sql>
+               </decoder>
                <field type="integer" name="id_tipi_nodo">
-                       <obligatory>t</obligatory>
                </field>
        </widget>
 
index d315d89c343a72cb7e01559627e82ee05e01ee68..e3045d592355e11b6f7c988964124ea437e6f744 100644 (file)
                 <property name="top_attach">2</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkComboBox" id="combobox1">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
-                <child>
-                  <object class="GtkCellRendererText" id="cellrenderertext3"/>
-                  <attributes>
-                    <attribute name="text">1</attribute>
-                  </attributes>
-                </child>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
-              </packing>
-            </child>
             <child>
               <object class="GtkLabel" id="label2">
                 <property name="visible">True</property>
                 <property name="top_attach">0</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkFormDecoder" id="gtkformdecoder6">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">True</property>
index 51fe8ff7568beb1197bab596f8a44a861f293fcc..0aa53cece884657fdea29ffb8a0ad0ef9f9070b0 100644 (file)
 
 #include <libzakautho/autoz.h>
 #include <libgtkform/form.h>
+#include <libgtkformui/gtkformdecoder.h>
 #include <libsolipa/utils.h>
 
 #include "nodo.h"
 #include "nodi.h"
+#include "tipinodo.h"
 
 static void organigramma_nodo_class_init (OrganigrammaNodoClass *klass);
 static void organigramma_nodo_init (OrganigrammaNodo *nodo);
@@ -46,6 +48,7 @@ static void organigramma_nodo_get_property (GObject *object,
                                      GParamSpec *pspec);
 
 static void organigramma_nodo_on_organigramma_nodo_selezionato (gpointer instance, guint id, gpointer user_data);
+static void organigramma_nodo_on_tipo_nodo_selezionato (gpointer instance, guint id, gpointer user_data);
 
 static void organigramma_nodo_on_organigramma_nodo_pulisci (GtkEntry *entry,
                           GtkEntryIconPosition icon_pos,
@@ -53,6 +56,8 @@ static void organigramma_nodo_on_organigramma_nodo_pulisci (GtkEntry *entry,
                           gpointer user_data);
 static void organigramma_nodo_on_btn_organigramma_nodo_clicked (GtkButton *button,
                       gpointer user_data);
+static void organigramma_nodo_on_btn_tipo_nodo_clicked (GtkButton *button,
+                      gpointer user_data);
 
 static gboolean organigramma_nodo_on_w_organigramma_nodo_delete_event (GtkWidget *widget,
                                GdkEvent *event,
@@ -141,7 +146,7 @@ OrganigrammaNodo
 
        error = NULL;
        gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
-                                          g_strsplit ("lstore_tipi_nodo|w_nodo", "|", -1),
+                                          g_strsplit ("w_nodo", "|", -1),
                                           &error);
        if (error != NULL)
                {
@@ -168,6 +173,8 @@ OrganigrammaNodo
                          "icon-press", G_CALLBACK (organigramma_nodo_on_organigramma_nodo_pulisci), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button6"),
                          "clicked", G_CALLBACK (organigramma_nodo_on_btn_organigramma_nodo_clicked), (gpointer)a);
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "gtkformdecoder6"),
+                         "btn-browse-clicked", G_CALLBACK (organigramma_nodo_on_btn_tipo_nodo_clicked), (gpointer)a);
 
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button4"),
                          "clicked", G_CALLBACK (organigramma_nodo_on_btn_annulla_clicked), (gpointer)a);
@@ -345,6 +352,16 @@ organigramma_nodo_on_organigramma_nodo_selezionato (gpointer instance, guint id,
        gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label5"), g_strdup_printf ("%d", id));
 }
 
+static void
+organigramma_nodo_on_tipo_nodo_selezionato (gpointer instance, guint id, gpointer user_data)
+{
+       OrganigrammaNodo *f = (OrganigrammaNodo *)user_data;
+       OrganigrammaNodoPrivate *priv = ORGANIGRAMMA_NODO_GET_PRIVATE (f);
+
+       gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "gtkformdecoder6"),
+                                            g_strdup_printf ("%d", id));
+}
+
 static void
 organigramma_nodo_on_organigramma_nodo_pulisci (GtkEntry *entry,
                           GtkEntryIconPosition icon_pos,
@@ -378,6 +395,26 @@ organigramma_nodo_on_btn_organigramma_nodo_clicked (GtkButton *button,
        gtk_widget_show (w);
 }
 
+static void
+organigramma_nodo_on_btn_tipo_nodo_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       GtkWidget *w;
+
+       OrganigrammaNodo *rf = (OrganigrammaNodo *)user_data;
+
+       OrganigrammaNodoPrivate *priv = ORGANIGRAMMA_NODO_GET_PRIVATE (rf);
+
+       OrganigrammaTipiNodo *c = organigramma_tipi_nodo_new (priv->commons, TRUE);
+
+       g_signal_connect (G_OBJECT (c), "selezionato",
+                         G_CALLBACK (organigramma_nodo_on_tipo_nodo_selezionato), user_data);
+
+       w = organigramma_tipi_nodo_get_widget (c);
+       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+       gtk_widget_show (w);
+}
+
 static gboolean
 organigramma_nodo_on_w_organigramma_nodo_delete_event (GtkWidget *widget,
                                GdkEvent *event,