[Commits] [SCM] claws branch, gtk3, updated. 3.16.0-255-g5b65a79

ticho at claws-mail.org ticho at claws-mail.org
Sat Jul 14 15:04:15 CEST 2018


The branch, gtk3 has been updated
       via  5b65a79cf66fdd70709a56751ab971ad772ad51c (commit)
       via  dc5aefbf950a8649501aa20480158bba5e703b0e (commit)
       via  4a18c3b9c05b639644f9f143264e7b8cb61d88f3 (commit)
       via  9f9b98a511e3c2492151647ba574a6a83beaa528 (commit)
       via  9b02796e690b8c8c511da05496e48751fcce1c88 (commit)
      from  9498ea6df433164b6e0e396cad2f3d1ef92628f3 (commit)

Summary of changes:
 src/account.c                                  |  134 +++++++--------
 src/gtk/gtkcmclist.c                           |    2 +-
 src/inc.c                                      |  208 ++++++++++++++++--------
 src/inc.h                                      |   19 +++
 src/plugins/archive/Makefile.am                |    8 +-
 src/plugins/notification/gtkhotkey/Makefile.am |   35 ++--
 src/plugins/pgpcore/Makefile.am                |   19 +--
 src/plugins/pgpinline/Makefile.am              |    6 +-
 src/plugins/pgpmime/Makefile.am                |    6 +-
 src/plugins/smime/Makefile.am                  |    6 +-
 src/plugins/tnef_parse/Makefile.am             |    3 -
 src/plugins/vcalendar/Makefile.am              |    5 +-
 src/prefs_account.c                            |  147 ++++++++++++++++-
 src/prefs_account.h                            |    4 +
 src/prefs_common.h                             |    2 +-
 src/prefs_migration.c                          |   24 +++
 16 files changed, 417 insertions(+), 211 deletions(-)


- Log -----------------------------------------------------------------
commit 5b65a79cf66fdd70709a56751ab971ad772ad51c
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 2672f73..f5f5f4e 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}
 };
 
@@ -1469,9 +1500,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;
@@ -1479,13 +1510,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;
@@ -1500,14 +1529,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;
+	GtkAdjustment *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;
@@ -1719,6 +1754,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"));
 
@@ -1746,6 +1829,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;
 
@@ -1764,6 +1849,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) {
@@ -3293,6 +3382,7 @@ static gint prefs_receive_apply(void)
 	}
 
 	prefs_set_data_from_dialog(receive_param);
+
 	return 0;
 }
 
@@ -3999,6 +4089,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;
 }
 
@@ -4155,6 +4251,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;
 
@@ -4577,6 +4676,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;
@@ -4749,6 +4879,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
@@ -4845,6 +4976,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
@@ -4953,6 +5085,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
@@ -5056,6 +5189,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
@@ -5155,6 +5289,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 */

commit dc5aefbf950a8649501aa20480158bba5e703b0e
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Jul 13 23:27:11 2018 +0200

    Added missing archiver_prefs.h to archive_la_SOURCES.

diff --git a/src/plugins/archive/Makefile.am b/src/plugins/archive/Makefile.am
index 7cc2bdc..ec5594f 100644
--- a/src/plugins/archive/Makefile.am
+++ b/src/plugins/archive/Makefile.am
@@ -15,7 +15,8 @@ archive_la_SOURCES = \
 		  archiver.c \
 		  archiver.h \
 		  archiver_gtk.c \
-		  archiver_prefs.c
+		  archiver_prefs.c \
+		  archiver_prefs.h
 
 archive_la_LDFLAGS = \
 		-avoid-version -module \

commit 4a18c3b9c05b639644f9f143264e7b8cb61d88f3
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Jul 13 18:40:40 2018 +0200

    Do not let plugins install their header files, unless necessary.
    
    The only plugin that needs to do that is pgpcore, as there
    could in theory exist an external plugin that depends on it,
    and uses symbols from it.

diff --git a/src/plugins/archive/Makefile.am b/src/plugins/archive/Makefile.am
index 26f1c8d..7cc2bdc 100644
--- a/src/plugins/archive/Makefile.am
+++ b/src/plugins/archive/Makefile.am
@@ -17,11 +17,6 @@ archive_la_SOURCES = \
 		  archiver_gtk.c \
 		  archiver_prefs.c
 
-archiveincludedir = $(includedir)/claws-mail/plugins/@PACKAGE@
-archiveinclude_HEADERS = \
-	archiver.h \
-	archiver_prefs.h
-
 archive_la_LDFLAGS = \
 		-avoid-version -module \
 		$(GTK_LIBS) \
diff --git a/src/plugins/notification/gtkhotkey/Makefile.am b/src/plugins/notification/gtkhotkey/Makefile.am
index 18f619a..96181d1 100644
--- a/src/plugins/notification/gtkhotkey/Makefile.am
+++ b/src/plugins/notification/gtkhotkey/Makefile.am
@@ -10,31 +10,18 @@ endif
 AUTOMAKE_OPTIONS = subdir-objects
 
 libcmnpgtkhotkey_la_SOURCES = \
-	gtk-hotkey-info.c \
-	gtk-hotkey-error.c \
-	gtk-hotkey-listener.c \
-	gtk-hotkey-marshal.c \
-	gtk-hotkey-x11-listener.c \
-	x11/tomboykeybinder.c \
-	x11/eggaccelerators.c \
-	gtk-hotkey-registry.c \
-	gtk-hotkey-key-file-registry.c \
-	gtk-hotkey-utils.c
+	gtk-hotkey-info.c gtk-hotkey-info.h \
+	gtk-hotkey-error.c gtk-hotkey-error.h \
+	gtk-hotkey-listener.c gtk-hotkey-listener.h \
+	gtk-hotkey-marshal.c gtk-hotkey-marshal.h \
+	gtk-hotkey-x11-listener.c gtk-hotkey-x11-listener.h \
+	x11/tomboykeybinder.c x11/tomboykeybinder.h \
+	x11/eggaccelerators.c x11/eggaccelerators.h \
+	gtk-hotkey-registry.c gtk-hotkey-registry.h \
+	gtk-hotkey-key-file-registry.c gtk-hotkey-key-file-registry.h \
+	gtk-hotkey-utils.c gtk-hotkey-utils.h \
+	gtkhotkey.h
 	
-cmnpgtkhotkeyincludedir = $(includedir)/claws-mail/plugins/@PACKAGE@/gtkhotkey
-cmnpgtkhotkeyinclude_HEADERS = \
-	gtk-hotkey-error.h \
-	gtkhotkey.h \
-	gtk-hotkey-info.h \
-	gtk-hotkey-key-file-registry.h \
-	gtk-hotkey-listener.h \
-	gtk-hotkey-registry.h \
-	gtk-hotkey-x11-listener.h \
-	gtk-hotkey-marshal.h \
-	x11/tomboykeybinder.h \
-	x11/eggaccelerators.h \
-	gtk-hotkey-utils.h
-
 libcmnpgtkhotkey_la_LIBADD = \
 	$(GTK_LIBS) \
 	$(CM_NP_HOTKEY_LIBS)
diff --git a/src/plugins/pgpcore/Makefile.am b/src/plugins/pgpcore/Makefile.am
index db67806..5eb32fb 100644
--- a/src/plugins/pgpcore/Makefile.am
+++ b/src/plugins/pgpcore/Makefile.am
@@ -59,24 +59,21 @@ plugin_LTLIBRARIES = pgpcore.la
 endif
 
 pgpcore_la_SOURCES = \
-	autocompletion.c \
-	passphrase.c \
+	autocompletion.c autocompletion.h \
+	passphrase.c passphrase.h \
 	plugin.c \
-	prefs_gpg.c \
-	select-keys.c \
-	sgpgme.c \
-	pgp_utils.c \
-	pgp_viewer.c
+	prefs_gpg.c prefs_gpg.h \
+	select-keys.c select-keys.h \
+	sgpgme.c sgpgme.h \
+	pgp_utils.c pgp_utils.h \
+	pgp_viewer.c pgp_viewer.h
 
 pluginincludedir = $(pkgincludedir)/plugins/pgpcore
 plugininclude_HEADERS = \
-	autocompletion.h \
 	passphrase.h \
 	prefs_gpg.h \
-	select-keys.h \
 	sgpgme.h \
-	pgp_utils.h \
-	pgp_viewer.h
+	pgp_utils.h
 
 pgpcore_la_LDFLAGS = \
 	$(plugin_res_ldflag) $(no_undefined) $(export_symbols) \
diff --git a/src/plugins/pgpinline/Makefile.am b/src/plugins/pgpinline/Makefile.am
index cd49aef..e4ea69c 100644
--- a/src/plugins/pgpinline/Makefile.am
+++ b/src/plugins/pgpinline/Makefile.am
@@ -66,11 +66,7 @@ endif
 
 pgpinline_la_SOURCES = \
 	plugin.c \
-	pgpinline.c
-
-pluginincludedir = $(pkgincludedir)/plugins/pgpinline
-plugininclude_HEADERS = \
-	pgpinline.h 
+	pgpinline.c pgpinline.h
 
 pgpinline_la_LDFLAGS = \
 	$(plugin_res_ldflag) $(no_undefined) $(export_symbols) \
diff --git a/src/plugins/pgpmime/Makefile.am b/src/plugins/pgpmime/Makefile.am
index f69cd83..952ce56 100644
--- a/src/plugins/pgpmime/Makefile.am
+++ b/src/plugins/pgpmime/Makefile.am
@@ -65,11 +65,7 @@ endif
 
 pgpmime_la_SOURCES = \
 	plugin.c \
-	pgpmime.c
-
-pluginincludedir = $(pkgincludedir)/plugins/pgpmime
-plugininclude_HEADERS = \
-	pgpmime.h 
+	pgpmime.c pgpmime.h
 
 pgpmime_la_LDFLAGS = \
 	$(plugin_res_ldflag) $(no_undefined) $(export_symbols) \
diff --git a/src/plugins/smime/Makefile.am b/src/plugins/smime/Makefile.am
index 85b1f58..c431c76 100644
--- a/src/plugins/smime/Makefile.am
+++ b/src/plugins/smime/Makefile.am
@@ -66,11 +66,7 @@ endif
 
 smime_la_SOURCES = \
 	plugin.c \
-	smime.c
-
-pluginincludedir = $(pkgincludedir)/plugins/smime
-plugininclude_HEADERS = \
-	smime.h 
+	smime.c smime.h
 
 smime_la_LDFLAGS = \
 	$(plugin_res_ldflag) $(no_undefined) $(export_symbols) \
diff --git a/src/plugins/tnef_parse/Makefile.am b/src/plugins/tnef_parse/Makefile.am
index b4b1e50..cf599ae 100644
--- a/src/plugins/tnef_parse/Makefile.am
+++ b/src/plugins/tnef_parse/Makefile.am
@@ -68,9 +68,6 @@ tnef_parse_la_DEPENDENCIES = $(plugin_deps)
 tnef_parse_la_LIBADD = $(plugin_ldadd) $(cygwin_export_lib) \
 	$(GTK_LIBS)
 
-noinst_HEADERS = \
-	tnef_dump.h
-
 IFLAGS = \
 	-I$(top_srcdir)/src \
 	-I$(top_srcdir)/src/common \
diff --git a/src/plugins/vcalendar/Makefile.am b/src/plugins/vcalendar/Makefile.am
index a44367e..c0381e7 100644
--- a/src/plugins/vcalendar/Makefile.am
+++ b/src/plugins/vcalendar/Makefile.am
@@ -60,6 +60,7 @@ endif
 
 vcalendar_la_SOURCES = \
 	plugin.c \
+	vcal_interface.h \
 	vcalendar.c vcalendar.h \
 	vcal_manager.c vcal_manager.h \
 	vcal_folder.c vcal_folder.h \
@@ -69,10 +70,6 @@ vcalendar_la_SOURCES = \
 	common-views.c common-views.h \
 	day-view.c month-view.c
 
-vcalendarincludedir = $(includedir)/claws-mail/plugins/vcalendar
-vcalendarinclude_HEADERS = \
-	vcal_interface.h
- 
 vcalendar_la_LDFLAGS = \
 	$(plugin_res_ldflag) $(no_undefined) $(export_symbols) \
 	-avoid-version -module \

commit 9f9b98a511e3c2492151647ba574a6a83beaa528
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Fri Jul 13 15:17:58 2018 +0200

    Fix a condition typo in gtk_cmclist_motion().

diff --git a/src/gtk/gtkcmclist.c b/src/gtk/gtkcmclist.c
index 07c80ab..b1fd3e8 100644
--- a/src/gtk/gtkcmclist.c
+++ b/src/gtk/gtkcmclist.c
@@ -5480,7 +5480,7 @@ gtk_cmclist_motion (GtkWidget      *widget,
 
   row = CLAMP (row, 0, clist->rows - 1);
 
-  if (button_actions & GTK_CMBUTTON_SELECTS &
+  if (button_actions & GTK_CMBUTTON_SELECTS &&
       !g_object_get_data (G_OBJECT (widget), "gtk-site-data"))
     {
       if (row == clist->focus_row)

commit 9b02796e690b8c8c511da05496e48751fcce1c88
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sun Jul 8 16:41:18 2018 +0200

    Get rid of account_list_view_add(), since it was just a useless middleman.
    
    The logic was pushed down to account_list_store_insert_account_item(),
    now we only need to pass PrefsAcount pointer to it.

diff --git a/src/account.c b/src/account.c
index af3383f..d06ce8c 100644
--- a/src/account.c
+++ b/src/account.c
@@ -58,7 +58,7 @@
 
 enum {
 	ACCOUNT_IS_DEFAULT,
-	ACCOUNT_ENABLE_GET_ALL,	
+	ACCOUNT_ENABLE_GET_ALL,
 	ACCOUNT_NAME,
 	ACCOUNT_PROTOCOL,
 	ACCOUNT_SERVER,
@@ -70,14 +70,13 @@ enum {
 typedef enum
 {
 	COL_DEFAULT	= 0,
-	COL_GETALL	= 1,
-	COL_NAME	= 2,
-	COL_PROTOCOL	= 3,
-	COL_SERVER	= 4
+	COL_GETALL,
+	COL_NAME,
+	COL_PROTOCOL,
+	COL_SERVER,
+	N_EDIT_ACCOUNT_COLS
 } EditAccountColumnPos;
 
-# define N_EDIT_ACCOUNT_COLS	5
-
 PrefsAccount *cur_account;
 
 static GList *account_list = NULL;
@@ -116,7 +115,6 @@ static gboolean account_key_pressed	(GtkWidget	*widget,
 static gboolean account_search_func_cb (GtkTreeModel *model, gint column, 
 						const gchar *key, GtkTreeIter *iter, 
 						gpointer search_data);
-static void account_list_view_add	(PrefsAccount	*ac_prefs);
 static void account_list_view_set	(void);
 
 static void account_list_set		(void);
@@ -129,12 +127,7 @@ typedef struct FindAccountInStore {
 
 static GtkListStore* account_create_data_store	(void);
 
-static void account_list_view_insert_account_item (GtkListStore	*list_store, 
-						   const gchar	*account_name,
-						   const gchar	*protocol, 
-						   const gchar	*server_name,
-						   gboolean	 is_default, 
-						   gboolean	 is_get_all,
+static void account_list_store_insert_account_item (GtkListStore	*list_store,
 						   PrefsAccount *account_data);
 
 static GtkWidget *account_list_view_create	(void);
@@ -162,7 +155,11 @@ static gboolean find_account_in_store		(GtkTreeModel *model,
 static void account_get_all_toggled		(GtkCellRendererToggle	*widget, 
 						 gchar			*path, 
 						 GtkWidget		*list_view);
-						 
+
+static void account_autocheck_toggled		(GtkCellRendererToggle	*widget,
+						 gchar			*path,
+						 GtkWidget		*list_view);
+
 static void account_double_clicked		(GtkTreeView		*list_view,
 						 GtkTreePath		*path,
 						 GtkTreeViewColumn	*column,
@@ -1326,55 +1323,6 @@ static gboolean account_search_func_cb (GtkTreeModel *model, gint column, const
 
 	return retval;
 }
-static void account_list_view_add(PrefsAccount *ac_prefs)
-{
-	GtkTreeView *list_view = GTK_TREE_VIEW(edit_account.list_view);
-	GtkListStore *list_store = GTK_LIST_STORE(gtk_tree_view_get_model(list_view));
-	gchar *name, *protocol, *server;
-	gboolean has_getallbox;
-	gboolean getall;
-
-	name = ac_prefs->account_name;
-#ifdef USE_GNUTLS
-	protocol = ac_prefs->protocol == A_POP3 ?
-		  (ac_prefs->ssl_pop == SSL_TUNNEL ?
-		   "POP (SSL/TLS)" :
-		   ac_prefs->ssl_pop == SSL_STARTTLS ?
-		   "POP (STARTTLS)" : "POP") :
-		   ac_prefs->protocol == A_IMAP4 ?
-		  (ac_prefs->ssl_imap == SSL_TUNNEL ?
-		   "IMAP (SSL/TLS)" :
-		   ac_prefs->ssl_imap == SSL_STARTTLS ?
-		   "IMAP (STARTTLS)" : "IMAP") :
-		   ac_prefs->protocol == A_NNTP ?
-		  (ac_prefs->ssl_nntp == SSL_TUNNEL ?
-		   "NNTP (SSL/TLS)" : "NNTP") :
-		   ac_prefs->protocol == A_LOCAL ? "Local" :
-		   ac_prefs->protocol == A_NONE ?  "SMTP" : "-";
-#else
-	protocol = ac_prefs->protocol == A_POP3  ? "POP" :
-		   ac_prefs->protocol == A_IMAP4 ? "IMAP" :
-		   ac_prefs->protocol == A_LOCAL ? "Local" :
-		   ac_prefs->protocol == A_NNTP  ? "NNTP" :
-		   ac_prefs->protocol == A_NONE ?  "SMTP" : "-";
-#endif
-	server= ac_prefs->protocol == A_NNTP ? ac_prefs->nntp_server :
-		   ac_prefs->protocol == A_LOCAL ?  "-" :
-		   ac_prefs->protocol == A_NONE ? ac_prefs->smtp_server :
-		   ac_prefs->recv_server;
-
-	has_getallbox = (ac_prefs->protocol == A_POP3  ||
-			 ac_prefs->protocol == A_IMAP4 ||
-			 ac_prefs->protocol == A_NNTP  ||
-			 ac_prefs->protocol == A_LOCAL);
-	getall = has_getallbox && ac_prefs->recv_at_getall;
-
-	account_list_view_insert_account_item(list_store,
-					     name, protocol, server,
-					     ac_prefs->is_default,
-					     getall, ac_prefs);
-	return;
-}
 
 static void account_list_view_set(void)
 {
@@ -1391,7 +1339,7 @@ static void account_list_view_set(void)
 	gtk_list_store_clear(store);
 	
 	for (cur = account_list; cur != NULL; cur = cur->next) {
-		account_list_view_add((PrefsAccount *)cur->data);
+		account_list_store_insert_account_item(store, (PrefsAccount *)cur->data);
 		if ((PrefsAccount *)cur->data == cur_account)
 			account_list_view_select_account
 				(edit_account.list_view, 
@@ -1534,24 +1482,54 @@ static GtkListStore* account_create_data_store(void)
  *\return	GtkTreeRowReference * A tree row reference, which is guaranteed to 
  *		stable whatever operations are performed on the list.
  */
-static void account_list_view_insert_account_item(GtkListStore *list_store, 
-						  const gchar *account_name,
-						  const gchar *protocol, 
-						  const gchar *server_name,
-						  gboolean is_default, 
-						  gboolean is_get_all,
-						  PrefsAccount *account_data)
+static void account_list_store_insert_account_item(GtkListStore *list_store,
+						  PrefsAccount *ac_prefs)
 {
 	GtkTreeIter iter;
+	gboolean is_get_all = (ac_prefs->protocol == A_POP3 ||
+			ac_prefs->protocol == A_IMAP4 ||
+			ac_prefs->protocol == A_NNTP  ||
+			ac_prefs->protocol == A_LOCAL) &&
+		ac_prefs->recv_at_getall;
+	gchar *protocol, *server;
 	
+#ifdef USE_GNUTLS
+	protocol = ac_prefs->protocol == A_POP3 ?
+		  (ac_prefs->ssl_pop == SSL_TUNNEL ?
+		   "POP (SSL/TLS)" :
+		   ac_prefs->ssl_pop == SSL_STARTTLS ?
+		   "POP (STARTTLS)" : "POP") :
+		   ac_prefs->protocol == A_IMAP4 ?
+		  (ac_prefs->ssl_imap == SSL_TUNNEL ?
+		   "IMAP (SSL/TLS)" :
+		   ac_prefs->ssl_imap == SSL_STARTTLS ?
+		   "IMAP (STARTTLS)" : "IMAP") :
+		   ac_prefs->protocol == A_NNTP ?
+		  (ac_prefs->ssl_nntp == SSL_TUNNEL ?
+		   "NNTP (SSL/TLS)" : "NNTP") :
+		   ac_prefs->protocol == A_LOCAL ? "Local" :
+		   ac_prefs->protocol == A_NONE ?  "SMTP" : "-";
+#else
+	protocol = ac_prefs->protocol == A_POP3  ? "POP" :
+		   ac_prefs->protocol == A_IMAP4 ? "IMAP" :
+		   ac_prefs->protocol == A_LOCAL ? "Local" :
+		   ac_prefs->protocol == A_NNTP  ? "NNTP" :
+		   ac_prefs->protocol == A_NONE ?  "SMTP" : "-";
+#endif
+
+	server= ac_prefs->protocol == A_NNTP ? ac_prefs->nntp_server :
+		   ac_prefs->protocol == A_LOCAL ?  "-" :
+		   ac_prefs->protocol == A_NONE ? ac_prefs->smtp_server :
+		   ac_prefs->recv_server;
+
 	gtk_list_store_append(list_store, &iter);
 	gtk_list_store_set(list_store, &iter, 
-			   ACCOUNT_IS_DEFAULT,     is_default ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
+			   ACCOUNT_IS_DEFAULT,     ac_prefs->is_default ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
 			   ACCOUNT_ENABLE_GET_ALL, is_get_all,
-			   ACCOUNT_NAME,	   account_name,
+			   ACCOUNT_NAME,	   ac_prefs->account_name,
 			   ACCOUNT_PROTOCOL,	   protocol,
-			   ACCOUNT_SERVER,	   server_name,
-			   ACCOUNT_DATA,	   account_data,
+			   ACCOUNT_SERVER,	   server,
+			   ACCOUNT_DATA,	   ac_prefs,
 			   -1);
 }
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list