[Commits] [SCM] claws branch, master, updated. 3.16.0-235-gdf5a927
ticho at claws-mail.org
ticho at claws-mail.org
Sat Jul 14 11:22:30 CEST 2018
The branch, master has been updated
via df5a927761513ef5fac8ead8fef34d31ebd090a0 (commit)
from 4188d85fff8054e36f62f25f66f23a898436a86f (commit)
Summary of changes:
src/account.c | 4 +
src/inc.c | 208 ++++++++++++++++++++++++++++++++++---------------
src/inc.h | 19 +++++
src/prefs_account.c | 147 ++++++++++++++++++++++++++++++++--
src/prefs_account.h | 4 +
src/prefs_common.h | 2 +-
src/prefs_migration.c | 24 ++++++
7 files changed, 337 insertions(+), 71 deletions(-)
- Log -----------------------------------------------------------------
commit df5a927761513ef5fac8ead8fef34d31ebd090a0
Author: Andrej Kacian <ticho at claws-mail.org>
Date: Sun Jun 17 15:10:50 2018 +0200
Allow separate autocheck configuration for accounts.
Accounts can have their own autocheck intervals, or follow
global interval.
This separates the autocheck configuration from 'Get all'.
config_version is bumped to 3, because meaning of
"receive_at_get_all" in account configuration has changed.
Closes bug #2552: in automatic checking, enable the use of
different time intervals
Closes bug #2837: Detach automatic email checking from 'get all'
diff --git a/src/account.c b/src/account.c
index d06ce8c..aa626ad 100644
--- a/src/account.c
+++ b/src/account.c
@@ -963,6 +963,10 @@ static void account_clone(GtkWidget *widget, gpointer data)
ACP_FDUP(inbox);
ACP_FDUP(local_inbox);
ACP_FASSIGN(max_articles);
+ ACP_FASSIGN(autochk_use_default);
+ ACP_FASSIGN(autochk_use_custom);
+ ACP_FASSIGN(autochk_itv);
+ ac_clon->autocheck_timer = 0;
ACP_FASSIGN(imap_auth_type);
diff --git a/src/inc.c b/src/inc.c
index 4d9f341..473e11e 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -133,7 +133,6 @@ static gint get_spool (FolderItem *dest,
PrefsAccount *account);
static gint inc_spool_account(PrefsAccount *account);
-static gint inc_all_spool(void);
static void inc_autocheck_timer_set_interval (guint interval);
static gint inc_autocheck_func (gpointer data);
@@ -310,14 +309,13 @@ gint inc_account_mail(MainWindow *mainwin, PrefsAccount *account)
return new_msgs;
}
-void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
+void inc_account_list_mail(MainWindow *mainwin, GList *account_list, gboolean autocheck,
gboolean notify)
{
GList *list, *queue_list = NULL;
IncProgressDialog *inc_dialog;
- gint new_msgs = 0;
- gint account_new_msgs = 0;
-
+ gint new_msgs = 0, num;
+
if (prefs_common.work_offline &&
!inc_offline_should_override( (autocheck == FALSE),
_("Claws Mail needs network access in order "
@@ -326,16 +324,13 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
if (inc_lock_count) return;
- inc_autocheck_timer_remove();
main_window_lock(mainwin);
- list = account_get_list();
- if (!list) {
+ if (!account_list) {
inc_update_stats(new_msgs);
inc_finished(mainwin, new_msgs > 0, autocheck);
main_window_unlock(mainwin);
inc_notify_cmd(new_msgs, notify);
- inc_autocheck_timer_set();
return;
}
@@ -345,39 +340,57 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
log_error(LOG_PROTOCOL, _("%s failed\n"), prefs_common.extinc_cmd);
main_window_unlock(mainwin);
- inc_autocheck_timer_set();
return;
}
}
-
- /* check local folders */
- account_new_msgs = inc_all_spool();
- if (account_new_msgs > 0)
- new_msgs += account_new_msgs;
- /* check IMAP4 / News folders */
- for (list = account_get_list(); list != NULL; list = list->next) {
+ /* Check all accounts in the list, one by one. */
+ for (list = account_list; list != NULL; list = list->next) {
PrefsAccount *account = list->data;
- if ((account->protocol == A_IMAP4 ||
- account->protocol == A_NNTP) && account->recv_at_getall) {
- new_msgs += folderview_check_new(FOLDER(account->folder));
+
+ if (account == NULL) {
+ debug_print("INC: Huh? inc_account_list_mail() got a NULL account, this should not happen!\n");
+ continue;
}
- }
- /* check POP3 accounts */
- for (list = account_get_list(); list != NULL; list = list->next) {
- IncSession *session;
- PrefsAccount *account = list->data;
+ debug_print("INC: checking account %d\n", account->account_id);
+ switch (account->protocol) {
+ case A_POP3:
+ if (!(account->receive_in_progress)) {
+ IncSession *session = inc_session_new(account);
+
+ if (session != NULL) {
+ debug_print("INC: adding POP3 account %d to inc queue\n",
+ account->account_id);
+ queue_list = g_list_append(queue_list, session);
+ }
+ }
+ break;
- if (account->recv_at_getall) {
- if (!(account->receive_in_progress)) {
- session = inc_session_new(account);
- if (session)
- queue_list = g_list_append(queue_list, session);
- }
+ case A_IMAP4:
+ case A_NNTP:
+ new_msgs += folderview_check_new(FOLDER(account->folder));
+ break;
+
+ case A_LOCAL:
+ num = inc_spool_account(account);
+ if (num > 0)
+ new_msgs += num;
+ break;
+
+ case A_NONE:
+ /* Nothing to do here, it's a SMTP-only account. */
+ break;
+
+ default:
+ debug_print("INC: encountered account %d with unknown protocol %d, ignoring\n",
+ account->account_id, account->protocol);
+ break;
}
}
+
+
if (queue_list) {
inc_dialog = inc_progress_dialog_create(autocheck);
inc_dialog->queue_list = queue_list;
@@ -393,7 +406,45 @@ void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
inc_finished(mainwin, new_msgs > 0, autocheck);
main_window_unlock(mainwin);
inc_notify_cmd(new_msgs, notify);
- inc_autocheck_timer_set();
+}
+
+void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
+ gboolean notify)
+{
+ GList *list, *list2 = NULL;
+ gboolean condition;
+
+ debug_print("INC: inc_all_account_mail(), autocheck: %s\n",
+ autocheck ? "YES" : "NO");
+
+ /* Collect list of accounts which use the global autocheck interval. */
+ for (list = account_get_list(); list != NULL; list = list->next) {
+ PrefsAccount *account = list->data;
+
+ /* Nothing to do for SMTP-only accounts. */
+ if (account->protocol == A_NONE)
+ continue;
+
+ /* Set up condition which decides whether or not to check
+ * this account, based on whether we're doing global autocheck
+ * or a manual 'Get all' check. */
+ if (autocheck)
+ condition = prefs_common_get_prefs()->autochk_newmail
+ && account->autochk_use_default;
+ else
+ condition = account->recv_at_getall;
+
+ if (condition) {
+ debug_print("INC: will check account %d\n", account->account_id);
+ list2 = g_list_append(list2, account);
+ }
+ }
+
+ /* Do the check on the collected accounts. */
+ if (list2 != NULL) {
+ inc_account_list_mail(mainwin, list2, autocheck, notify);
+ g_list_free(list2);
+ }
}
static void inc_progress_dialog_size_allocate_cb(GtkWidget *widget,
@@ -1351,29 +1402,6 @@ static gint inc_spool_account(PrefsAccount *account)
return result;
}
-static gint inc_all_spool(void)
-{
- GList *list = NULL;
- gint new_msgs = 0;
- gint account_new_msgs = 0;
-
- list = account_get_list();
- if (!list) return 0;
-
- for (; list != NULL; list = list->next) {
- PrefsAccount *account = list->data;
-
- if ((account->protocol == A_LOCAL) &&
- (account->recv_at_getall)) {
- account_new_msgs = inc_spool_account(account);
- if (account_new_msgs > 0)
- new_msgs += account_new_msgs;
- }
- }
-
- return new_msgs;
-}
-
static gint get_spool(FolderItem *dest, const gchar *mbox, PrefsAccount *account)
{
gint msgs, size;
@@ -1464,20 +1492,23 @@ void inc_autocheck_timer_init(MainWindow *mainwin)
inc_autocheck_timer_set();
}
-static void inc_autocheck_timer_set_interval(guint interval)
+static void inc_autocheck_timer_set_interval(guint _interval)
{
+ guint interval = _interval;
+
+ /* Convert the interval to seconds if needed. */
+ if (_interval % 1000 == 0)
+ interval /= 1000;
+
inc_autocheck_timer_remove();
/* last test is to avoid re-enabling auto_check after modifying
the common preferences */
if (prefs_common.autochk_newmail && autocheck_data
&& prefs_common.work_offline == FALSE) {
- if (interval % 1000 == 0)
autocheck_timer =
- g_timeout_add_seconds(interval/1000, inc_autocheck_func, autocheck_data);
- else
- autocheck_timer = g_timeout_add
- (interval, inc_autocheck_func, autocheck_data);
- debug_print("added timer = %d\n", autocheck_timer);
+ g_timeout_add_seconds(interval, inc_autocheck_func, autocheck_data);
+ debug_print("added global inc timer %d at %u seconds\n",
+ autocheck_timer, interval);
}
}
@@ -1489,7 +1520,7 @@ void inc_autocheck_timer_set(void)
void inc_autocheck_timer_remove(void)
{
if (autocheck_timer) {
- debug_print("removed timer = %d\n", autocheck_timer);
+ debug_print("removed global inc timer %d\n", autocheck_timer);
g_source_remove(autocheck_timer);
autocheck_timer = 0;
}
@@ -1500,16 +1531,65 @@ static gint inc_autocheck_func(gpointer data)
MainWindow *mainwin = (MainWindow *)data;
if (inc_lock_count) {
- debug_print("autocheck is locked.\n");
+ debug_print("global inc: autocheck is locked.\n");
inc_autocheck_timer_set_interval(1000);
return FALSE;
}
inc_all_account_mail(mainwin, TRUE, prefs_common.newmail_notify_auto);
+ inc_autocheck_timer_set();
+
+ return FALSE;
+}
+
+static gboolean inc_account_autocheck_func(gpointer data)
+{
+ PrefsAccount *account = (PrefsAccount *)data;
+ GList *list = NULL;
+
+ cm_return_val_if_fail(account != NULL, FALSE);
+
+ debug_print("account %d: inc_account_autocheck_func\n",
+ account->account_id);
+
+ list = g_list_append(list, account);
+ inc_account_list_mail(mainwindow_get_mainwindow(),
+ list, TRUE, prefs_common.newmail_notify_auto);
+ g_list_free(list);
+
+ inc_account_autocheck_timer_set_interval(account);
return FALSE;
}
+void inc_account_autocheck_timer_remove(PrefsAccount *account)
+{
+ cm_return_if_fail(account != NULL);
+
+ if (account->autocheck_timer != 0) {
+ debug_print("INC: account %d: removed inc timer %d\n", account->account_id,
+ account->autocheck_timer);
+ account->autocheck_timer = 0;
+ }
+}
+
+void inc_account_autocheck_timer_set_interval(PrefsAccount *account)
+{
+ cm_return_if_fail(account != NULL);
+
+ inc_account_autocheck_timer_remove(account);
+
+ if (account->autochk_use_default
+ || !account->autochk_use_custom
+ || account->autochk_itv == 0)
+ return;
+
+ account->autocheck_timer = g_timeout_add_seconds(
+ account->autochk_itv, inc_account_autocheck_func, account);
+ debug_print("INC: account %d: added inc timer %d at %u seconds\n",
+ account->account_id, account->autocheck_timer, account->autochk_itv);
+}
+
gboolean inc_offline_should_override(gboolean force_ask, const gchar *msg)
{
static time_t overridden_yes = 0;
diff --git a/src/inc.h b/src/inc.h
index 9073f90..0f91f9b 100644
--- a/src/inc.h
+++ b/src/inc.h
@@ -81,9 +81,25 @@ void inc_mail (MainWindow *mainwin,
gboolean notify);
gint inc_account_mail (MainWindow *mainwin,
PrefsAccount *account);
+
+/* This function just blindly checks all accounts in the passed
+ * account_list, and doesn't care about whether the configuration
+ * says they should be checked or not. These checks should be done
+ * by the caller, and account_list should look accordingly.
+ * The caller is responsible for freeing the list afterwards. */
+void inc_account_list_mail (MainWindow *mainwin,
+ GList *list, /* linked list of PrefsAccount* pointers */
+ gboolean autocheck,
+ gboolean notify);
+
+/* This function is used by the global autocheck interval (autocheck TRUE),
+ * or by the manual 'Receive all' feature (autocheck FALSE). It makes
+ * sure correct list of accounts is marked for checking, based on
+ * global and account configuration, and calls inc_account_list_mail(). */
void inc_all_account_mail (MainWindow *mainwin,
gboolean autocheck,
gboolean notify);
+
void inc_progress_update (Pop3Session *session);
void inc_pop_before_smtp (PrefsAccount *acc);
@@ -111,4 +127,7 @@ void inc_autocheck_timer_set (void);
void inc_autocheck_timer_remove (void);
gboolean inc_offline_should_override(gboolean force_ask, const gchar *msg);
+void inc_account_autocheck_timer_remove(PrefsAccount *account);
+void inc_account_autocheck_timer_set_interval(PrefsAccount *account);
+
#endif /* __INC_H__ */
diff --git a/src/prefs_account.c b/src/prefs_account.c
index 5c4104f..fd9a1b7 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -83,6 +83,12 @@ static GtkWidget *in_ssl_cert_browse_button;
static GtkWidget *out_ssl_cert_browse_button;
#endif
+struct AutocheckWidgets {
+ GtkWidget *autochk_hour_spinbtn;
+ GtkWidget *autochk_min_spinbtn;
+ GtkWidget *autochk_sec_spinbtn;
+};
+
static GSList *prefs_pages = NULL;
typedef struct BasicPage
@@ -141,6 +147,8 @@ typedef struct ReceivePage
GtkWidget *inbox_entry;
GtkWidget *inbox_btn;
+ GtkWidget *autochk_frame;
+
GtkWidget *local_frame;
GtkWidget *local_inbox_label;
GtkWidget *local_inbox_entry;
@@ -161,6 +169,10 @@ typedef struct ReceivePage
GtkWidget *maxarticle_label;
GtkWidget *maxarticle_spinbtn;
GtkAdjustment *maxarticle_spinbtn_adj;
+
+ GtkWidget *autochk_checkbtn;
+ GtkWidget *autochk_use_default_checkbtn;
+ struct AutocheckWidgets *autochk_widgets;
} ReceivePage;
typedef struct SendPage
@@ -373,6 +385,9 @@ static void prefs_account_smtp_auth_type_set_data_from_optmenu
(PrefParam *pparam);
static void prefs_account_smtp_auth_type_set_optmenu (PrefParam *pparam);
+static void prefs_account_set_autochk_interval_from_widgets(PrefParam *pparam);
+static void prefs_account_set_autochk_interval_to_widgets(PrefParam *pparam);
+
static void prefs_account_enum_set_data_from_radiobtn (PrefParam *pparam);
static void prefs_account_enum_set_radiobtn (PrefParam *pparam);
@@ -529,6 +544,22 @@ static PrefParam receive_param[] = {
&receive_page.low_bandwidth_checkbtn,
prefs_set_data_from_toggle, prefs_set_toggle},
+ {"autochk_use_default", "TRUE", &tmp_ac_prefs.autochk_use_default, P_BOOL,
+ &receive_page.autochk_use_default_checkbtn,
+ prefs_set_data_from_toggle, prefs_set_toggle},
+
+ {"autochk_use_custom", "FALSE", &tmp_ac_prefs.autochk_use_custom, P_BOOL,
+ &receive_page.autochk_checkbtn,
+ prefs_set_data_from_toggle, prefs_set_toggle},
+
+ /* Here we lie a bit, passing a pointer to our custom struct,
+ * disguised as a GtkWidget pointer, to get around the
+ * inflexibility of PrefParam system. */
+ {"autochk_interval", "600", &tmp_ac_prefs.autochk_itv, P_INT,
+ (GtkWidget **)&receive_page.autochk_widgets,
+ prefs_account_set_autochk_interval_from_widgets,
+ prefs_account_set_autochk_interval_to_widgets},
+
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
@@ -1472,9 +1503,9 @@ static void receive_create_widget_func(PrefsPage * _page,
ReceivePage *page = (ReceivePage *) _page;
PrefsAccount *ac_prefs = (PrefsAccount *) data;
- GtkWidget *vbox1;
+ GtkWidget *vbox1, *vbox2, *vbox3, *vbox4;
+ GtkWidget *hbox1, *hbox2;
GtkWidget *frame1;
- GtkWidget *vbox2;
GtkWidget *use_apop_checkbtn;
GtkWidget *rmmail_checkbtn;
GtkWidget *hbox_spc;
@@ -1482,13 +1513,11 @@ static void receive_create_widget_func(PrefsPage * _page,
GtkWidget *leave_time_spinbtn;
GtkWidget *leave_hour_label;
GtkWidget *leave_hour_spinbtn;
- GtkWidget *hbox1;
GtkWidget *size_limit_checkbtn;
GtkWidget *size_limit_spinbtn;
GtkWidget *label;
GtkWidget *filter_on_recv_checkbtn;
GtkWidget *filterhook_on_recv_checkbtn;
- GtkWidget *vbox3;
GtkWidget *inbox_label;
GtkWidget *inbox_entry;
GtkWidget *inbox_btn;
@@ -1503,14 +1532,20 @@ static void receive_create_widget_func(PrefsPage * _page,
GtkWidget *local_inbox_label;
GtkWidget *local_inbox_entry;
GtkWidget *local_inbox_btn;
+ GtkWidget *autochk_checkbtn;
+ GtkWidget *autochk_hour_spinbtn, *autochk_hour_label;
+ GtkWidget *autochk_min_spinbtn, *autochk_min_label;
+ GtkWidget *autochk_sec_spinbtn, *autochk_sec_label;
+ GtkWidget *autochk_use_default_checkbtn;
+ GtkObject *adj;
+ struct AutocheckWidgets *autochk_widgets;
GtkWidget *optmenu;
GtkListStore *menu;
GtkTreeIter iter;
GtkWidget *recvatgetall_checkbtn;
- GtkWidget *hbox2;
- GtkWidget *frame2;
+ GtkWidget *frame, *frame2;
GtkWidget *maxarticle_label;
GtkWidget *maxarticle_spinbtn;
GtkAdjustment *maxarticle_spinbtn_adj;
@@ -1722,6 +1757,54 @@ static void receive_create_widget_func(PrefsPage * _page,
gtk_widget_show (hbox1);
gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 4);
+ /* Auto-checking */
+ vbox4 = gtkut_get_options_frame(vbox1, &frame, _("Automatic checking"));
+
+ PACK_CHECK_BUTTON(vbox4, autochk_use_default_checkbtn,
+ _("Use global settings"));
+
+ hbox2 = gtk_hbox_new(FALSE, 8);
+ gtk_box_pack_start(GTK_BOX(vbox4), hbox2, FALSE, FALSE, 0);
+
+ PACK_CHECK_BUTTON(hbox2, autochk_checkbtn,
+ _("Check for new mail every"));
+
+ adj = gtk_adjustment_new(5, 0, 99, 1, 10, 0);
+ autochk_hour_spinbtn = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0);
+ gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(autochk_hour_spinbtn), TRUE);
+ gtk_box_pack_start(GTK_BOX(hbox2), autochk_hour_spinbtn, FALSE, FALSE, 0);
+ autochk_hour_label = gtk_label_new(_("hours"));
+ gtk_box_pack_start(GTK_BOX(hbox2), autochk_hour_label, FALSE, FALSE, 0);
+
+ adj = gtk_adjustment_new(5, 0, 99, 1, 10, 0);
+ autochk_min_spinbtn = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0);
+ gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(autochk_min_spinbtn), TRUE);
+ gtk_box_pack_start(GTK_BOX(hbox2), autochk_min_spinbtn, FALSE, FALSE, 0);
+ autochk_min_label = gtk_label_new(_("mins"));
+ gtk_box_pack_start(GTK_BOX(hbox2), autochk_min_label, FALSE, FALSE, 0);
+
+ adj = gtk_adjustment_new(5, 0, 99, 1, 10, 0);
+ autochk_sec_spinbtn = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0);
+ gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(autochk_sec_spinbtn), TRUE);
+ gtk_box_pack_start(GTK_BOX(hbox2), autochk_sec_spinbtn, FALSE, FALSE, 0);
+ autochk_sec_label = gtk_label_new(_("secs"));
+ gtk_box_pack_start(GTK_BOX(hbox2), autochk_sec_label, FALSE, FALSE, 0);
+
+ autochk_widgets = g_new0(struct AutocheckWidgets, 1);
+ autochk_widgets->autochk_hour_spinbtn = autochk_hour_spinbtn;
+ autochk_widgets->autochk_min_spinbtn = autochk_min_spinbtn;
+ autochk_widgets->autochk_sec_spinbtn = autochk_sec_spinbtn;
+
+ gtk_widget_show_all(vbox4);
+
+ SET_TOGGLE_SENSITIVITY_REVERSE(autochk_use_default_checkbtn, hbox2);
+ SET_TOGGLE_SENSITIVITY(autochk_checkbtn, autochk_hour_spinbtn);
+ SET_TOGGLE_SENSITIVITY(autochk_checkbtn, autochk_min_spinbtn);
+ SET_TOGGLE_SENSITIVITY(autochk_checkbtn, autochk_sec_spinbtn);
+ SET_TOGGLE_SENSITIVITY(autochk_checkbtn, autochk_hour_label);
+ SET_TOGGLE_SENSITIVITY(autochk_checkbtn, autochk_min_label);
+ SET_TOGGLE_SENSITIVITY(autochk_checkbtn, autochk_sec_label);
+
PACK_CHECK_BUTTON (vbox1, filter_on_recv_checkbtn,
_("Filter messages on receiving"));
@@ -1749,6 +1832,8 @@ static void receive_create_widget_func(PrefsPage * _page,
page->inbox_entry = inbox_entry;
page->inbox_btn = inbox_btn;
+ page->autochk_frame = frame;
+
page->imap_frame = imap_frame;
page->imap_auth_type_optmenu = optmenu;
@@ -1767,6 +1852,10 @@ static void receive_create_widget_func(PrefsPage * _page,
page->maxarticle_spinbtn = maxarticle_spinbtn;
page->maxarticle_spinbtn_adj = maxarticle_spinbtn_adj;
+ page->autochk_checkbtn = autochk_checkbtn;
+ page->autochk_widgets = autochk_widgets;
+ page->autochk_use_default_checkbtn = autochk_use_default_checkbtn;
+
tmp_ac_prefs = *ac_prefs;
if (new_account) {
@@ -3296,6 +3385,7 @@ static gint prefs_receive_apply(void)
}
prefs_set_data_from_dialog(receive_param);
+
return 0;
}
@@ -4002,6 +4092,12 @@ PrefsAccount *prefs_account_new_from_config(const gchar *label)
prefs_custom_header_read_config(ac_prefs);
+ /* Start the auto-check interval, if needed. */
+ if (!ac_prefs->autochk_use_default && ac_prefs->autochk_use_custom
+ && ac_prefs->autochk_itv > 0) {
+ inc_account_autocheck_timer_set_interval(ac_prefs);
+ }
+
return ac_prefs;
}
@@ -4158,6 +4254,9 @@ static void destroy_dialog(gpointer data)
*ac_prefs = tmp_ac_prefs;
if (update_fld_list)
folderview_rescan_tree(ac_prefs->folder, FALSE);
+
+ inc_account_autocheck_timer_set_interval(ac_prefs);
+
} else /* the customhdr_list may have changed, update it anyway */
ac_prefs->customhdr_list = (&tmp_ac_prefs)->customhdr_list;
@@ -4580,6 +4679,37 @@ static void prefs_account_smtp_auth_type_set_optmenu(PrefParam *pparam)
combobox_select_by_data(optmenu, type);
}
+static void prefs_account_set_autochk_interval_from_widgets(PrefParam *pparam)
+{
+ struct AutocheckWidgets *autochk_widgets =
+ (struct AutocheckWidgets *)*pparam->widget;
+
+ *(gint *)pparam->data =
+ (3600 * gtk_spin_button_get_value_as_int(
+ GTK_SPIN_BUTTON(autochk_widgets->autochk_hour_spinbtn)))
+ + (60 * gtk_spin_button_get_value_as_int(
+ GTK_SPIN_BUTTON(autochk_widgets->autochk_min_spinbtn)))
+ + gtk_spin_button_get_value_as_int(
+ GTK_SPIN_BUTTON(autochk_widgets->autochk_sec_spinbtn));
+}
+
+static void prefs_account_set_autochk_interval_to_widgets(PrefParam *pparam)
+{
+ gint val = *((gint *)pparam->data);
+ struct AutocheckWidgets *autochk_widgets =
+ (struct AutocheckWidgets *)*pparam->widget;
+
+ gtk_spin_button_set_value(
+ GTK_SPIN_BUTTON(autochk_widgets->autochk_hour_spinbtn),
+ val / 3600);
+ gtk_spin_button_set_value(
+ GTK_SPIN_BUTTON(autochk_widgets->autochk_min_spinbtn),
+ (val % 3600) / 60);
+ gtk_spin_button_set_value(
+ GTK_SPIN_BUTTON(autochk_widgets->autochk_sec_spinbtn),
+ (val % 3600) % 60);
+}
+
static void prefs_account_set_string_from_combobox(PrefParam *pparam)
{
GtkWidget *combobox;
@@ -4752,6 +4882,7 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
gtk_widget_hide(receive_page.pop3_frame);
gtk_widget_hide(receive_page.imap_frame);
gtk_widget_hide(receive_page.local_frame);
+ gtk_widget_show(receive_page.autochk_frame);
gtk_widget_show(receive_page.frame_maxarticle);
gtk_widget_set_sensitive(receive_page.filter_on_recv_checkbtn, TRUE);
prefs_account_filter_on_recv_toggled
@@ -4848,6 +4979,7 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
gtk_widget_hide(receive_page.pop3_frame);
gtk_widget_hide(receive_page.imap_frame);
gtk_widget_show(receive_page.local_frame);
+ gtk_widget_show(receive_page.autochk_frame);
gtk_widget_hide(receive_page.frame_maxarticle);
gtk_widget_set_sensitive(receive_page.filter_on_recv_checkbtn, TRUE);
prefs_account_filter_on_recv_toggled
@@ -4956,6 +5088,7 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
gtk_widget_hide(receive_page.pop3_frame);
gtk_widget_show(receive_page.imap_frame);
gtk_widget_hide(receive_page.local_frame);
+ gtk_widget_show(receive_page.autochk_frame);
gtk_widget_hide(receive_page.frame_maxarticle);
gtk_widget_set_sensitive(receive_page.filter_on_recv_checkbtn, TRUE);
prefs_account_filter_on_recv_toggled
@@ -5059,6 +5192,7 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
gtk_widget_hide(receive_page.pop3_frame);
gtk_widget_hide(receive_page.imap_frame);
gtk_widget_hide(receive_page.local_frame);
+ gtk_widget_hide(receive_page.autochk_frame);
gtk_widget_hide(receive_page.frame_maxarticle);
gtk_widget_set_sensitive(receive_page.filter_on_recv_checkbtn, FALSE);
prefs_account_filter_on_recv_toggled
@@ -5158,6 +5292,7 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
gtk_widget_show(receive_page.pop3_frame);
gtk_widget_hide(receive_page.imap_frame);
gtk_widget_hide(receive_page.local_frame);
+ gtk_widget_show(receive_page.autochk_frame);
gtk_widget_hide(receive_page.frame_maxarticle);
gtk_widget_set_sensitive(receive_page.filter_on_recv_checkbtn, TRUE);
prefs_account_filter_on_recv_toggled
diff --git a/src/prefs_account.h b/src/prefs_account.h
index e0844af..6c956cf 100644
--- a/src/prefs_account.h
+++ b/src/prefs_account.h
@@ -101,6 +101,10 @@ struct _PrefsAccount
gchar *inbox;
gchar *local_inbox;
gint max_articles;
+ gboolean autochk_use_default;
+ gboolean autochk_use_custom;
+ gint autochk_itv;
+ guint autocheck_timer;
gint imap_auth_type;
diff --git a/src/prefs_common.h b/src/prefs_common.h
index 95e3c64..d53db9a 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -35,7 +35,7 @@
#include "prefs_msg_colors.h"
#include "prefs_summary_open.h"
-#define CLAWS_CONFIG_VERSION 2
+#define CLAWS_CONFIG_VERSION 3
typedef struct _PrefsCommon PrefsCommon;
diff --git a/src/prefs_migration.c b/src/prefs_migration.c
index a7189d9..287d9e8 100644
--- a/src/prefs_migration.c
+++ b/src/prefs_migration.c
@@ -118,6 +118,30 @@ static void _update_config_account(PrefsAccount *ac_prefs, gint version)
break;
+ case 2:
+
+ /* Introducing per-account mail check intervals, and separating
+ * recv_at_getall from autocheck function.
+ *
+ * If recv_at_getall is TRUE, the account's autocheck will be
+ * enabled, following global autocheck interval.
+ *
+ * The account's own autocheck interval will be set to the
+ * same value as the global interval, but will not be used.
+ *
+ * recv_at_getall will remain enabled, but will only be used
+ * to determine whether or not to include this account for
+ * manual 'Get all' check. */
+ ac_prefs->autochk_itv = prefs_common_get_prefs()->autochk_itv;
+ ac_prefs->autochk_use_custom = FALSE;
+ if (ac_prefs->recv_at_getall) {
+ ac_prefs->autochk_use_default = TRUE;
+ } else {
+ ac_prefs->autochk_use_default = FALSE;
+ }
+
+ break;
+
default:
/* NOOP */
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list