* Fixes NB#85880, show the proper server name if a SMTP send fails
[modest] / src / modest-utils.c
index 86e5830..9753267 100644 (file)
@@ -275,6 +275,26 @@ on_secure_auth_cancel(GtkWidget* dialog, int response, gpointer user_data)
                info->cancel = TRUE;
        }
 }
+typedef struct {
+       GtkProgressBar *progress;
+       gboolean not_finished;
+} KeepPulsing;
+
+static gboolean
+keep_pulsing (gpointer user_data)
+{
+       KeepPulsing *info = (KeepPulsing *) user_data;
+       
+       gtk_progress_bar_pulse (info->progress);
+
+       if (!info->not_finished) {
+               g_object_unref (info->progress);
+               g_slice_free (KeepPulsing, info);
+               return FALSE;
+       }
+       
+       return TRUE;
+}
 
 GList*
 modest_utils_get_supported_secure_authentication_methods (ModestTransportStoreProtocol proto, 
@@ -341,8 +361,11 @@ modest_utils_get_supported_secure_authentication_methods (ModestTransportStorePr
        info->cancel = FALSE;
        info->error = NULL;
        info->progress = gtk_progress_bar_new();
-       /* TODO: Need logical_ID for the title: */
-       info->dialog = gtk_dialog_new_with_buttons(_("Authentication"),
+
+       /* FIXME: the title (first arg) here is empty; there should be 'accountwizard_fi_authentication', 
+        *  but that does not exist yet; see bug #82487. so, for now, we simply leave it empty
+         */
+       info->dialog = gtk_dialog_new_with_buttons(" ", 
                                                   parent_window, GTK_DIALOG_MODAL,
                                                   _("mcen_bd_dialog_cancel"),
                                                   GTK_RESPONSE_REJECT,
@@ -355,9 +378,16 @@ modest_utils_get_supported_secure_authentication_methods (ModestTransportStorePr
                          gtk_label_new(_("emev_ni_checking_supported_auth_methods")));
        gtk_container_add(GTK_CONTAINER(GTK_DIALOG(info->dialog)->vbox), info->progress);
        gtk_widget_show_all(info->dialog);
-       gtk_progress_bar_pulse(GTK_PROGRESS_BAR(info->progress));
+
+       KeepPulsing *pi = g_slice_new (KeepPulsing);
+       pi->progress = (GtkProgressBar *) g_object_ref (info->progress);
+       pi->not_finished = TRUE;
+       
+       /* Starts the pulsing of the progressbar */
+       g_timeout_add (500, keep_pulsing, pi);
        
        printf ("DEBUG: %s: STARTING.\n", __FUNCTION__);
+       
        tny_camel_account_get_supported_secure_authentication (
                TNY_CAMEL_ACCOUNT (tny_account),
                on_camel_account_get_supported_secure_authentication,
@@ -366,6 +396,9 @@ modest_utils_get_supported_secure_authentication_methods (ModestTransportStorePr
 
        gtk_dialog_run (GTK_DIALOG (info->dialog));
        
+       pi->not_finished = FALSE;
+       /* pi is freed in the timeout itself to avoid a GCond here */
+       
        gtk_widget_destroy(info->dialog);
                        
        GList *result = info->result;