static void territorio_widget_set_transient (TerritorioWidget *twidget);
+static void territorio_widget_controllo_coerenza (TerritorioWidget *widget);
+
static void territorio_widget_on_stato_aggiornato (gpointer instance, gpointer user_data);
static void territorio_widget_on_regione_aggiornato (gpointer instance, gpointer user_data);
static void territorio_widget_on_provincia_aggiornato (gpointer instance, gpointer user_data);
}
}
+static void
+territorio_widget_controllo_coerenza (TerritorioWidget *widget)
+{
+ TerritorioWidgetPrivate *priv = TERRITORIO_WIDGET_GET_PRIVATE (widget);
+
+ if (strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_regione)), NULL, 10) > 0
+ && !territorio_provincia_is_in_regione (priv->commons,
+ strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_provincia)), NULL, 10),
+ strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_regione)), NULL, 10)))
+ {
+ gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_provincia), "0");
+ gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_comune), "0");
+ gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_via), "0");
+ }
+ else if (strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_provincia)), NULL, 10) > 0
+ && !territorio_comune_is_in_provincia (priv->commons,
+ strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_comune)), NULL, 10),
+ strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_provincia)), NULL, 10)))
+ {
+ gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_comune), "0");
+ gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_via), "0");
+ }
+ else if (strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_comune)), NULL, 10) > 0
+ && !territorio_via_is_in_comune (priv->commons,
+ strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_via)), NULL, 10),
+ strtol (gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_comune)), NULL, 10)))
+ {
+ gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_via), "0");
+ }
+}
+
/* CALLBACK */
static void
territorio_widget_on_stato_aggiornato (gpointer instance, gpointer user_data)
gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_regione),
gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_regione)));
+
+ territorio_widget_controllo_coerenza (f);
}
static void
gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_provincia),
gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_provincia)));
+
+ territorio_widget_controllo_coerenza (f);
}
static void
gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_comune),
gtk_form_decoder_get_key (GTK_FORM_DECODER (priv->dec_comune)));
+
+ territorio_widget_controllo_coerenza (f);
}
static void
TerritorioWidgetPrivate *priv = TERRITORIO_WIDGET_GET_PRIVATE (f);
gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_regione), g_strdup_printf ("%d", id));
+
+ territorio_widget_controllo_coerenza (f);
}
static void
TerritorioWidgetPrivate *priv = TERRITORIO_WIDGET_GET_PRIVATE (f);
gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_provincia), g_strdup_printf ("%d", id));
+
+ territorio_widget_controllo_coerenza (f);
}
static void
TerritorioWidgetPrivate *priv = TERRITORIO_WIDGET_GET_PRIVATE (f);
gtk_form_decoder_set_key (GTK_FORM_DECODER (priv->dec_comune), g_strdup_printf ("%d", id));
+
+ territorio_widget_controllo_coerenza (f);
}
static void