* add "Copy" to the CSM; might fix NB#58246, but needs discussion with the UI designer
[modest] / src / maemo / modest-maemo-utils.c
index 6c8b0ae..d45f1d8 100644 (file)
@@ -277,6 +277,14 @@ on_camel_account_get_supported_secure_authentication (
        ModestGetSupportedAuthInfo *info = (ModestGetSupportedAuthInfo*)user_data;
        g_return_if_fail (info);
        
+       /* Free everything if the actual action was canceled */
+       if (info->cancel)
+       {
+               g_slice_free (ModestGetSupportedAuthInfo, info);
+               info = NULL;
+               return;
+       }
+
        if (!auth_types) {
                printf ("DEBUG: %s: auth_types is NULL.\n", __FUNCTION__);
                info->finished = TRUE; /* We are blocking, waiting for this. */
@@ -373,18 +381,21 @@ GList* modest_maemo_utils_get_supported_secure_authentication_methods (ModestTra
        ModestGetSupportedAuthInfo *info = g_slice_new (ModestGetSupportedAuthInfo);
        info->finished = FALSE;
        info->result = NULL;
+       info->cancel = FALSE;
        info->progress = gtk_progress_bar_new();
-  info->dialog = gtk_dialog_new_with_buttons(_("Checking for supported authentication types"),
+  info->dialog = gtk_dialog_new_with_buttons(_("Authentication"),
                                                                                                                                parent_window, GTK_DIALOG_MODAL,
                                                                                                                                GTK_STOCK_CANCEL,
                                                                                                                                GTK_RESPONSE_REJECT,
                                                                                                                                NULL);
+       //gtk_window_set_default_size(GTK_WINDOW(info->dialog), 300, 100);
        
        g_signal_connect(G_OBJECT(info->dialog), "response", G_CALLBACK(on_secure_auth_cancel), info);
        
+       gtk_container_add(GTK_CONTAINER(GTK_DIALOG(info->dialog)->vbox),
+                                                                               gtk_label_new("Checking for supported authentication types..."));
        gtk_container_add(GTK_CONTAINER(GTK_DIALOG(info->dialog)->vbox), info->progress);
-       gtk_widget_show(info->progress);
-       gtk_widget_show(info->dialog);
+       gtk_widget_show_all(info->dialog);
   gtk_progress_bar_pulse(GTK_PROGRESS_BAR(info->progress));
        
        printf ("DEBUG: %s: STARTING.\n", __FUNCTION__);
@@ -397,15 +408,17 @@ GList* modest_maemo_utils_get_supported_secure_authentication_methods (ModestTra
        /* Block until the callback has been called,
         * driving the main context, so that the (idle handler) callback can be 
         * called, and so that our dialog is clickable: */
-       while (!(info->finished) && (!info->cancel)) {
+       while (!(info->finished) && !(info->cancel)) {
     gtk_main_iteration_do(FALSE); 
        }
        
   gtk_widget_destroy(info->dialog);
                
        GList *result = info->result;
-       g_slice_free (ModestGetSupportedAuthInfo, info);
-       info = NULL;
-       
+       if (!info->cancel)
+       {
+               g_slice_free (ModestGetSupportedAuthInfo, info);
+               info = NULL;
+       }
        return result;
 }