<column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="lstore_persone">
- <columns>
- <!-- column-name id -->
- <column type="guint"/>
- <!-- column-name cognome_nome -->
- <column type="gchararray"/>
- </columns>
- </object>
- <object class="GtkWindow" id="w_persone">
- <property name="can_focus">False</property>
- <property name="title" translatable="yes">Persone - 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_persone">
- <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="label139">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes"><b>Persone</b></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="scrolledwindow32">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">etched-in</property>
- <child>
- <object class="GtkTreeView" id="treeview18">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="model">lstore_persone</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="treeviewcolumn28">
- <property name="title">Cognome/Nome</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext39"/>
- <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="hbuttonbox25">
- <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="button102">
- <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="button103">
- <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="button104">
- <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="button107">
- <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="button108">
- <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_posizioni_economiche">
<columns>
<!-- column-name id -->
</object>
</child>
</object>
+ <object class="GtkWindow" id="w_persone">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">Persone - 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_persone">
+ <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="label139">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>Persone</b></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="scrolledwindow32">
+ <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="hbuttonbox25">
+ <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="button102">
+ <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="button103">
+ <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="button104">
+ <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="button107">
+ <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="button108">
+ <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_posizione_economica">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Posizione economica - Gestione organigramma</property>
*
*/
+#include <libgdaexgrid/libgdaexgrid.h>
#include <libzakautho/autoz.h>
#include <libzakutils/libzakutils.h>
OrganigrammaCommons *commons;
GtkWidget *widget;
+ GdaExGrid *grid;
+ GtkWidget *wgrid;
GtkTreeSelection *selection;
- GtkListStore *lstore_persone;
+ GtkTreeStore *tstore_persone;
gboolean selezione;
guint id_uffici;
GError *error;
ZakAuthoIResource *ires1;
+ GdaExGridColumn *gcol;
+
OrganigrammaPersone *a = ORGANIGRAMMA_PERSONE (g_object_new (organigramma_persone_get_type (), NULL));
OrganigrammaPersonePrivate *priv = ORGANIGRAMMA_PERSONE_GET_PRIVATE (a);
error = NULL;
gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
- g_strsplit (g_strconcat ("lstore_persone|",
- (selezione ? "w_persone" : "vbx_persone"),
- NULL), "|", -1),
+ g_strsplit ((selezione ? "w_persone" : "vbx_persone"),
+ "|", -1),
&error);
if (error != NULL)
{
}
priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, (selezione ? "w_persone" : "vbx_persone")));
- priv->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview18")));
- priv->lstore_persone = GTK_LIST_STORE (gtk_builder_get_object (priv->commons->gtkbuilder, "lstore_persone"));
if (priv->selezione)
{
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, "label139"))));
+
+ 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 ("Cognome/Nome", "cognome_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, "scrolledwindow32")), priv->wgrid);
+ gtk_widget_show (priv->wgrid);
+
+ priv->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->wgrid));
+ priv->tstore_persone = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (priv->wgrid)));
+
g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button102"),
"clicked", G_CALLBACK (organigramma_persone_on_btn_nuovo_clicked), (gpointer)a);
g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button103"),
"clicked", G_CALLBACK (organigramma_persone_on_btn_modifica_clicked), (gpointer)a);
g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button104"),
"clicked", G_CALLBACK (organigramma_persone_on_btn_elimina_clicked), (gpointer)a);
- g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview18"),
+ g_signal_connect (priv->wgrid,
"row-activated", G_CALLBACK (organigramma_persone_on_trv_organigramma_persone_row_activated), (gpointer)a);
if (priv->selezione)
OrganigrammaPersonePrivate *priv = ORGANIGRAMMA_PERSONE_GET_PRIVATE (persone);
- gtk_list_store_clear (priv->lstore_persone);
+ gtk_tree_store_clear (priv->tstore_persone);
sql_where = g_strdup ("");
sql_join = g_strdup ("");
sql_join,
sql_where);
dm = gdaex_query (priv->commons->gdaex, sql);
+ gdaex_fill_treemodel_from_sql (priv->commons->gdaex, GTK_TREE_MODEL (priv->tstore_persone), sql, NULL, NULL);
g_free (sql_join);
g_free (sql_where);
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_persone, &iter);
- gtk_list_store_set (priv->lstore_persone, &iter,
- 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, "cognome_nome"),
- -1);
- }
-
- g_object_unref (dm);
- }
}
static void
{
GtkWidget *w;
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_persone), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_persone), &iter,
COL_ID, &id,
-1);
solipa_message_dialog (GTK_WIDGET (priv->wtransient),
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
- "Occorre prima selezionare una persona");
+ "Occorre prima selezionare una persona.");
}
}
if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_persone), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_persone), &iter,
COL_ID, &id,
-1);
solipa_message_dialog (GTK_WIDGET (priv->wtransient),
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
- "Occorre prima selezionare una persona");
+ "Occorre prima selezionare una persona.");
}
}
GTK_BUTTONS_YES_NO,
"Sicuro di voler eliminare la persona selezionata?") == GTK_RESPONSE_YES)
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_persone), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_persone), &iter,
COL_ID, &id,
-1);
solipa_message_dialog (GTK_WIDGET (priv->wtransient),
GTK_MESSAGE_WARNING,
GTK_BUTTONS_OK,
- "Occorre prima selezionare una persona");
+ "Occorre prima selezionare una persona.");
}
}