]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Migrato l'elenco tipi rapporto di lavoro a GdaExGrid (refs #833).
authorAndrea Zagli <azagli@libero.it>
Sun, 13 Nov 2016 09:02:33 +0000 (10:02 +0100)
committerAndrea Zagli <azagli@libero.it>
Sun, 13 Nov 2016 09:02:33 +0000 (10:02 +0100)
data/organigramma/gui/organigramma.gui
src/tipirapportolavoro.c

index 1fd104d373a55ae2c5d1a5d43e0f9d428de3594a..9a6df94eefe02b31816e592ff6b2f5cc0a85afd4 100644 (file)
       <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkWindow" id="w_tipi_prestazione">
-    <property name="can_focus">False</property>
-    <property name="title" translatable="yes">Tipi prestazione - Gestione organigramma</property>
-    <property name="modal">True</property>
-    <property name="window_position">center-on-parent</property>
-    <property name="default_width">500</property>
-    <property name="default_height">400</property>
-    <property name="destroy_with_parent">True</property>
-    <child>
-      <object class="GtkBox" id="vbx_tipi_prestazione">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="border_width">5</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">5</property>
-        <child>
-          <object class="GtkLabel" id="label152">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">&lt;b&gt;Tipi prestazione&lt;/b&gt;</property>
-            <property name="use_markup">True</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkScrolledWindow" id="scrolledwindow36">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="shadow_type">etched-in</property>
-            <child>
-              <object class="GtkTreeView" id="treeview21">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="model">lstore_tipi_prestazione</property>
-                <property name="headers_clickable">False</property>
-                <property name="search_column">0</property>
-                <child internal-child="selection">
-                  <object class="GtkTreeSelection"/>
-                </child>
-                <child>
-                  <object class="GtkTreeViewColumn" id="treeviewcolumn34">
-                    <property name="title">Nome</property>
-                    <child>
-                      <object class="GtkCellRendererText" id="cellrenderertext45"/>
-                      <attributes>
-                        <attribute name="text">1</attribute>
-                      </attributes>
-                    </child>
-                  </object>
-                </child>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkButtonBox" id="hbuttonbox30">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="spacing">5</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="button123">
-                <property name="label">gtk-new</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button124">
-                <property name="label">gtk-edit</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button125">
-                <property name="label">gtk-delete</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button126">
-                <property name="label">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="button127">
-                <property name="label">gtk-ok</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">4</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
-  <object class="GtkListStore" id="lstore_tipi_rapporto_lavoro">
-    <columns>
-      <!-- column-name id -->
-      <column type="gchararray"/>
-      <!-- column-name nome -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
   <object class="GtkWindow" id="w_persona_incarico">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Incarico - Gestione organigramma</property>
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
-                <property name="model">lstore_tipi_rapporto_lavoro</property>
                 <child>
                   <object class="GtkCellRendererText" id="cellrenderertext32"/>
                   <attributes>
       </object>
     </child>
   </object>
-  <object class="GtkWindow" id="w_tipi_rapporto_lavoro">
+  <object class="GtkWindow" id="w_tipi_prestazione">
     <property name="can_focus">False</property>
-    <property name="title" translatable="yes">Tipi rapporto di lavoro - Gestione organigramma</property>
+    <property name="title" translatable="yes">Tipi prestazione - Gestione organigramma</property>
     <property name="modal">True</property>
     <property name="window_position">center-on-parent</property>
     <property name="default_width">500</property>
     <property name="default_height">400</property>
     <property name="destroy_with_parent">True</property>
     <child>
-      <object class="GtkBox" id="vbx_tipi_rapporto_lavoro">
+      <object class="GtkBox" id="vbx_tipi_prestazione">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="border_width">5</property>
         <property name="orientation">vertical</property>
         <property name="spacing">5</property>
         <child>
-          <object class="GtkLabel" id="label143">
+          <object class="GtkLabel" id="label152">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="label" translatable="yes">&lt;b&gt;Tipi rapporto di lavoro&lt;/b&gt;</property>
+            <property name="label" translatable="yes">&lt;b&gt;Tipi prestazione&lt;/b&gt;</property>
             <property name="use_markup">True</property>
           </object>
           <packing>
           </packing>
         </child>
         <child>
-          <object class="GtkScrolledWindow" id="scrolledwindow33">
+          <object class="GtkScrolledWindow" id="scrolledwindow36">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="shadow_type">etched-in</property>
             <child>
-              <object class="GtkTreeView" id="treeview19">
+              <object class="GtkTreeView" id="treeview21">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="model">lstore_tipi_rapporto_lavoro</property>
+                <property name="model">lstore_tipi_prestazione</property>
                 <property name="headers_clickable">False</property>
                 <property name="search_column">0</property>
                 <child internal-child="selection">
                   <object class="GtkTreeSelection"/>
                 </child>
                 <child>
-                  <object class="GtkTreeViewColumn" id="treeviewcolumn29">
+                  <object class="GtkTreeViewColumn" id="treeviewcolumn34">
                     <property name="title">Nome</property>
                     <child>
-                      <object class="GtkCellRendererText" id="cellrenderertext40"/>
+                      <object class="GtkCellRendererText" id="cellrenderertext45"/>
                       <attributes>
                         <attribute name="text">1</attribute>
                       </attributes>
           </packing>
         </child>
         <child>
-          <object class="GtkButtonBox" id="hbuttonbox26">
+          <object class="GtkButtonBox" id="hbuttonbox30">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="spacing">5</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="button109">
+              <object class="GtkButton" id="button123">
                 <property name="label">gtk-new</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button110">
+              <object class="GtkButton" id="button124">
                 <property name="label">gtk-edit</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button111">
+              <object class="GtkButton" id="button125">
                 <property name="label">gtk-delete</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button112">
+              <object class="GtkButton" id="button126">
                 <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button113">
+              <object class="GtkButton" id="button127">
                 <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
       </object>
     </child>
   </object>
+  <object class="GtkWindow" id="w_tipi_rapporto_lavoro">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Tipi rapporto di lavoro - Gestione organigramma</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="default_width">500</property>
+    <property name="default_height">400</property>
+    <property name="destroy_with_parent">True</property>
+    <child>
+      <object class="GtkBox" id="vbx_tipi_rapporto_lavoro">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="border_width">5</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">5</property>
+        <child>
+          <object class="GtkLabel" id="label143">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">&lt;b&gt;Tipi rapporto di lavoro&lt;/b&gt;</property>
+            <property name="use_markup">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkScrolledWindow" id="scrolledwindow33">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="shadow_type">etched-in</property>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButtonBox" id="hbuttonbox26">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="spacing">5</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button109">
+                <property name="label">gtk-new</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button110">
+                <property name="label">gtk-edit</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button111">
+                <property name="label">gtk-delete</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button112">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button113">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
   <object class="GtkWindow" id="w_tipi_recapito">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Tipi recapito - Gestione organigramma</property>
index 43e49e647bbf68936c8922b98f806d8819c5b379..29a7537560863eff6a5cec6fbfd36b6cc103a42d 100644 (file)
  *
  */
 
+#ifdef HAVE_CONFIG_H
+       #include <config.h>
+#endif
+
+#include <libgdaexgrid/libgdaexgrid.h>
 #include <libzakautho/autoz.h>
 #include <libsolipa/utils.h>
 
@@ -71,8 +76,10 @@ struct _OrganigrammaTipiRapportoLavoroPrivate
                OrganigrammaCommons *commons;
 
                GtkWidget *widget;
+               GdaExGrid *grid;
+               GtkWidget *wgrid;
                GtkTreeSelection *selection;
-               GtkListStore *lstore_tipi_rapporto_lavoro;
+               GtkTreeStore *tstore_tipi_rapporto_lavoro;
 
                gboolean selezione;
                GtkWindow *wtransient;
@@ -125,6 +132,8 @@ OrganigrammaTipiRapportoLavoro
        GError *error;
        ZakAuthoIResource *ires1;
 
+       GdaExGridColumn *gcol;
+
        OrganigrammaTipiRapportoLavoro *a = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO (g_object_new (organigramma_tipi_rapporto_lavoro_get_type (), NULL));
 
        OrganigrammaTipiRapportoLavoroPrivate *priv = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO_GET_PRIVATE (a);
@@ -134,9 +143,8 @@ OrganigrammaTipiRapportoLavoro
 
        error = NULL;
        gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
-                                          g_strsplit (g_strconcat ("lstore_tipi_rapporto_lavoro|",
-                                          (selezione ? "w_tipi_rapporto_lavoro" : "vbx_tipi_rapporto_lavoro"),
-                                          NULL), "|", -1),
+                                          g_strsplit ((selezione ? "w_tipi_rapporto_lavoro" : "vbx_tipi_rapporto_lavoro"),
+                                                                                                  "|", -1),
                                           &error);
        if (error != NULL)
                {
@@ -145,8 +153,6 @@ OrganigrammaTipiRapportoLavoro
                }
 
        priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, (selezione ? "w_tipi_rapporto_lavoro" : "vbx_tipi_rapporto_lavoro")));
-       priv->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview19")));
-       priv->lstore_tipi_rapporto_lavoro = GTK_LIST_STORE (gtk_builder_get_object (priv->commons->gtkbuilder, "lstore_tipi_rapporto_lavoro"));
 
        if (priv->selezione)
                {
@@ -157,13 +163,33 @@ OrganigrammaTipiRapportoLavoro
                        priv->wtransient = GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main"));
                }
 
+       /* creo la gdaexgrid */
+       priv->grid = gdaex_grid_new ();
+       gdaex_grid_set_solipa (priv->grid, priv->commons->solipa);
+       gdaex_grid_set_title (priv->grid, gtk_label_get_text (GTK_LABEL (gtk_builder_get_object (priv->commons->gtkbuilder, "label143"))));
+
+       gcol = gdaex_grid_column_new ("ID", "id", G_TYPE_INT, TRUE, TRUE, TRUE, FALSE, -1);
+       gdaex_grid_add_column (priv->grid, gcol);
+
+       gcol = gdaex_grid_column_new_defaults ("Nome", "nome", G_TYPE_STRING);
+       gdaex_grid_add_column (priv->grid, gcol);
+
+       priv->wgrid = gdaex_grid_get_widget (priv->grid);
+
+       gtk_tree_view_set_search_column (GTK_TREE_VIEW (priv->wgrid), 1);
+       gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (priv->commons->gtkbuilder, "scrolledwindow33")), priv->wgrid);
+       gtk_widget_show (priv->wgrid);
+
+       priv->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->wgrid));
+       priv->tstore_tipi_rapporto_lavoro = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->wgrid)));
+
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button109"),
                          "clicked", G_CALLBACK (organigramma_tipi_rapporto_lavoro_on_btn_nuovo_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button110"),
                          "clicked", G_CALLBACK (organigramma_tipi_rapporto_lavoro_on_btn_modifica_clicked), (gpointer)a);
        g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button111"),
                          "clicked", G_CALLBACK (organigramma_tipi_rapporto_lavoro_on_btn_elimina_clicked), (gpointer)a);
-       g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview19"),
+       g_signal_connect (priv->wgrid,
                          "row-activated", G_CALLBACK (organigramma_tipi_rapporto_lavoro_on_trv_organigramma_tipi_rapporto_lavoro_row_activated), (gpointer)a);
 
        if (priv->selezione)
@@ -219,35 +245,22 @@ organigramma_tipi_rapporto_lavoro_carica (OrganigrammaTipiRapportoLavoro *tipi_r
 
        OrganigrammaTipiRapportoLavoroPrivate *priv = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO_GET_PRIVATE (tipi_rapporto_lavoro);
 
-       gtk_list_store_clear (priv->lstore_tipi_rapporto_lavoro);
+       gtk_tree_store_clear (priv->tstore_tipi_rapporto_lavoro);
 
        sql = g_strdup_printf ("SELECT c.id, c.nome"
                          " FROM tipi_rapporto_lavoro AS c"
                          " WHERE c.status <> 'E'"
                          " ORDER BY c.nome");
        dm = gdaex_query (priv->commons->gdaex, sql);
+       gdaex_fill_treemodel_from_sql (priv->commons->gdaex, GTK_TREE_MODEL (priv->tstore_tipi_rapporto_lavoro), sql, NULL, NULL);
        g_free (sql);
-       if (dm != NULL)
-               {
-                       rows = gda_data_model_get_n_rows (dm);
-                       for (row = 0; row < rows; row++)
-                               {
-                                       gtk_list_store_append (priv->lstore_tipi_rapporto_lavoro, &iter);
-                                       gtk_list_store_set (priv->lstore_tipi_rapporto_lavoro, &iter,
-                                                           COL_ID, gdaex_data_model_get_field_value_stringify_at (dm, row, "id"),
-                                                           COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
-                                                           -1);
-                               }
-
-                       g_object_unref (dm);
-               }
 }
 
 static void
 organigramma_tipi_rapporto_lavoro_modifica (OrganigrammaTipiRapportoLavoro *tipi_rapporto_lavoro)
 {
        GtkTreeIter iter;
-       gchar *id;
+       guint id;
 
        OrganigrammaTipiRapportoLavoroPrivate *priv = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO_GET_PRIVATE (tipi_rapporto_lavoro);
 
@@ -255,11 +268,11 @@ organigramma_tipi_rapporto_lavoro_modifica (OrganigrammaTipiRapportoLavoro *tipi
                {
                        GtkWidget *w;
 
-                       gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_rapporto_lavoro), &iter,
+                       gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_tipi_rapporto_lavoro), &iter,
                                            COL_ID, &id,
                                            -1);
 
-                       OrganigrammaTipoRapportoLavoro *c = organigramma_tipo_rapporto_lavoro_new (priv->commons, strtol (id, NULL, 10));
+                       OrganigrammaTipoRapportoLavoro *c = organigramma_tipo_rapporto_lavoro_new (priv->commons, id);
 
                        g_signal_connect (G_OBJECT (c), "aggiornato",
                                          G_CALLBACK (organigramma_tipi_rapporto_lavoro_on_costo_aggiornato), (gpointer)tipi_rapporto_lavoro);
@@ -281,18 +294,18 @@ static void
 organigramma_tipi_rapporto_lavoro_selezionato (OrganigrammaTipiRapportoLavoro *tipi_rapporto_lavoro)
 {
        GtkTreeIter iter;
-       gchar *id;
+       guint id;
 
        OrganigrammaTipiRapportoLavoroClass *klass = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO_GET_CLASS (tipi_rapporto_lavoro);
        OrganigrammaTipiRapportoLavoroPrivate *priv = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO_GET_PRIVATE (tipi_rapporto_lavoro);
 
        if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
                {
-                       gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_rapporto_lavoro), &iter,
+                       gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_tipi_rapporto_lavoro), &iter,
                                            COL_ID, &id,
                                            -1);
 
-                       g_signal_emit (G_OBJECT (tipi_rapporto_lavoro), klass->selezionato_signal_id, 0, strtol (id, NULL, 10));
+                       g_signal_emit (G_OBJECT (tipi_rapporto_lavoro), klass->selezionato_signal_id, 0, id);
 
                        gtk_widget_destroy (priv->widget);
                        g_object_unref (G_OBJECT (tipi_rapporto_lavoro));
@@ -372,7 +385,7 @@ organigramma_tipi_rapporto_lavoro_on_btn_elimina_clicked (GtkButton *button,
                         gpointer user_data)
 {
        GtkTreeIter iter;
-       gchar *id;
+       guint id;
 
        OrganigrammaTipiRapportoLavoro *tipi_rapporto_lavoro = (OrganigrammaTipiRapportoLavoro *)user_data;
        OrganigrammaTipiRapportoLavoroPrivate *priv = ORGANIGRAMMA_TIPI_RAPPORTO_LAVORO_GET_PRIVATE (tipi_rapporto_lavoro);
@@ -384,12 +397,12 @@ organigramma_tipi_rapporto_lavoro_on_btn_elimina_clicked (GtkButton *button,
                                                   GTK_BUTTONS_YES_NO,
                                                   "Sicuro di voler eliminare il tipo rapporto lavoro selezionato?") == GTK_RESPONSE_YES)
                                {
-                                       gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_tipi_rapporto_lavoro), &iter,
+                                       gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_tipi_rapporto_lavoro), &iter,
                                                            COL_ID, &id,
                                                            -1);
 
                                        gdaex_execute (priv->commons->gdaex,
-                                                      g_strdup_printf ("UPDATE tipi_rapporto_lavoro SET status = 'E' WHERE id = %d", strtol (id, NULL, 10)));
+                                                      g_strdup_printf ("UPDATE tipi_rapporto_lavoro SET status = 'E' WHERE id = %d", id));
 
                                        organigramma_tipi_rapporto_lavoro_carica (tipi_rapporto_lavoro);
                                }