]> saetta.ns0.it Git - zakform/gtk/commitdiff
Added ZakFormForm::get_messages.
authorAndrea Zagli <azagli@libero.it>
Sat, 2 Jan 2016 11:07:16 +0000 (12:07 +0100)
committerAndrea Zagli <azagli@libero.it>
Sat, 2 Jan 2016 11:07:16 +0000 (12:07 +0100)
src/form.c

index 2faf60c156d8bf084a727283294a67a0b8a280e5..1e07a358f8aa3e2add614d19f30bed42e62ec229 100644 (file)
@@ -127,6 +127,8 @@ zak_form_gtk_form_is_valid (ZakFormGtkForm *form, GtkWidget *parent_window)
 
        GtkWidget *w_to_focus;
 
+       GPtrArray *ar_messages;
+
        g_return_val_if_fail (parent_window != NULL ? GTK_IS_WINDOW (parent_window) : TRUE, FALSE);
 
        ZakFormGtkFormPrivate *priv = ZAK_FORM_GTK_FORM_GET_PRIVATE (form);
@@ -141,7 +143,7 @@ zak_form_gtk_form_is_valid (ZakFormGtkForm *form, GtkWidget *parent_window)
                        /* collect error messages */
                        for (i = 0; i < priv->ar_elements->len; i++)
                                {
-                                       GPtrArray *ar_messages = zak_form_element_get_messages ((ZakFormElement *)g_ptr_array_index (priv->ar_elements, i));
+                                       ar_messages = zak_form_element_get_messages ((ZakFormElement *)g_ptr_array_index (priv->ar_elements, i));
                                        if (ar_messages != NULL)
                                                {
                                                        if (w_to_focus == NULL)
@@ -156,6 +158,15 @@ zak_form_gtk_form_is_valid (ZakFormGtkForm *form, GtkWidget *parent_window)
                                                }
                                }
 
+                       ar_messages = zak_form_form_get_messages (ZAK_FORM_FORM (form));
+                       if (ar_messages != NULL)
+                               {
+                                       for (m = 0; m < ar_messages->len; m++)
+                                               {
+                                                       g_string_append_printf (str, "\n - %s", (gchar *)g_ptr_array_index (ar_messages, m));
+                                               }
+                               }
+
                        if (g_strcmp0 (str->str, "") != 0)
                                {
                                        GtkWidget *dialog;