<column type="gchararray"/>
</columns>
</object>
- <object class="GtkListStore" id="lstore_uffici">
- <columns>
- <!-- column-name id -->
- <column type="guint"/>
- <!-- column-name nome -->
- <column type="gchararray"/>
- </columns>
- </object>
<object class="GtkListStore" id="lstore_ufficio_nodi">
<columns>
<!-- column-name tipo -->
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkTreeStore" id="tstore_uffici">
+ <columns>
+ <!-- column-name id -->
+ <column type="guint"/>
+ <!-- column-name nome -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkWindow" id="w_main">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Gestione organigramma</property>
<object class="GtkTreeView" id="treeview4">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="model">lstore_uffici</property>
+ <property name="model">tstore_uffici</property>
<property name="headers_clickable">False</property>
- <property name="search_column">0</property>
+ <property name="rules_hint">True</property>
+ <property name="search_column">1</property>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn4">
<property name="title">Nome</property>
<object class="GtkTable" id="table4">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">8</property>
+ <property name="n_rows">9</property>
<property name="n_columns">2</property>
<property name="column_spacing">5</property>
<property name="row_spacing">5</property>
<property name="label" translatable="yes">Nome</property>
</object>
<packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<property name="label" translatable="yes">Descrizione</property>
</object>
<packing>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
</packing>
</child>
<child>
<property name="label" translatable="yes">Struttura</property>
</object>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkEntry" id="entry7">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- <property name="primary_icon_activatable">False</property>
- <property name="secondary_icon_activatable">False</property>
- <property name="primary_icon_sensitive">True</property>
- <property name="secondary_icon_sensitive">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button31">
- <property name="label" translatable="yes">...</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label25">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">lbl_id_strutture</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
</object>
<packing>
<property name="right_attach">2</property>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
</packing>
</child>
<child>
</object>
<packing>
<property name="right_attach">2</property>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
</packing>
</child>
<child>
</child>
</object>
<packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkEntry" id="entry7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">False</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button31">
+ <property name="label" translatable="yes">...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label25">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">lbl_id_strutture</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox20">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkEntry" id="entry48">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
+ <property name="secondary_icon_stock">gtk-clear</property>
+ <property name="primary_icon_activatable">False</property>
+ <property name="secondary_icon_activatable">True</property>
+ <property name="primary_icon_sensitive">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button164">
+ <property name="label" translatable="yes">...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label169">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">lbl_id_uffici</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label170">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Ufficio</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
</object>
/*
- * Copyright (C) 2010-2012 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2013 Andrea Zagli <azagli@libero.it>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
*
*/
+#ifdef HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
#include <libautoz/autoz.h>
#include <libsolipa/utils.h>
GtkWidget *widget;
GtkTreeSelection *selection;
- GtkListStore *lstore_uffici;
+ GtkTreeStore *tstore_uffici;
gboolean selezione;
GtkWindow *wtransient;
error = NULL;
gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
- g_strsplit (g_strconcat ("lstore_uffici|",
+ g_strsplit (g_strconcat ("tstore_uffici|",
(selezione ? "w_uffici" : "vbx_uffici"),
NULL),
"|", -1),
priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, (selezione ? "w_uffici" : "vbx_uffici")));
priv->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview4")));
- priv->lstore_uffici = GTK_LIST_STORE (gtk_builder_get_object (priv->commons->gtkbuilder, "lstore_uffici"));
+ priv->tstore_uffici = GTK_TREE_STORE (gtk_builder_get_object (priv->commons->gtkbuilder, "tstore_uffici"));
if (priv->selezione)
{
/* PRIVATE */
static void
-organigramma_uffici_carica (OrganigrammaUffici *uffici)
+organigramma_uffici_carica_figli (OrganigrammaUffici *uffici, GtkTreeIter *iter_parent, guint id_uffici)
{
GtkTreeIter iter;
OrganigrammaUfficiClass *klass = ORGANIGRAMMA_UFFICI_GET_CLASS (uffici);
OrganigrammaUfficiPrivate *priv = ORGANIGRAMMA_UFFICI_GET_PRIVATE (uffici);
- gtk_list_store_clear (priv->lstore_uffici);
-
sql = g_strdup_printf ("SELECT c.id, c.nome"
" FROM uffici AS c"
" WHERE c.status <> 'E'"
- " ORDER BY c.nome");
+ " AND id_uffici = %d"
+ " ORDER BY c.nome",
+ id_uffici);
dm = gdaex_query (priv->commons->gdaex, sql);
g_free (sql);
if (dm != NULL)
if (toshow)
{
- gtk_list_store_append (priv->lstore_uffici, &iter);
- gtk_list_store_set (priv->lstore_uffici, &iter,
+ gtk_tree_store_append (priv->tstore_uffici, &iter, iter_parent);
+ gtk_tree_store_set (priv->tstore_uffici, &iter,
COL_ID, id,
COL_NOME, gdaex_data_model_get_field_value_stringify_at (dm, row, "nome"),
-1);
+
+ organigramma_uffici_carica_figli (uffici, &iter, id);
}
}
}
}
+static void
+organigramma_uffici_carica (OrganigrammaUffici *uffici)
+{
+ OrganigrammaUfficiClass *klass = ORGANIGRAMMA_UFFICI_GET_CLASS (uffici);
+ OrganigrammaUfficiPrivate *priv = ORGANIGRAMMA_UFFICI_GET_PRIVATE (uffici);
+
+ gtk_tree_store_clear (priv->tstore_uffici);
+
+ organigramma_uffici_carica_figli (uffici, NULL, 0);
+}
+
static void
organigramma_uffici_modifica (OrganigrammaUffici *uffici)
{
{
GtkWidget *w;
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_uffici), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_uffici), &iter,
COL_ID, &id,
-1);
if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_uffici), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_uffici), &iter,
COL_ID, &id,
-1);
GTK_BUTTONS_YES_NO,
"Sicuro di voler eliminare l'ufficio selezionato?") == GTK_RESPONSE_YES)
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_uffici), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_uffici), &iter,
COL_ID, &id,
-1);
#include <libsolipa/utils.h>
#include "ufficio.h"
+#include "uffici.h"
#include "strutture.h"
#include "ufficionodo.h"
#include "ufficioorario.h"
static void organigramma_ufficio_on_recapito_aggiornato (gpointer instance, gpointer user_data);
static void organigramma_ufficio_on_orario_aggiornato (gpointer instance, gpointer user_data);
+static void organigramma_ufficio_on_organigramma_ufficio_selezionato (gpointer instance, guint id, gpointer user_data);
+
+static void organigramma_ufficio_on_organigramma_ufficio_pulisci (GtkEntry *entry,
+ GtkEntryIconPosition icon_pos,
+ GdkEvent *event,
+ gpointer user_data);
+static void organigramma_ufficio_on_btn_organigramma_ufficio_clicked (GtkButton *button,
+ gpointer user_data);
+
static void organigramma_ufficio_on_struttura_selezionato (gpointer instance, guint id, gpointer user_data);
static gboolean organigramma_ufficio_on_w_organigramma_ufficio_delete_event (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
-static void organigramma_ufficio_on_btn_organigramma_ufficio_clicked (GtkButton *button,
+static void organigramma_ufficio_on_btn_organigramma_struttura_clicked (GtkButton *button,
gpointer user_data);
static void organigramma_ufficio_on_btn_nodo_nuovo_clicked (GtkButton *button,
g_signal_connect (priv->w,
"delete-event", G_CALLBACK (organigramma_ufficio_on_w_organigramma_ufficio_delete_event), (gpointer)a);
- g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button31"),
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "entry48"),
+ "icon-press", G_CALLBACK (organigramma_ufficio_on_organigramma_ufficio_pulisci), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button164"),
"clicked", G_CALLBACK (organigramma_ufficio_on_btn_organigramma_ufficio_clicked), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button31"),
+ "clicked", G_CALLBACK (organigramma_ufficio_on_btn_organigramma_struttura_clicked), (gpointer)a);
+
g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button28")),
"clicked", G_CALLBACK (organigramma_ufficio_on_btn_nodo_nuovo_clicked), (gpointer)a);
g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button42")),
}
/* CALLBACK */
+static void
+organigramma_ufficio_on_organigramma_ufficio_selezionato (gpointer instance, guint id, gpointer user_data)
+{
+ OrganigrammaUfficio *f = (OrganigrammaUfficio *)user_data;
+ OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (f);
+
+ gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label169"), g_strdup_printf ("%d", id));
+}
+
+static void
+organigramma_ufficio_on_organigramma_ufficio_pulisci (GtkEntry *entry,
+ GtkEntryIconPosition icon_pos,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ OrganigrammaUfficio *f = (OrganigrammaUfficio *)user_data;
+ OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (f);
+
+ gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (priv->commons->gtkbuilder, "label169")), "");
+ gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (priv->commons->gtkbuilder, "entry48")), "");
+}
+
static void
organigramma_ufficio_on_struttura_selezionato (gpointer instance, guint id, gpointer user_data)
{
OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (rf);
+ OrganigrammaUffici *c = organigramma_uffici_new (priv->commons, TRUE);
+
+ g_signal_connect (G_OBJECT (c), "selezionato",
+ G_CALLBACK (organigramma_ufficio_on_organigramma_ufficio_selezionato), user_data);
+
+ w = organigramma_uffici_get_widget (c);
+ gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w));
+ gtk_widget_show (w);
+}
+
+static void
+organigramma_ufficio_on_btn_organigramma_struttura_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkWidget *w;
+
+ OrganigrammaUfficio *rf = (OrganigrammaUfficio *)user_data;
+
+ OrganigrammaUfficioPrivate *priv = ORGANIGRAMMA_UFFICIO_GET_PRIVATE (rf);
+
OrganigrammaStrutture *c = organigramma_strutture_new (priv->commons, TRUE);
g_signal_connect (G_OBJECT (c), "selezionato",