From: Andrea Zagli Date: Sat, 2 Jan 2016 16:31:21 +0000 (+0100) Subject: Use of ZakFormElement::long_name. X-Git-Tag: v0.1.0~4 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=f18ed8c8287b05ad718b96ac0439aea3abe4d3b2;p=zakform%2Fgtk Use of ZakFormElement::long_name. --- diff --git a/src/form.c b/src/form.c index 1e07a35..fcbdd15 100644 --- a/src/form.c +++ b/src/form.c @@ -143,17 +143,22 @@ zak_form_gtk_form_is_valid (ZakFormGtkForm *form, GtkWidget *parent_window) /* collect error messages */ for (i = 0; i < priv->ar_elements->len; i++) { - ar_messages = zak_form_element_get_messages ((ZakFormElement *)g_ptr_array_index (priv->ar_elements, i)); + ZakFormElement *element; + + element = (ZakFormElement *)g_ptr_array_index (priv->ar_elements, i); + ar_messages = zak_form_element_get_messages (element); if (ar_messages != NULL) { if (w_to_focus == NULL) { - w_to_focus = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT ((ZakFormElement *)g_ptr_array_index (priv->ar_elements, i))); + w_to_focus = zak_form_gtk_form_element_get_widget (ZAK_FORM_GTK_FORM_ELEMENT (element)); } for (m = 0; m < ar_messages->len; m++) { - g_string_append_printf (str, "\n - %s", (gchar *)g_ptr_array_index (ar_messages, m)); + g_string_append_printf (str, "\n - «%s»: %s", + zak_form_element_get_long_name (element), + (gchar *)g_ptr_array_index (ar_messages, m)); } } } diff --git a/src/formelement.c b/src/formelement.c index 6c2dec1..4cde39f 100644 --- a/src/formelement.c +++ b/src/formelement.c @@ -285,6 +285,9 @@ zak_form_gtk_form_element_set_label (ZakFormGtkFormElement *element, GtkWidget * g_object_unref (priv->label); } priv->label = g_object_ref (label); + + zak_form_element_set_long_name (ZAK_FORM_ELEMENT (element), + gtk_label_get_text (GTK_LABEL (priv->label))); } /* PRIVATE */