]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Selezione nodo superiore del nodo.
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Thu, 12 Aug 2010 13:43:37 +0000 (15:43 +0200)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Thu, 12 Aug 2010 13:43:37 +0000 (15:43 +0200)
data/organigramma/form/nodo.form
data/organigramma/gui/organigramma.gui
src/nodi.c
src/nodo.c

index d7e643fc7fab39a7309e2bc4b6aaa02193046508..3ed8eefd58c8f28711de0721dc386681bbf7dc75 100644 (file)
@@ -21,7 +21,7 @@
                <on-change what="update" when="after">
                        <widget-name>entry2</widget-name>
                        <sql>
-                               SELECT nome FROM tipi_nodo WHERE id = ##label5::gint
+                               SELECT nome FROM nodi WHERE id = ##label5::gint
                        </sql>
                </on-change>
                <field type="integer" name="id_nodi">
index 52b875951e954cd8da7b77f688afefab5572ab0a..53049b53d7990d7d40cdeef3e83323f7ff50ad03 100644 (file)
     </columns>
   </object>
   <object class="GtkWindow" id="w_nodi">
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="default_width">600</property>
+    <property name="default_height">400</property>
+    <property name="destroy_with_parent">True</property>
     <child>
       <object class="GtkVBox" id="vbx_nodi">
         <property name="visible">True</property>
index 6164a0819bc4383f319b3f2ea78e36d865b6890d..d6a5101b563637dde0bd4352478b0f332b3b33a5 100644 (file)
@@ -167,7 +167,7 @@ Nodi
 
        if (priv->selezione)
                {
-                       gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "label1")));
+                       gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "label11")));
                        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button14"),
                                          "clicked", G_CALLBACK (nodi_on_btn_annulla_clicked), (gpointer)a);
                        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button15"),
index 510a57eb782fdb5344d2169341c163f76fd85e9d..0ba1dbb2099bb1b270fdfafe8e2d5951d1e2d47d 100644 (file)
@@ -20,6 +20,7 @@
 #include <libgtkform/form.h>
 
 #include "nodo.h"
+#include "nodi.h"
 
 static void nodo_class_init (NodoClass *klass);
 static void nodo_init (Nodo *nodo);
@@ -38,6 +39,11 @@ static void nodo_get_property (GObject *object,
                                      GValue *value,
                                      GParamSpec *pspec);
 
+static void nodo_on_nodo_selezionato (gpointer instance, guint id, gpointer user_data);
+
+static void nodo_on_btn_nodo_clicked (GtkButton *button,
+                      gpointer user_data);
+
 static gboolean nodo_on_w_nodo_delete_event (GtkWidget *widget,
                                GdkEvent *event,
                                gpointer user_data);
@@ -145,6 +151,9 @@ Nodo
        g_signal_connect (priv->w,
                          "delete-event", G_CALLBACK (nodo_on_w_nodo_delete_event), (gpointer *)a);
 
+       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button6"),
+                         "clicked", G_CALLBACK (nodo_on_btn_nodo_clicked), (gpointer *)a);
+
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button4"),
                          "clicked", G_CALLBACK (nodo_on_btn_annulla_clicked), (gpointer *)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button5"),
@@ -313,6 +322,35 @@ nodo_conferma_chiusura (Nodo *nodo)
 }
 
 /* CALLBACK */
+static void
+nodo_on_nodo_selezionato (gpointer instance, guint id, gpointer user_data)
+{
+       Nodo *f = (Nodo *)user_data;
+       NodoPrivate *priv = NODO_GET_PRIVATE (f);
+
+       gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label5"), g_strdup_printf ("%d", id));
+}
+
+static void
+nodo_on_btn_nodo_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       GtkWidget *w;
+
+       Nodo *rf = (Nodo *)user_data;
+
+       NodoPrivate *priv = NODO_GET_PRIVATE (rf);
+
+       Nodi *c = nodi_new (priv->commons, TRUE);
+
+       g_signal_connect (G_OBJECT (c), "selezionato",
+                         G_CALLBACK (nodo_on_nodo_selezionato), user_data);
+
+       w = nodi_get_widget (c);
+       gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+       gtk_widget_show (w);
+}
+
 static gboolean
 nodo_on_w_nodo_delete_event (GtkWidget *widget,
                                GdkEvent *event,