--- /dev/null
+
+[Anjuta]
+Maximized=1
+Geometry=1366x741+0+0
+
+[File Loader]
+Files=file:///home/andreaz/files/comune/solipa/territorio/src/via.c#213%%%file:///home/andreaz/files/comune/solipa/territorio/src/widget.h#80%%%file:///home/andreaz/files/comune/solipa/territorio/src/widget.c#616%%%file:///home/andreaz/files/comune/solipa/territorio/src/vie.c#329
+
+[Document Manager]
+bookmarks=<?xml version="1.0" encoding="UTF-8"?>\n<bookmarks/>\n
+
+[Execution]
+Run in terminal=2
+Working directories=file:///home/andreaz/files/comune/solipa/territorio
+
+[Project Manager]
+Shortcut=territorio//territorio//src//territorio%%%territorio//territorio//libreria//libterritorio.la%%%territorio//territorio//tests//widget
+Expand=territorio
+
+[Build]
+Configuration list=1:Default:%%%1:Debug:Debug%%%1:Profiling:Profiling%%%1:Optimized:Optimized
+Selected Configuration=Default
+BuildArgs/Default=--enable-maintainer-mode
+BuildArgs/Debug=--enable-maintainer-mode 'CFLAGS=-g -O0' 'CXXFLAGS=-g -O0' 'JFLAGS=-g -O0' 'FFLAGS=-g -O0'
+BuildArgs/Profiling=--enable-maintainer-mode 'CFLAGS=-g -pg' 'CXXFLAGS=-g -pg' 'JFLAGS=-g -pg' 'FFLAGS=-g -pg'
+BuildArgs/Optimized=--enable-maintainer-mode 'CFLAGS=-O2' 'CXXFLAGS=-O2' 'JFLAGS=-O2' 'FFLAGS=-O2'
+
+[Debugger]
+Stop at beginning=2
--- /dev/null
+<?xml version="1.0"?>
+<dock-layout><layout name="__default__"><dock name="__dock_1" floating="no" width="-1" height="-1" floatx="0" floaty="0"><paned orientation="horizontal" locked="no" position="985"><notebook orientation="vertical" locked="no" page="0"><item name="AnjutaDocumentManager" orientation="vertical" locked="no"/><item name="AnjutaDevhelpDisplay" orientation="vertical" locked="no"/><item name="AnjutaTerminal" orientation="vertical" locked="no"/></notebook><paned orientation="vertical" locked="no" position="307"><notebook orientation="vertical" locked="no" page="1"><item name="AnjutaFileManager" orientation="vertical" locked="no"/><item name="AnjutaProjectManager" orientation="vertical" locked="no"/></notebook><notebook orientation="vertical" locked="no" page="0"><item name="AnjutaSymbolDB" orientation="vertical" locked="no"/><item name="AnjutaDevhelpIndex" orientation="vertical" locked="no"/></notebook></paned></paned></dock></layout></dock-layout>
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtkformui 0.0 -->
- <requires lib="gtk+" version="2.16"/>
+ <requires lib="gtk+" version="2.24"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkAboutDialog" id="dlg_about">
<property name="can_focus">False</property>
<column type="guint"/>
<!-- column-name nome -->
<column type="gchararray"/>
+ <!-- column-name id_comuni -->
+ <column type="guint"/>
<!-- column-name comune -->
<column type="gchararray"/>
<!-- column-name provincia -->
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">lstore_vie</property>
- <property name="headers_clickable">False</property>
+ <property name="reorderable">True</property>
<property name="rules_hint">True</property>
<property name="search_column">1</property>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn7">
<property name="title">Nome</property>
+ <property name="clickable">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">1</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext8"/>
<attributes>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn12">
<property name="title">Comune</property>
+ <property name="clickable">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">3</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext13"/>
<attributes>
- <attribute name="text">2</attribute>
+ <attribute name="text">3</attribute>
</attributes>
</child>
</object>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn13">
<property name="title">Provincia</property>
+ <property name="clickable">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">4</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext14"/>
<attributes>
- <attribute name="text">3</attribute>
+ <attribute name="text">4</attribute>
</attributes>
</child>
</object>
<child>
<object class="GtkTreeViewColumn" id="treeviewcolumn14">
<property name="title">Regione</property>
+ <property name="clickable">True</property>
+ <property name="reorderable">True</property>
+ <property name="sort_column_id">4</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext15"/>
<attributes>
- <attribute name="text">4</attribute>
+ <attribute name="text">5</attribute>
</attributes>
</child>
</object>
[AUTE]
plugin=/usr/local/lib/libaute/plugins/libaute-db
-cnc_string=PostgreSQL://postgres:postgres@HOST=localhost;PORT=5432;DB_NAME=aute
+cnc_string=PostgreSQL://postgres:postgres@HOST=localhost;PORT=5432;DB_NAME=autedb
[AUTOZ]
cnc_string=PostgreSQL://postgres:postgres@HOST=localhost;PORT=5432;DB_NAME=autoz
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button28")), FALSE);
}
+ else if (priv->id != 0)
+ {
+ ires1 = autoz_get_resource_from_id (priv->commons->autoz,
+ g_strdup_printf ("territorio_comuni_%d_rw", priv->id));
+ if (AUTOZ_IS_IRESOURCE (ires1) && !autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button28")), FALSE);
+ }
+ }
return a;
}
GtkTreeIter iter;
guint id;
+ AutozIResource *ires1;
+
TerritorioComuni *territorio_comuni = (TerritorioComuni *)user_data;
TerritorioComuniPrivate *priv = TERRITORIO_COMUNI_GET_PRIVATE (territorio_comuni);
if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
{
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_comuni), &iter,
+ COL_ID, &id,
+ -1);
+ ires1 = autoz_get_resource_from_id (priv->commons->autoz,
+ g_strdup_printf ("territorio_comuni_%d_rw", id));
+ if (AUTOZ_IS_IRESOURCE (ires1) && !autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+ {
+ solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Non si è autorizzati a eliminare il comune selezionato.");
+ return;
+ }
+
dialog = gtk_message_dialog_new (priv->wtransient,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
risp = gtk_dialog_run (GTK_DIALOG (dialog));
if (risp == GTK_RESPONSE_YES)
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_comuni), &iter,
- COL_ID, &id,
- -1);
-
gdaex_execute (priv->commons->gdaex,
g_strdup_printf ("UPDATE comuni SET status = 'E' WHERE id = %d", id));
GtkForm *form;
GtkWidget *w;
+ GtkWidget *twidget;
GObject **objects;
{
GError *error;
AutozIResource *ires1;
- GtkWidget *twidget;
TerritorioVia *a = TERRITORIO_VIA (g_object_new (territorio_via_get_type (), NULL));
"label41",
NULL);
- twidget = territorio_widget_new (priv->commons);
- g_object_set (G_OBJECT (twidget),
+ priv->twidget = territorio_widget_new (priv->commons);
+ g_object_set (G_OBJECT (priv->twidget),
"show-stato", FALSE,
"show-regione", FALSE,
"show-provincia", FALSE,
"show-via", FALSE,
NULL);
- territorio_widget_add_to_gtkform (TERRITORIO_WIDGET (twidget), priv->form,
+ territorio_widget_add_to_gtkform (TERRITORIO_WIDGET (priv->twidget), priv->form,
NULL,
FALSE,
NULL,
FALSE);
gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "hbox3")),
- twidget, TRUE, TRUE, 0);
- gtk_widget_show_all (twidget);
+ priv->twidget, TRUE, TRUE, 0);
+ gtk_widget_show_all (priv->twidget);
g_signal_connect (priv->w,
"delete-event", G_CALLBACK (territorio_via_on_w_via_delete_event), (gpointer)a);
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button52")), FALSE);
}
+ else if (priv->id != 0)
+ {
+ ires1 = autoz_get_resource_from_id (priv->commons->autoz,
+ g_strdup_printf ("territorio_comuni_%d_rw", territorio_widget_get_comune (TERRITORIO_WIDGET (priv->twidget))));
+ if (AUTOZ_IS_IRESOURCE (ires1) && !autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+ {
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "button52")), FALSE);
+ }
+ }
return a;
}
static void
territorio_via_salva (TerritorioVia *territorio_via)
{
- GError *error = NULL;
gchar *sql;
GtkWidget *dialog;
-
- GDate *da;
- GDate *a;
+ AutozIResource *ires1;
TerritorioViaClass *klass = TERRITORIO_VIA_GET_CLASS (territorio_via);
return;
}
+ ires1 = autoz_get_resource_from_id (priv->commons->autoz,
+ g_strdup_printf ("territorio_comuni_%d_rw", territorio_widget_get_comune (TERRITORIO_WIDGET (priv->twidget))));
+ if (AUTOZ_IS_IRESOURCE (ires1) && !autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+ {
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Non si è autorizzati a modificare le vie del comune selezionato.");
+ return;
+ }
+
if (priv->id == 0)
{
sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_INSERT);
{
COL_ID,
COL_NOME,
+ COL_ID_COMUNI,
COL_COMUNE,
COL_PROVINCIA,
COL_REGIONE
error = NULL;
gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
g_strsplit (g_strconcat ("lstore_vie|",
- (selezione ? "w_vie" : "vbox14"),
- NULL), "|", -1),
+ (selezione ? "w_vie" : "vbox14"),
+ NULL), "|", -1),
&error);
if (error != NULL)
{
}
sql = g_strdup_printf ("SELECT v.id, v.nome,"
- " c.nome AS comune,"
+ " v.id_comuni, c.nome AS comune,"
" p.nome || ' (' || p.sigla || ')' AS provincia,"
" r.nome AS regione"
" FROM vie AS v"
for (row = 0; row < rows; row++)
{
gtk_list_store_append (priv->lstore_vie, &iter);
-
gtk_list_store_set (priv->lstore_vie, &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"),
+ COL_ID_COMUNI, gdaex_data_model_get_field_value_integer_at (dm, row, "id_comuni"),
COL_COMUNE, gdaex_data_model_get_field_value_stringify_at (dm, row, "comune"),
COL_PROVINCIA, gdaex_data_model_get_field_value_stringify_at (dm, row, "provincia"),
COL_REGIONE, gdaex_data_model_get_field_value_stringify_at (dm, row, "regione"),
}
else
{
- GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- "Occorre prima selezionare una via");
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare una via.");
}
}
}
else
{
- GtkWidget *dialog = gtk_message_dialog_new (priv->wtransient,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- "Occorre prima selezionare una via.");
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare una via.");
}
}
GtkTreeIter iter;
guint id;
+ guint id_comuni;
+
+ AutozIResource *ires1;
TerritorioVie *territorio_vie = (TerritorioVie *)user_data;
TerritorioViePrivate *priv = TERRITORIO_VIE_GET_PRIVATE (territorio_vie);
if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
{
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_vie), &iter,
+ COL_ID, &id,
+ COL_ID_COMUNI, &id_comuni,
+ -1);
+ ires1 = autoz_get_resource_from_id (priv->commons->autoz,
+ g_strdup_printf ("territorio_comuni_%d_rw", id_comuni));
+ if (AUTOZ_IS_IRESOURCE (ires1) && !autoz_is_allowed (priv->commons->autoz, priv->commons->role_utente, ires1, FALSE))
+ {
+ solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Non si è autorizzati a eliminare le vie del comune selezionato.");
+ return;
+ }
+
dialog = gtk_message_dialog_new (priv->wtransient,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_QUESTION,
risp = gtk_dialog_run (GTK_DIALOG (dialog));
if (risp == GTK_RESPONSE_YES)
{
- gtk_tree_model_get (GTK_TREE_MODEL (priv->lstore_vie), &iter,
- COL_ID, &id,
- -1);
-
gdaex_execute (priv->commons->gdaex,
g_strdup_printf ("UPDATE vie SET status = 'E' WHERE id = %d", id));
}
else
{
- dialog = gtk_message_dialog_new (priv->wtransient,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- "Occorre prima selezionare una via");
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ solipa_message_dialog (GTK_WIDGET (priv->wtransient),
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Occorre prima selezionare una via");
}
}
}
}
+guint
+territorio_widget_get_stato (TerritorioWidget *widget)
+{
+ guint ret;
+ gboolean visible;
+
+ TerritorioWidget *territorio_widget = TERRITORIO_WIDGET (widget);
+ TerritorioWidgetPrivate *priv = TERRITORIO_WIDGET_GET_PRIVATE (territorio_widget);
+
+ g_return_val_if_fail (IS_TERRITORIO_WIDGET (widget), 0);
+
+ ret = 0;
+ visible = FALSE;
+
+ g_object_get (G_OBJECT (widget), "show-stato", &visible, NULL);
+ if (visible)
+ {
+ ret = strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_stato)), NULL, 10);
+ }
+
+ return ret;
+}
+
+guint
+territorio_widget_get_regione (TerritorioWidget *widget)
+{
+ guint ret;
+ gboolean visible;
+
+ TerritorioWidget *territorio_widget = TERRITORIO_WIDGET (widget);
+ TerritorioWidgetPrivate *priv = TERRITORIO_WIDGET_GET_PRIVATE (territorio_widget);
+
+ g_return_val_if_fail (IS_TERRITORIO_WIDGET (widget), 0);
+
+ ret = 0;
+ visible = FALSE;
+
+ g_object_get (G_OBJECT (widget), "show-regione", &visible, NULL);
+ if (visible)
+ {
+ ret = strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_regione)), NULL, 10);
+ }
+
+ return ret;
+}
+
+guint
+territorio_widget_get_provincia (TerritorioWidget *widget)
+{
+ guint ret;
+ gboolean visible;
+
+ TerritorioWidget *territorio_widget = TERRITORIO_WIDGET (widget);
+ TerritorioWidgetPrivate *priv = TERRITORIO_WIDGET_GET_PRIVATE (territorio_widget);
+
+ g_return_val_if_fail (IS_TERRITORIO_WIDGET (widget), 0);
+
+ ret = 0;
+ visible = FALSE;
+
+ g_object_get (G_OBJECT (widget), "show-provincia", &visible, NULL);
+ if (visible)
+ {
+ ret = strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_provincia)), NULL, 10);
+ }
+
+ return ret;
+}
+
+guint
+territorio_widget_get_comune (TerritorioWidget *widget)
+{
+ guint ret;
+ gboolean visible;
+
+ TerritorioWidget *territorio_widget = TERRITORIO_WIDGET (widget);
+ TerritorioWidgetPrivate *priv = TERRITORIO_WIDGET_GET_PRIVATE (territorio_widget);
+
+ g_return_val_if_fail (IS_TERRITORIO_WIDGET (widget), 0);
+
+ ret = 0;
+ visible = FALSE;
+
+ g_object_get (G_OBJECT (widget), "show-comune", &visible, NULL);
+ if (visible)
+ {
+ ret = strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_comune)), NULL, 10);
+ }
+
+ return ret;
+}
+
+guint
+territorio_widget_get_via (TerritorioWidget *widget)
+{
+ guint ret;
+ gboolean visible;
+
+ TerritorioWidget *territorio_widget = TERRITORIO_WIDGET (widget);
+ TerritorioWidgetPrivate *priv = TERRITORIO_WIDGET_GET_PRIVATE (territorio_widget);
+
+ g_return_val_if_fail (IS_TERRITORIO_WIDGET (widget), 0);
+
+ ret = 0;
+ visible = FALSE;
+
+ g_object_get (G_OBJECT (widget), "show-via", &visible, NULL);
+ if (visible)
+ {
+ ret = strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_via)), NULL, 10);
+ }
+
+ return ret;
+}
+
/* PRIVATE */
static void
territorio_widget_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
const gchar *via_field,
gboolean via_obligatory);
+guint territorio_widget_get_stato (TerritorioWidget *widget);
+guint territorio_widget_get_regione (TerritorioWidget *widget);
+guint territorio_widget_get_provincia (TerritorioWidget *widget);
+guint territorio_widget_get_comune (TerritorioWidget *widget);
+guint territorio_widget_get_via (TerritorioWidget *widget);
+
G_END_DECLS