sync with sylpheed 0.4.66cvs6
[claws.git] / src / account.c
index 5446c59c2831f3d56cb723022b7fbc4960d2178f..b5cd18f6f2aeb630f15817deafcfd2ac3aa53f44 100644 (file)
@@ -39,6 +39,7 @@
 #include "prefs_account.h"
 #include "compose.h"
 #include "manage_window.h"
+#include "inc.h"
 #include "gtkutils.h"
 #include "utils.h"
 #include "alertpanel.h"
@@ -76,6 +77,9 @@ static void account_down              (void);
 static void account_set_default                (void);
 
 static void account_edit_close         (void);
+static gint account_delete_event       (GtkWidget      *widget,
+                                        GdkEventAny    *event,
+                                        gpointer        data);
 static void account_key_pressed                (GtkWidget      *widget,
                                         GdkEventKey    *event,
                                         gpointer        data);
@@ -198,9 +202,12 @@ GList *account_get_list(void)
 
 void account_edit_open(void)
 {
+       inc_autocheck_timer_remove();
+       
        if (compose_get_compose_list()) {
                alertpanel_notice(_("Some composing windows are open.\n"
                                    "Please close all the composing windows before editing the accounts."));
+               inc_autocheck_timer_set();                                      
                return;
        }
 
@@ -223,6 +230,7 @@ void account_add(void)
        PrefsAccount *ac_prefs;
 
        ac_prefs = prefs_account_open(NULL);
+       inc_autocheck_timer_remove();
 
        if (!ac_prefs) return;
 
@@ -352,7 +360,7 @@ static void account_edit_create(void)
        gtk_window_set_title (GTK_WINDOW (window), _("Edit accounts"));
        gtk_window_set_modal (GTK_WINDOW (window), TRUE);
        gtk_signal_connect (GTK_OBJECT (window), "delete_event",
-                           GTK_SIGNAL_FUNC (account_edit_close), NULL);
+                           GTK_SIGNAL_FUNC (account_delete_event), NULL);
        gtk_signal_connect (GTK_OBJECT (window), "key_press_event",
                            GTK_SIGNAL_FUNC (account_key_pressed), NULL);
        gtk_signal_connect (GTK_OBJECT (window), "focus_in_event",
@@ -473,6 +481,7 @@ static void account_edit_prefs(void)
        Xstrdup_a(ac_name, ac_prefs->account_name, return);
 
        prefs_account_open(ac_prefs);
+       inc_autocheck_timer_remove();
 
        if (!prev_default && ac_prefs->is_default)
                account_set_as_default(ac_prefs);
@@ -571,6 +580,15 @@ static void account_edit_close(void)
        main_window_reflect_prefs_all();
 
        gtk_widget_hide(edit_account.window);
+
+       inc_autocheck_timer_set();
+}
+
+static gint account_delete_event(GtkWidget *widget, GdkEventAny *event,
+                                gpointer data)
+{
+       account_edit_close();
+       return TRUE;
 }
 
 static void account_key_pressed(GtkWidget *widget, GdkEventKey *event,