Folder view remote "special folders" rendered as remote (fixes NB#107853)
[modest] / src / hildon2 / modest-maemo-security-options-view.c
index 7ef6dfb..65bf10c 100644 (file)
@@ -151,6 +151,7 @@ create_incoming_security (ModestSecurityOptionsView* self,
                entry_caption = modest_maemo_utils_create_captioned (title_size_group,
                                                                     value_size_group,
                                                                     _("mcen_fi_emailsetup_port"), 
+                                                                    FALSE,
                                                                     ppriv->port_view);
        }
 
@@ -163,13 +164,13 @@ create_incoming_security (ModestSecurityOptionsView* self,
                          G_CALLBACK (on_security_changed), self);
 
        /* Pack into container */
-       gtk_box_pack_start (GTK_BOX (self), ppriv->security_view,
-                           FALSE, FALSE, MODEST_MARGIN_HALF);
+       gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view,
+                           FALSE, FALSE, 0);
        if (ppriv->full)
                gtk_box_pack_start (GTK_BOX (self), entry_caption, 
                                    FALSE, FALSE, MODEST_MARGIN_HALF);
-       gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view,
-                           FALSE, FALSE, MODEST_MARGIN_HALF);
+       gtk_box_pack_start (GTK_BOX (self), ppriv->security_view,
+                           FALSE, FALSE, 0);
 
        /* Show widgets */
        if (ppriv->full) {
@@ -220,12 +221,23 @@ on_entry_changed (GtkEditable *editable,
        } else {
                missing = FALSE;
        }
+
+       if (!missing && ppriv->full && !modest_number_editor_is_valid (MODEST_NUMBER_EDITOR (ppriv->port_view)))
+               missing = TRUE;
        
        /* Emit a signal to notify if mandatory data is missing */
        g_signal_emit_by_name (G_OBJECT (self), "missing_mandatory_data", 
                               missing, NULL);
 }
 
+void
+on_valid_changed (ModestNumberEditor *editor,
+                 gboolean valid,
+                 ModestSecurityOptionsView *self)
+{
+       on_entry_changed (NULL, (gpointer) self);
+}
+
 static void
 create_outgoing_security (ModestSecurityOptionsView* self,
                          GtkSizeGroup *title_size_group,
@@ -268,7 +280,8 @@ create_outgoing_security (ModestSecurityOptionsView* self,
                user_label = g_strdup_printf("%s*", _("mail_fi_username"));
                user_caption = modest_maemo_utils_create_captioned (title_size_group,
                                                                    value_size_group,
-                                                                   user_label, 
+                                                                   user_label,
+                                                                   FALSE,
                                                                    ppriv->user_entry);
                g_free (user_label);
        
@@ -292,12 +305,14 @@ create_outgoing_security (ModestSecurityOptionsView* self,
                pwd_caption = modest_maemo_utils_create_captioned (title_size_group,
                                                                   value_size_group,
                                                                   _("mail_fi_password"), 
+                                                                  FALSE,
                                                                   ppriv->pwd_entry);
 
                ppriv->port_view = GTK_WIDGET (modest_number_editor_new (PORT_MIN, PORT_MAX));
                port_caption = modest_maemo_utils_create_captioned (title_size_group,
                                                                    value_size_group,
                                                                    _("mcen_fi_emailsetup_port"), 
+                                                                   FALSE,
                                                                    ppriv->port_view);
        }
 
@@ -309,6 +324,8 @@ create_outgoing_security (ModestSecurityOptionsView* self,
                                  G_CALLBACK (on_auth_changed), self);
                g_signal_connect (G_OBJECT (ppriv->user_entry), "changed",
                                  G_CALLBACK (on_entry_changed), self);
+               g_signal_connect (G_OBJECT (ppriv->port_view), "valid-changed",
+                                           G_CALLBACK (on_valid_changed), self);
        }
 
        /* Initialize widgets */
@@ -327,9 +344,8 @@ create_outgoing_security (ModestSecurityOptionsView* self,
                gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, MODEST_MARGIN_HALF);
                gtk_box_pack_start (GTK_BOX (self), port_caption, FALSE, FALSE, MODEST_MARGIN_HALF);
        } else {
-               /* The order is different */
-               gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, MODEST_MARGIN_HALF);
                gtk_box_pack_start (GTK_BOX (self), ppriv->auth_view, FALSE, FALSE, MODEST_MARGIN_HALF);
+               gtk_box_pack_start (GTK_BOX (self), ppriv->security_view, FALSE, FALSE, MODEST_MARGIN_HALF);
        }
 
        /* Show widgets */