From 1b55a7f5a4e04628b56f9da7db112a9f5373b33b Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 2 May 2012 04:31:04 +0000 Subject: src/inc.c: use a flag to distinguish the state of activity. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3070 ee746299-78ed-0310-b773-934348b2243d --- src/inc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/inc.c b/src/inc.c index ddcfe3ed..bd86daf8 100644 --- a/src/inc.c +++ b/src/inc.c @@ -73,6 +73,8 @@ typedef struct _IncAccountNewMsgCount static GList *inc_dialog_list = NULL; +static gboolean inc_is_running = FALSE; + static guint inc_lock_count = 0; static gboolean block_notify = FALSE; @@ -279,6 +281,8 @@ void inc_mail(MainWindow *mainwin) if (!main_window_toggle_online_if_offline(mainwin)) return; + inc_is_running = TRUE; + inc_autocheck_timer_remove(); summary_write_cache(mainwin->summaryview); main_window_lock(mainwin); @@ -290,6 +294,7 @@ void inc_mail(MainWindow *mainwin) if (execute_command_line(prefs_common.extinc_cmd, FALSE) != 0) { main_window_unlock(mainwin); inc_autocheck_timer_set(); + inc_is_running = FALSE; return; } @@ -314,6 +319,8 @@ void inc_mail(MainWindow *mainwin) g_slist_free(list); main_window_unlock(mainwin); inc_autocheck_timer_set(); + + inc_is_running = FALSE; } static gint inc_remote_account_mail(MainWindow *mainwin, PrefsAccount *account) @@ -481,6 +488,8 @@ gint inc_account_mail(MainWindow *mainwin, PrefsAccount *account) if (!main_window_toggle_online_if_offline(mainwin)) return 0; + inc_is_running = TRUE; + inc_autocheck_timer_remove(); summary_write_cache(mainwin->summaryview); main_window_lock(mainwin); @@ -496,6 +505,8 @@ gint inc_account_mail(MainWindow *mainwin, PrefsAccount *account) main_window_unlock(mainwin); inc_autocheck_timer_set(); + inc_is_running = FALSE; + return new_msgs; } @@ -512,6 +523,8 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck) if (!main_window_toggle_online_if_offline(mainwin)) return; + inc_is_running = TRUE; + inc_autocheck_timer_remove(); summary_write_cache(mainwin->summaryview); main_window_lock(mainwin); @@ -564,6 +577,8 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck) g_slist_free(count_list); main_window_unlock(mainwin); inc_autocheck_timer_set(); + + inc_is_running = FALSE; } gint inc_pop_before_smtp(PrefsAccount *account) @@ -579,6 +594,8 @@ gint inc_pop_before_smtp(PrefsAccount *account) if (!main_window_toggle_online_if_offline(mainwin)) return -1; + inc_is_running = TRUE; + inc_autocheck_timer_remove(); main_window_lock(mainwin); @@ -602,6 +619,8 @@ gint inc_pop_before_smtp(PrefsAccount *account) main_window_unlock(mainwin); inc_autocheck_timer_set(); + inc_is_running = FALSE; + return 0; } @@ -1611,6 +1630,9 @@ gboolean inc_is_active(void) { GList *cur; + if (inc_is_running) + return TRUE; + if (inc_dialog_list == NULL) return FALSE; -- cgit v1.2.3