]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Test e correzioni per la gestione nodi.
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Thu, 12 Aug 2010 13:13:03 +0000 (15:13 +0200)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Thu, 12 Aug 2010 13:13:03 +0000 (15:13 +0200)
data/organigramma/form/nodo.form [new file with mode: 0644]
data/organigramma/gui/organigramma.gui
src/nodi.c
src/nodo.c

diff --git a/data/organigramma/form/nodo.form b/data/organigramma/form/nodo.form
new file mode 100644 (file)
index 0000000..d7e643f
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<gtkform>
+
+       <table>nodi</table>
+
+       <widget type="label" name="label6" label="label10">
+               <field type="integer" name="id">
+                       <is-key>t</is-key>
+                       <auto-increment>t</auto-increment>
+               </field>
+       </widget>
+
+       <widget type="entry" name="entry2">
+               <field type="text" name="nodo_superiore">
+                       <to-load>f</to-load>
+                       <to-save>f</to-save>
+               </field>
+       </widget>
+
+       <widget type="label" name="label5" label="label4">
+               <on-change what="update" when="after">
+                       <widget-name>entry2</widget-name>
+                       <sql>
+                               SELECT nome FROM tipi_nodo WHERE id = ##label5::gint
+                       </sql>
+               </on-change>
+               <field type="integer" name="id_nodi">
+               </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>
+               <field type="integer" name="id_tipi_nodo"/>
+       </widget>
+
+       <widget type="entry" name="entry1" label="label2">
+               <field type="text" name="nome" />
+       </widget>
+
+       <widget type="textview" name="textview1" label="label3">
+               <field type="text" name="descrizione" />
+       </widget>
+
+</gtkform>
index c041d287c8ee771d1241b9dcb7d57f1473e8e032..52b875951e954cd8da7b77f688afefab5572ab0a 100644 (file)
             <child>
               <object class="GtkComboBox" id="combobox1">
                 <property name="visible">True</property>
+                <property name="model">lstore_tipi_nodo</property>
                 <child>
                   <object class="GtkCellRendererText" id="cellrenderertext3"/>
                   <attributes>
index c62ecca5a4078d48e2fdc2c497e312db166641ed..6164a0819bc4383f319b3f2ea78e36d865b6890d 100644 (file)
@@ -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);
                }
index d3b65a2e2c622304f5c31c17ebe194e9caa68717..510a57eb782fdb5344d2169341c163f76fd85e9d 100644 (file)
@@ -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);