From 0efa779e365cd69613a7eb9c5f0b3f48af812748 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Thu, 12 Aug 2010 15:13:03 +0200 Subject: [PATCH] Test e correzioni per la gestione nodi. --- data/organigramma/form/nodo.form | 47 ++++++++++++++++++++++++++ data/organigramma/gui/organigramma.gui | 1 + src/nodi.c | 22 ++++++------ src/nodo.c | 6 ++-- 4 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 data/organigramma/form/nodo.form diff --git a/data/organigramma/form/nodo.form b/data/organigramma/form/nodo.form new file mode 100644 index 0000000..d7e643f --- /dev/null +++ b/data/organigramma/form/nodo.form @@ -0,0 +1,47 @@ + + + + nodi
+ + + + t + t + + + + + + f + f + + + + + + entry2 + + SELECT nome FROM tipi_nodo WHERE id = ##label5::gint + + + + + + + + 0 + + SELECT id, nome FROM tipi_nodo WHERE status <> 'E' ORDER BY nome + + + + + + + + + + + + +
diff --git a/data/organigramma/gui/organigramma.gui b/data/organigramma/gui/organigramma.gui index c041d28..52b8759 100644 --- a/data/organigramma/gui/organigramma.gui +++ b/data/organigramma/gui/organigramma.gui @@ -204,6 +204,7 @@ True + lstore_tipi_nodo diff --git a/src/nodi.c b/src/nodi.c index c62ecca..6164a08 100644 --- a/src/nodi.c +++ b/src/nodi.c @@ -268,7 +268,7 @@ nodi_carica (Nodi *nodi) gtk_tree_store_append (priv->tstore_nodi, &iter, NULL); gtk_tree_store_set (priv->tstore_nodi, &iter, - COL_ID, gdaex_data_model_get_field_value_stringify_at (dm, row, "id"), + COL_ID, gdaex_data_model_get_field_value_integer_at (dm, row, "id"), COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"), -1); } @@ -425,16 +425,16 @@ nodi_on_btn_elimina_clicked (GtkButton *button, if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter)) { dialog = gtk_message_dialog_new (priv->wtransient, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - "Sicuro di voler eliminare il tipo nodo selezionato?"); + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "Sicuro di voler eliminare il tipo nodo selezionato?"); risp = gtk_dialog_run (GTK_DIALOG (dialog)); if (risp == GTK_RESPONSE_YES) { gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_nodi), &iter, - COL_ID, &id, - -1); + COL_ID, &id, + -1); gdaex_execute (priv->commons->gdaex, g_strdup_printf ("UPDATE nodi SET status = 'E' WHERE id = %d", id)); @@ -446,10 +446,10 @@ nodi_on_btn_elimina_clicked (GtkButton *button, else { dialog = gtk_message_dialog_new (priv->wtransient, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_OK, - "Occorre prima selezionare un tipo nodo"); + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + "Occorre prima selezionare un tipo nodo"); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } diff --git a/src/nodo.c b/src/nodo.c index d3b65a2..510a57e 100644 --- a/src/nodo.c +++ b/src/nodo.c @@ -122,7 +122,7 @@ Nodo error = NULL; gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile, - g_strsplit ("w_nodo", "|", -1), + g_strsplit ("lstore_tipi_nodo|w_nodo", "|", -1), &error); if (error != NULL) { @@ -130,7 +130,9 @@ Nodo return NULL; } - priv->form = gtk_form_new_from_file (g_build_filename (priv->commons->formdir, "nodo.form", NULL), priv->commons->gtkbuilder); + priv->form = gtk_form_new (); + g_object_set (G_OBJECT (priv->form), "gdaex", priv->commons->gdaex, NULL); + gtk_form_load_from_file (priv->form, g_build_filename (priv->commons->formdir, "nodo.form", NULL), priv->commons->gtkbuilder); g_object_set (priv->form, "gdaex", priv->commons->gdaex, NULL); -- 2.49.0