<signal name="activate" handler="on_mnu_view_nodi_activate"/>
</object>
</child>
+ <child>
+ <object class="GtkMenuItem" id="menuitem9">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Strutture</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_mnu_view_strutture_activate"/>
+ </object>
+ </child>
<child>
<object class="GtkMenuItem" id="menuitem8">
<property name="visible">True</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
<child>
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">0</property>
<column type="gchararray"/>
</columns>
</object>
+ <object class="GtkListStore" id="lstore_strutture">
+ <columns>
+ <!-- column-name id -->
+ <column type="guint"/>
+ <!-- column-name nome -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkWindow" id="w_nodi">
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="position">0</property>
<property name="bottom_attach">5</property>
</packing>
</child>
- <child>
- <object class="GtkLabel" id="label21">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Nodo superiore</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkEntry" id="entry6">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">False</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button28">
- <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="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label22">
- <property name="label" translatable="yes">lbl_id_nodi</property>
- </object>
- <packing>
- <property name="expand">False</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">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
- </child>
<child>
<object class="GtkLabel" id="label23">
<property name="visible">True</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
<child>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow9">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview6">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVButtonBox" id="vbuttonbox1">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">start</property>
+ <child>
+ <object class="GtkButton" id="button37">
+ <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="button38">
+ <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="button41">
+ <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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label29">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Recapiti</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow10">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVButtonBox" id="vbuttonbox2">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">start</property>
+ <child>
+ <object class="GtkButton" id="button28">
+ <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="button42">
+ <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="button43">
+ <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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label21">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Nodi superiori</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="position">0</property>
</object>
</child>
</object>
+ <object class="GtkWindow" id="w_strutture">
+ <property name="title" translatable="yes">Strutture - Gestione organigramma</property>
+ <child>
+ <object class="GtkVBox" id="vbx_strutture">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkLabel" id="label26">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Strutture</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">lstore_strutture</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">0</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+ <property name="title">Nome</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext6"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox9">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button32">
+ <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="button33">
+ <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="button34">
+ <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="button35">
+ <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="button36">
+ <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="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkWindow" id="w_struttura">
+ <property name="title" translatable="yes">Struttura - Gestione organigramma</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="destroy_with_parent">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox6">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkTable" id="table5">
+ <property name="visible">True</property>
+ <property name="n_rows">5</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
+ <property name="row_spacing">5</property>
+ <child>
+ <object class="GtkLabel" id="label27">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Nome</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry8">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="max_length">100</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label28">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Descrizione</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>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow8">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkTextView" id="textview3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </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>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label31">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">lbl_id</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label32">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">ID</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label30">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Prefisso centralino</property>
+ </object>
+ <packing>
+ <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="GtkEntry" id="entry9">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="max_length">20</property>
+ <property name="invisible_char">●</property>
+ </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="GtkLabel" id="label33">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Interno centralino</property>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry10">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="max_length">10</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <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="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox10">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button39">
+ <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">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button40">
+ <property name="label">gtk-save</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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkWindow" id="w_ufficio_nodo">
+ <property name="title" translatable="yes">Nodo superiore dell'ufficio - Gestione organigramma</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="destroy_with_parent">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox7">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkTable" id="table6">
+ <property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
+ <property name="row_spacing">5</property>
+ <child>
+ <object class="GtkLabel" id="label35">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Descrizione</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow11">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkTextView" id="textview4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label36">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Nodo superiore</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkEntry" id="entry11">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="invisible_char">●</property>
+ <property name="secondary_icon_stock">gtk-clear</property>
+ <property name="secondary_icon_activatable">True</property>
+ <property name="secondary_icon_sensitive">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button44">
+ <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="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label37">
+ <property name="label" translatable="yes">lbl_id_nodi</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label38">
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">lbl_id</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>
+ <child>
+ <object class="GtkLabel" id="label22">
+ <property name="label" translatable="yes">lbl_id_uffici</property>
+ </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>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox11">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button45">
+ <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">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button46">
+ <property name="label">gtk-save</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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkWindow" id="w_ufficio_recapito">
+ <property name="title" translatable="yes">Recapito dell'ufficio - Gestione organigramma</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="destroy_with_parent">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox8">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkTable" id="table7">
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
+ <property name="row_spacing">5</property>
+ <child>
+ <object class="GtkLabel" id="label34">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Descrizione</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>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow12">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkTextView" id="textview5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </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>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label39">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Tipo recapito</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label41">
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">lbl_id</property>
+ </object>
+ <packing>
+ <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="GtkLabel" id="label42">
+ <property name="label" translatable="yes">lbl_id_uffici</property>
+ </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>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label40">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Recapito</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry6">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="combobox2">
+ <property name="visible">True</property>
+ <property name="model">lstore_tipi_recapito</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext7"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox12">
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button48">
+ <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">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button49">
+ <property name="label">gtk-save</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>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
</interface>
--- /dev/null
+/*
+ * Copyright (C) 2010 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include <libgtkform/form.h>
+
+#include "struttura.h"
+
+static void struttura_class_init (StrutturaClass *klass);
+static void struttura_init (Struttura *struttura);
+
+static void struttura_carica (Struttura *struttura);
+static void struttura_salva (Struttura *struttura);
+
+static gboolean struttura_conferma_chiusura (Struttura *struttura);
+
+static void struttura_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void struttura_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static gboolean struttura_on_w_struttura_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data);
+
+static void struttura_on_btn_annulla_clicked (GtkButton *button,
+ gpointer user_data);
+static void struttura_on_btn_salva_clicked (GtkButton *button,
+ gpointer user_data);
+
+#define STRUTTURA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_STRUTTURA, StrutturaPrivate))
+
+enum
+{
+ LBL_ID
+};
+
+typedef struct _StrutturaPrivate StrutturaPrivate;
+struct _StrutturaPrivate
+ {
+ Commons *commons;
+
+ GtkForm *form;
+
+ GtkWidget *w;
+
+ GObject **objects;
+
+ gint id;
+ };
+
+G_DEFINE_TYPE (Struttura, struttura, G_TYPE_OBJECT)
+
+static void
+struttura_class_init (StrutturaClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (StrutturaPrivate));
+
+ object_class->set_property = struttura_set_property;
+ object_class->get_property = struttura_get_property;
+
+ /**
+ * Struttura::aggiornato:
+ * @struttura:
+ *
+ */
+ klass->aggiornato_signal_id = g_signal_new ("aggiornato",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE,
+ 0);
+}
+
+static void
+struttura_init (Struttura *struttura)
+{
+ StrutturaPrivate *priv = STRUTTURA_GET_PRIVATE (struttura);
+}
+
+/**
+ * struttura_new:
+ * @commons:
+ * @id:
+ *
+ * Returns: the newly created #Struttura object.
+ */
+Struttura
+*struttura_new (Commons *commons, gint id)
+{
+ GError *error;
+
+ Struttura *a = STRUTTURA (g_object_new (struttura_get_type (), NULL));
+
+ StrutturaPrivate *priv = STRUTTURA_GET_PRIVATE (a);
+
+ priv->commons = commons;
+
+ error = NULL;
+ gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
+ g_strsplit ("w_struttura", "|", -1),
+ &error);
+ if (error != NULL)
+ {
+ g_warning ("Errore: %s.", error->message);
+ return NULL;
+ }
+
+ 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, "struttura.form", NULL), priv->commons->gtkbuilder);
+
+ priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_struttura"));
+
+ priv->objects = gtk_form_get_objects_by_name (priv->form,
+ "label31",
+ NULL);
+
+ g_signal_connect (priv->w,
+ "delete-event", G_CALLBACK (struttura_on_w_struttura_delete_event), (gpointer *)a);
+
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button39"),
+ "clicked", G_CALLBACK (struttura_on_btn_annulla_clicked), (gpointer *)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button40"),
+ "clicked", G_CALLBACK (struttura_on_btn_salva_clicked), (gpointer *)a);
+
+ priv->id = id;
+
+ if (priv->id == 0)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+
+ gtk_form_set_as_origin (priv->form);
+ }
+ else
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), g_strdup_printf ("%d", priv->id));
+ struttura_carica (a);
+ }
+
+ return a;
+}
+
+/**
+ * struttura_get_widget:
+ * @struttura:
+ *
+ */
+GtkWidget
+*struttura_get_widget (Struttura *struttura)
+{
+ StrutturaPrivate *priv = STRUTTURA_GET_PRIVATE (struttura);
+
+ return priv->w;
+}
+
+/* PRIVATE */
+static void
+struttura_carica (Struttura *struttura)
+{
+ StrutturaPrivate *priv = STRUTTURA_GET_PRIVATE (struttura);
+
+ gtk_form_fill_from_table (priv->form);
+}
+
+static void
+struttura_salva (Struttura *struttura)
+{
+ GError *error = NULL;
+ gchar *sql;
+ GtkWidget *dialog;
+
+ GDate *da;
+ GDate *a;
+
+ StrutturaClass *klass = STRUTTURA_GET_CLASS (struttura);
+
+ StrutturaPrivate *priv = STRUTTURA_GET_PRIVATE (struttura);
+
+ if (!gtk_form_check (priv->form, (priv->id != 0), NULL, TRUE, priv->w, TRUE))
+ {
+ return;
+ }
+
+ if (priv->id == 0)
+ {
+ sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_INSERT);
+ }
+ else
+ {
+ sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_UPDATE);
+ }
+
+ if (gdaex_execute (priv->commons->gdaex, sql) == 1)
+ {
+ g_signal_emit (struttura, klass->aggiornato_signal_id, 0);
+
+ gtk_form_set_as_origin (priv->form);
+
+ if (priv->id == 0)
+ {
+ priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
+ }
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_OK,
+ "Salvataggio eseguito con successo.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+ else
+ {
+ if (priv->id == 0)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+ }
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Errore durante il salvataggio.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+}
+
+static void
+struttura_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ Struttura *struttura = STRUTTURA (object);
+
+ StrutturaPrivate *priv = STRUTTURA_GET_PRIVATE (struttura);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+struttura_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ Struttura *struttura = STRUTTURA (object);
+
+ StrutturaPrivate *priv = STRUTTURA_GET_PRIVATE (struttura);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static gboolean
+struttura_conferma_chiusura (Struttura *struttura)
+{
+ GtkWidget *dialog;
+
+ gboolean ret;
+
+ StrutturaPrivate *priv = STRUTTURA_GET_PRIVATE (struttura);
+
+ ret = TRUE;
+ if (gtk_form_is_changed (priv->form))
+ {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (priv->w),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ "Sicuro di voler chiudere senza salvare?");
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_NO)
+ {
+ ret = FALSE;
+ }
+ gtk_widget_destroy (dialog);
+ }
+
+ return ret;
+}
+
+/* CALLBACK */
+static gboolean
+struttura_on_w_struttura_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ return !struttura_conferma_chiusura ((Struttura *)user_data);
+}
+
+static void
+struttura_on_btn_annulla_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ Struttura *struttura = (Struttura *)user_data;
+
+ StrutturaPrivate *priv = STRUTTURA_GET_PRIVATE (struttura);
+
+ if (struttura_conferma_chiusura (struttura)) gtk_widget_destroy (priv->w);
+}
+
+static void
+struttura_on_btn_salva_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ struttura_salva ((Struttura *)user_data);
+}
--- /dev/null
+/*
+ * Copyright (C) 2010 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#include "strutture.h"
+#include "struttura.h"
+
+static void strutture_class_init (StruttureClass *klass);
+static void strutture_init (Strutture *strutture);
+
+static void strutture_carica (Strutture *strutture);
+static void strutture_modifica (Strutture *strutture);
+
+static void strutture_selezionato (Strutture *strutture);
+static void strutture_on_struttura_aggiornato (gpointer instance, gpointer user_data);
+
+static void strutture_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void strutture_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void strutture_on_btn_nuovo_clicked (GtkButton *button,
+ gpointer user_data);
+static void strutture_on_btn_modifica_clicked (GtkButton *button,
+ gpointer user_data);
+static void strutture_on_btn_elimina_clicked (GtkButton *button,
+ gpointer user_data);
+static void strutture_on_trv_strutture_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *tree_path,
+ GtkTreeViewColumn *column,
+ gpointer user_data);
+
+static void strutture_on_btn_annulla_clicked (GtkButton *button,
+ gpointer user_data);
+static void strutture_on_btn_seleziona_clicked (GtkButton *button,
+ gpointer user_data);
+
+#define STRUTTURE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_STRUTTURE, StrutturePrivate))
+
+enum
+{
+ COL_ID,
+ COL_NOME
+};
+
+typedef struct _StrutturePrivate StrutturePrivate;
+struct _StrutturePrivate
+ {
+ Commons *commons;
+
+ GtkWidget *widget;
+ GtkTreeSelection *selection;
+ GtkListStore *lstore_strutture;
+
+ gboolean selezione;
+ GtkWindow *wtransient;
+ };
+
+G_DEFINE_TYPE (Strutture, strutture, G_TYPE_OBJECT)
+
+static void
+strutture_class_init (StruttureClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (StrutturePrivate));
+
+ object_class->set_property = strutture_set_property;
+ object_class->get_property = strutture_get_property;
+
+ /**
+ * Strutture::selezionato:
+ * @strutture:
+ *
+ */
+ klass->selezionato_signal_id = g_signal_new ("selezionato",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE,
+ 1, G_TYPE_UINT);
+}
+
+static void
+strutture_init (Strutture *strutture)
+{
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE (strutture);
+}
+
+/**
+ * strutture_new:
+ * @commons:
+ * @selezione:
+ *
+ * Returns: the newly created #Strutture object.
+ */
+Strutture
+*strutture_new (Commons *commons, gboolean selezione)
+{
+ GError *error;
+
+ Strutture *a = STRUTTURE (g_object_new (strutture_get_type (), NULL));
+
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE (a);
+
+ priv->commons = commons;
+ priv->selezione = selezione;
+
+ error = NULL;
+ gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
+ g_strsplit (g_strconcat ("lstore_strutture|",
+ (selezione ? "w_strutture" : "vbx_strutture"),
+ NULL), "|", -1),
+ &error);
+ if (error != NULL)
+ {
+ g_warning ("Errore: %s.", error->message);
+ return NULL;
+ }
+
+ priv->widget = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, (selezione ? "w_strutture" : "vbx_strutture")));
+ priv->selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview5")));
+ priv->lstore_strutture = GTK_LIST_STORE (gtk_builder_get_object (priv->commons->gtkbuilder, "lstore_strutture"));
+
+ if (priv->selezione)
+ {
+ priv->wtransient = GTK_WINDOW (priv->widget);
+ }
+ else
+ {
+ priv->wtransient = GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main"));
+ }
+
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button32"),
+ "clicked", G_CALLBACK (strutture_on_btn_nuovo_clicked), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button33"),
+ "clicked", G_CALLBACK (strutture_on_btn_modifica_clicked), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button34"),
+ "clicked", G_CALLBACK (strutture_on_btn_elimina_clicked), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview5"),
+ "row-activated", G_CALLBACK (strutture_on_trv_strutture_row_activated), (gpointer)a);
+
+ if (priv->selezione)
+ {
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "label26")));
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button35"),
+ "clicked", G_CALLBACK (strutture_on_btn_annulla_clicked), (gpointer)a);
+ g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button36"),
+ "clicked", G_CALLBACK (strutture_on_btn_seleziona_clicked), (gpointer)a);
+ }
+ else
+ {
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "button35")));
+ gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "button36")));
+ }
+
+ strutture_carica (a);
+
+ return a;
+}
+
+/**
+ * strutture_get_widget:
+ * @strutture:
+ *
+ */
+GtkWidget
+*strutture_get_widget (Strutture *strutture)
+{
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE (strutture);
+
+ return priv->widget;
+}
+
+/* PRIVATE */
+static void
+strutture_carica (Strutture *strutture)
+{
+ GtkTreeIter iter;
+ GdaDataModel *dm;
+
+ gint rows;
+ gint row;
+
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE (strutture);
+
+ gtk_list_store_clear (priv->lstore_strutture);
+
+ dm = gdaex_query (priv->commons->gdaex,
+ "SELECT c.id, c.nome"
+ " FROM strutture AS c"
+ " WHERE c.status <> 'E'"
+ " ORDER BY c.nome");
+ if (dm != NULL)
+ {
+ rows = gda_data_model_get_n_rows (dm);
+ for (row = 0; row < rows; row++)
+ {
+ gtk_list_store_append (priv->lstore_strutture, &iter);
+
+ gtk_list_store_set (priv->lstore_strutture, &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, "nome"),
+ -1);
+ }
+
+ g_object_unref (dm);
+ }
+}
+
+static void
+strutture_modifica (Strutture *strutture)
+{
+ GtkTreeIter iter;
+ guint id;
+
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE (strutture);
+
+ if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
+ {
+ GtkWidget *w;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_strutture), &iter,
+ COL_ID, &id,
+ -1);
+
+ Struttura *c = struttura_new (priv->commons, id);
+
+ g_signal_connect (G_OBJECT (c), "aggiornato",
+ G_CALLBACK (strutture_on_struttura_aggiornato), (gpointer)strutture);
+
+ w = struttura_get_widget (c);
+ gtk_window_set_transient_for (GTK_WINDOW (w), priv->wtransient);
+ gtk_widget_show (w);
+ }
+ else
+ {
+ GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare una struttura");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+}
+
+static void
+strutture_selezionato (Strutture *strutture)
+{
+ GtkTreeIter iter;
+ guint *id;
+
+ StruttureClass *klass = STRUTTURE_GET_CLASS (strutture);
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE (strutture);
+
+ if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_strutture), &iter,
+ COL_ID, &id,
+ -1);
+
+ g_signal_emit (G_OBJECT (strutture), klass->selezionato_signal_id, 0, id);
+
+ gtk_widget_destroy (priv->widget);
+ g_object_unref (G_OBJECT (strutture));
+ }
+ else
+ {
+ GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare una struttura");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+}
+
+static void
+strutture_on_struttura_aggiornato (gpointer instance, gpointer user_data)
+{
+ strutture_carica ((Strutture *)user_data);
+}
+
+static void
+strutture_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+{
+ Strutture *strutture = STRUTTURE (object);
+
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE (strutture);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+strutture_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+{
+ Strutture *strutture = STRUTTURE (object);
+
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE (strutture);
+
+ switch (property_id)
+ {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+/* CALLBACK */
+static void
+strutture_on_btn_nuovo_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkWidget *w;
+
+ Strutture *strutture = (Strutture *)user_data;
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE (strutture);
+
+ Struttura *c = struttura_new (priv->commons, 0);
+
+ g_signal_connect (G_OBJECT (c), "aggiornato",
+ G_CALLBACK (strutture_on_struttura_aggiornato), (gpointer)strutture);
+
+ w = struttura_get_widget (c);
+ gtk_window_set_transient_for (GTK_WINDOW (w), priv->wtransient);
+ gtk_widget_show (w);
+}
+
+static void
+strutture_on_btn_modifica_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ strutture_modifica ((Strutture *)user_data);
+}
+
+static void
+strutture_on_btn_elimina_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkWidget *dialog;
+ gboolean risp;
+
+ GtkTreeIter iter;
+ guint id;
+
+ Strutture *strutture = (Strutture *)user_data;
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE (strutture);
+
+ 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 la struttura selezionata?");
+ risp = gtk_dialog_run (GTK_DIALOG (dialog));
+ if (risp == GTK_RESPONSE_YES)
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_strutture), &iter,
+ COL_ID, &id,
+ -1);
+
+ gdaex_execute (priv->commons->gdaex,
+ g_strdup_printf ("UPDATE strutture SET status = 'E' WHERE id = %d", id));
+
+ strutture_carica (strutture);
+ }
+ gtk_widget_destroy (dialog);
+ }
+ else
+ {
+ dialog = gtk_message_dialog_new (priv->wtransient,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare una struttura");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+}
+
+static void
+strutture_on_trv_strutture_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *tree_path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
+{
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE ((Strutture *)user_data);
+
+ if (priv->selezione)
+ {
+ strutture_selezionato ((Strutture *)user_data);
+ }
+ else
+ {
+ strutture_modifica ((Strutture *)user_data);
+ }
+}
+
+
+static void
+strutture_on_btn_annulla_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ StrutturePrivate *priv = STRUTTURE_GET_PRIVATE ((Strutture *)user_data);
+
+ gtk_widget_destroy (priv->widget);
+ g_object_unref (G_OBJECT (user_data));
+}
+
+static void
+strutture_on_btn_seleziona_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ strutture_selezionato ((Strutture *)user_data);
+}