From: Andrea Zagli Date: Thu, 12 Aug 2010 13:43:37 +0000 (+0200) Subject: Selezione nodo superiore del nodo. X-Git-Tag: 0.0.3~64 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=199e9c1993c1077884deaac32622c56cfc487366;p=solipa%2Forganigramma Selezione nodo superiore del nodo. --- diff --git a/data/organigramma/form/nodo.form b/data/organigramma/form/nodo.form index d7e643f..3ed8eef 100644 --- a/data/organigramma/form/nodo.form +++ b/data/organigramma/form/nodo.form @@ -21,7 +21,7 @@ entry2 - SELECT nome FROM tipi_nodo WHERE id = ##label5::gint + SELECT nome FROM nodi WHERE id = ##label5::gint diff --git a/data/organigramma/gui/organigramma.gui b/data/organigramma/gui/organigramma.gui index 52b8759..53049b5 100644 --- a/data/organigramma/gui/organigramma.gui +++ b/data/organigramma/gui/organigramma.gui @@ -425,6 +425,11 @@ + True + center-on-parent + 600 + 400 + True True diff --git a/src/nodi.c b/src/nodi.c index 6164a08..d6a5101 100644 --- a/src/nodi.c +++ b/src/nodi.c @@ -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"), diff --git a/src/nodo.c b/src/nodo.c index 510a57e..0ba1dbb 100644 --- a/src/nodo.c +++ b/src/nodo.c @@ -20,6 +20,7 @@ #include #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,