2006-09-27 [wwp] 2.5.2cvs9
[claws.git] / src / inc.c
index c474da49365b7f1f45bb245c92be37160aad1c76..c86a6c59864f2fc4bcd977ea9e04a02a659b4f5d 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -123,7 +123,8 @@ static gint inc_dialog_delete_cb    (GtkWidget      *widget,
                                         gpointer        data);
 
 static gint get_spool                  (FolderItem     *dest,
-                                        const gchar    *mbox);
+                                        const gchar    *mbox,
+                                        PrefsAccount   *account);
 
 static gint inc_spool_account(PrefsAccount *account);
 static gint inc_all_spool(void);
@@ -361,10 +362,20 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
        inc_autocheck_timer_set();
 }
 
+static void inc_progress_dialog_size_allocate_cb(GtkWidget *widget,
+                                        GtkAllocation *allocation)
+{
+       g_return_if_fail(allocation != NULL);
+
+       prefs_common.receivewin_width = allocation->width;
+       prefs_common.receivewin_height = allocation->height;
+}
+
 static IncProgressDialog *inc_progress_dialog_create(gboolean autocheck)
 {
        IncProgressDialog *dialog;
        ProgressDialog *progress;
+       static GdkGeometry geometry;
 
        dialog = g_new0(IncProgressDialog, 1);
 
@@ -375,7 +386,9 @@ static IncProgressDialog *inc_progress_dialog_create(gboolean autocheck)
                         G_CALLBACK(inc_cancel_cb), dialog);
        g_signal_connect(G_OBJECT(progress->window), "delete_event",
                         G_CALLBACK(inc_dialog_delete_cb), dialog);
-       /* manage_window_set_transient(GTK_WINDOW(progress->window)); */
+       g_signal_connect(G_OBJECT(progress->window), "size_allocate",
+                        G_CALLBACK(inc_progress_dialog_size_allocate_cb), NULL);
+       /* manage_window_set_transient(GTK_WINDOW(progress->window)); */
 
        progress_dialog_get_fraction(progress);
 
@@ -386,6 +399,16 @@ static IncProgressDialog *inc_progress_dialog_create(gboolean autocheck)
        stock_pixbuf_gdk(progress->treeview, STOCK_PIXMAP_ERROR,
                         &errorpix);
 
+       if (!geometry.min_height) {
+               geometry.min_width = 460;
+               geometry.min_height = 250;
+       }
+
+       gtk_window_set_geometry_hints(GTK_WINDOW(progress->window), NULL, &geometry,
+                                     GDK_HINT_MIN_SIZE);
+       gtk_widget_set_size_request(progress->window, prefs_common.receivewin_width,
+                                   prefs_common.receivewin_height);
+
        if (prefs_common.recv_dialog_mode == RECV_DIALOG_ALWAYS ||
            (prefs_common.recv_dialog_mode == RECV_DIALOG_MANUAL &&
             !autocheck)) {
@@ -1096,7 +1119,6 @@ static void inc_put_error(IncState istate, Pop3Session *session)
                err_msg = g_strdup_printf(_("Connection to %s:%d failed."),
                                          SESSION(session)->server, 
                                          SESSION(session)->port);
-               fatal_error = TRUE;
                break;
        case INC_ERROR:
                log_msg = _("Error occurred while processing mail.");
@@ -1122,7 +1144,6 @@ static void inc_put_error(IncState istate, Pop3Session *session)
                break;
        case INC_SOCKET_ERROR:
                log_msg = _("Socket error.");
-               fatal_error = TRUE;
                if (prefs_common.no_recv_err_panel)
                        break;
                err_msg = g_strdup_printf(_("Socket error on connection to %s:%d."),
@@ -1149,6 +1170,7 @@ static void inc_put_error(IncState istate, Pop3Session *session)
                break;
        case INC_AUTH_FAILED:
                log_msg = _("Authentication failed.");
+               fatal_error = TRUE;
                if (prefs_common.no_recv_err_panel)
                        break;
                if (session->error_msg)
@@ -1159,7 +1181,6 @@ static void inc_put_error(IncState istate, Pop3Session *session)
                break;
        case INC_TIMEOUT:
                log_msg = _("Session timed out.");
-               fatal_error = TRUE;
                if (prefs_common.no_recv_err_panel)
                        break;
                err_msg = g_strdup_printf(_("Connection to %s:%d timed out."), 
@@ -1176,6 +1197,9 @@ static void inc_put_error(IncState istate, Pop3Session *session)
                else
                        log_warning("%s\n", log_msg);
        }
+       if (prefs_common.no_recv_err_panel && fatal_error)
+               mainwindow_show_error();
+
        if (err_msg) {
                alertpanel_error_log(err_msg);
                g_free(err_msg);
@@ -1253,7 +1277,7 @@ static gint inc_spool_account(PrefsAccount *account)
                return -1;
        }
        
-       result = get_spool(inbox, mbox);
+       result = get_spool(inbox, mbox, account);
        g_free(mbox);
        
        statusbar_pop_all();
@@ -1284,7 +1308,7 @@ static gint inc_all_spool(void)
        return new_msgs;
 }
 
-static gint get_spool(FolderItem *dest, const gchar *mbox)
+static gint get_spool(FolderItem *dest, const gchar *mbox, PrefsAccount *account)
 {
        gint msgs, size;
        gint lockfd;
@@ -1313,7 +1337,7 @@ static gint get_spool(FolderItem *dest, const gchar *mbox)
        debug_print("Getting new messages from %s into %s...\n",
                    mbox, dest->path);
 
-       msgs = proc_mbox(dest, tmp_mbox, TRUE);
+       msgs = proc_mbox(dest, tmp_mbox, TRUE, account);
 
        g_unlink(tmp_mbox);
        if (msgs >= 0) empty_mbox(mbox);