commit - 94256ab3acb0cd7270b6545b89d7bf4970d440ff
commit + 246f99d92348714ff096669610916a82b493003b
blob - 77b262c5dd23bf30dd08293dd7caa37851906776
blob + a7c869026a6666c82ab8a9c55a7f50e720ff43a9
--- src/inc.c
+++ src/inc.c
PrefsAccount *account);
static gint inc_spool_account(PrefsAccount *account);
-static void inc_autocheck_timer_set_interval (guint interval);
-static gint inc_autocheck_func (gpointer data);
static void inc_notify_cmd(gint new_msgs, gboolean notify);
return;
inc_lock();
- inc_autocheck_timer_remove();
main_window_lock(mainwin);
if (prefs_common.use_extinc && prefs_common.extinc_cmd) {
/* external incorporating program */
if (execute_command_line(prefs_common.extinc_cmd, FALSE, NULL) < 0) {
main_window_unlock(mainwin);
- inc_autocheck_timer_set();
inc_unlock();
return;
}
statusbar_progress_all(0,0,0);
main_window_unlock(mainwin);
inc_notify_cmd(new_msgs, notify);
- inc_autocheck_timer_set();
inc_unlock();
}
"to get mails.")))
return 0;
- inc_autocheck_timer_remove();
main_window_lock(mainwin);
new_msgs = inc_account_mail_real(mainwin, account);
statusbar_progress_all(0,0,0);
main_window_unlock(mainwin);
- inc_autocheck_timer_set();
return new_msgs;
}
inc_notify_cmd(new_msgs, notify);
}
-void inc_all_account_mail(MainWindow *mainwin, gboolean autocheck,
- gboolean check_at_startup, gboolean notify)
+void inc_all_account_mail(MainWindow *mainwin, gboolean notify)
{
GList *list, *list2 = NULL;
gboolean condition = FALSE;
- gboolean hide_dialog = FALSE;
- 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 check at startup or a manual 'Get all' check. */
- if (autocheck)
- condition = prefs_common_get_prefs()->autochk_newmail;
- else if (check_at_startup || (!check_at_startup && !autocheck))
- condition = account->recv_at_getall;
-
- if (condition) {
- debug_print("INC: will check account %d\n", account->account_id);
- list2 = g_list_append(list2, account);
- }
+ list2 = g_list_append(list2, account);
}
/* Do the check on the collected accounts. */
if (list2 != NULL) {
- if (autocheck || check_at_startup)
- hide_dialog = TRUE;
+ gboolean hide_dialog = TRUE;
inc_account_list_mail(mainwin, list2, hide_dialog, notify);
g_list_free(list2);
}
g_free(buf);
}
-void inc_autocheck_timer_init(MainWindow *mainwin)
-{
- autocheck_data = mainwin;
- inc_autocheck_timer_set();
-}
-
-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) {
- 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);
- }
-}
-
-void inc_autocheck_timer_set(void)
-{
- inc_autocheck_timer_set_interval(prefs_common.autochk_itv * 1000);
-}
-
-void inc_autocheck_timer_remove(void)
-{
- if (autocheck_timer) {
- debug_print("removed global inc timer %d\n", autocheck_timer);
- g_source_remove(autocheck_timer);
- autocheck_timer = 0;
- }
-}
-
-static gint inc_autocheck_func(gpointer data)
-{
- MainWindow *mainwin = (MainWindow *)data;
-
- if (inc_lock_count) {
- debug_print("global inc: autocheck is locked.\n");
- inc_autocheck_timer_set_interval(1000);
- return FALSE;
- }
-
- inc_all_account_mail(mainwin, TRUE, FALSE, prefs_common.newmail_notify_auto);
- inc_autocheck_timer_set();
-
- return FALSE;
-}
-
gboolean inc_offline_should_override(gboolean force_ask, const gchar *msg)
{
gint length = 10; /* seconds */
gint answer = G_ALERTDEFAULT;
- if (prefs_common.autochk_newmail)
- length = prefs_common.autochk_itv; /* seconds */
-
if (force_ask) {
inc_offline_overridden_no = (time_t)0;
}
blob - 3343b81ceae53e9a4be90f378ae6a40299c5f690
blob + 6b5ad1c2954cca96eb95a4d089bc5cbec69f5790
--- src/inc.h
+++ src/inc.h
gboolean autocheck,
gboolean notify);
-/* This function is used by the global autocheck interval (autocheck TRUE),
- * or check at startup (check_at_startup 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 check_at_startup,
- gboolean notify);
+/* Starts mail incorporations for all accounts. */
+void inc_all_account_mail (MainWindow *mainwin, gboolean notify);
void inc_progress_update (Pop3Session *session);
void inc_lock_real (void);
void inc_unlock_real (void);
-void inc_autocheck_timer_init (MainWindow *mainwin);
-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);
-
void inc_reset_offline_override_timers();
#endif /* __INC_H__ */
blob - e42b91949ee4c28747de64da07fe079fa2d7e56a
blob + 950fd90232125bb635d5095dece6d78d0998b856
--- src/main.c
+++ src/main.c
static gboolean defer_check_all(void *data)
{
- gboolean autochk = GPOINTER_TO_INT(data);
-
if (!sc_starting) {
- inc_all_account_mail(static_mainwindow, autochk, FALSE,
- prefs_common.newmail_notify_manu);
-
+ inc_all_account_mail(static_mainwindow, prefs_common.newmail_notify_manu);
} else {
- inc_all_account_mail(static_mainwindow, FALSE,
- prefs_common.chk_on_startup,
- prefs_common.newmail_notify_manu);
+ inc_all_account_mail(static_mainwindow, prefs_common.newmail_notify_manu);
sc_starting = FALSE;
main_window_set_menu_sensitive(static_mainwindow);
toolbar_main_set_sensitive(static_mainwindow);
{
if (cmd.receive_all) {
defer_check_all(GINT_TO_POINTER(FALSE));
- } else if (prefs_common.chk_on_startup) {
- defer_check_all(GINT_TO_POINTER(TRUE));
} else if (cmd.receive) {
defer_check(NULL);
}
MainWindow *mainwin;
FolderView *folderview;
GdkPixbuf *icon;
- guint num_folder_class = 0;
gboolean start_done = TRUE;
gboolean never_ran = FALSE;
gint ret;
main_window_cursor_wait(mainwin);
folder_func_to_all_folders(initial_processing, (gpointer *)mainwin);
- inc_autocheck_timer_init(mainwin);
if (cmd.online_mode == ONLINE_MODE_OFFLINE) {
main_window_toggle_work_offline(mainwin, TRUE, FALSE);
}
prefs_toolbar_init();
- num_folder_class = g_list_length(folder_get_list());
-
if (never_ran) {
prefs_common_write_config();
}
if (cmd.receive_all && !cmd.target) {
start_done = FALSE;
g_timeout_add(1000, defer_check_all, GINT_TO_POINTER(FALSE));
- } else if (prefs_common.chk_on_startup && !cmd.target) {
- start_done = FALSE;
- g_timeout_add(1000, defer_check_all, GINT_TO_POINTER(TRUE));
} else if (cmd.receive && !cmd.target) {
start_done = FALSE;
g_timeout_add(1000, defer_check, NULL);
sc_exiting = TRUE;
debug_print("shutting down\n");
- inc_autocheck_timer_remove();
/* save prefs for opened folder */
if((item = folderview_get_opened_item(mainwin->folderview)) != NULL) {
CM_FD_WRITE_ALL(display_name);
#endif
} else if (!STRNCMP(buf, "receive_all")) {
- inc_all_account_mail(mainwin, FALSE, FALSE,
- prefs_common.newmail_notify_manu);
+ inc_all_account_mail(mainwin, prefs_common.newmail_notify_manu);
} else if (!STRNCMP(buf, "receive")) {
inc_mail(mainwin, prefs_common.newmail_notify_manu);
} else if (!STRNCMP(buf, "cancel_receiving")) {
blob - 5639443688ea8df5dd15caa6a711c86f8ee0ac30
blob + e940a9380e5e0b14fa6fce17de795d508d893680
--- src/mainwindow.c
+++ src/mainwindow.c
gtk_widget_show (mainwin->offline_switch);
cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/File/OfflineMode", TRUE);
- inc_autocheck_timer_remove();
-
/* go offline */
if (prefs_common.work_offline)
return;
gtk_widget_show (mainwin->online_switch);
cm_toggle_menu_set_active_full(mainwin->ui_manager, "Menu/File/OfflineMode", FALSE);
prefs_common.work_offline = FALSE;
- inc_autocheck_timer_set();
hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
}
}
blob - d108fc31c16f4d0f6b4f5f3cd499dab022936acc
blob + 341b8d4745379897a64537d53dbc32680ddd06ad
--- src/prefs_common.c
+++ src/prefs_common.c
{"ext_inc_path", "/usr/bin/mh/inc", &prefs_common.extinc_cmd, P_STRING,
NULL, NULL, NULL},
- {"autochk_newmail", "FALSE", &prefs_common.autochk_newmail, P_BOOL,
- NULL, NULL, NULL},
- {"autochk_interval", "600", &prefs_common.autochk_itv, P_INT,
- NULL, NULL, NULL},
- {"check_on_startup", "FALSE", &prefs_common.chk_on_startup, P_BOOL,
- NULL, NULL, NULL},
{"newmail_notify_manu", "FALSE", &prefs_common.newmail_notify_manu,
P_BOOL, NULL, NULL, NULL},
{"newmail_notify_auto", "FALSE", &prefs_common.newmail_notify_auto,
blob - 592f1c65dab88235402d0f6d8bfe163ead5f5ab6
blob + 1dbecece7b4e8d0d68633e0721739a31847270d1
--- src/prefs_common.h
+++ src/prefs_common.h
/* Receive */
gboolean use_extinc;
gchar *extinc_cmd;
- gboolean autochk_newmail;
- gint autochk_itv;
- gboolean chk_on_startup;
gboolean newmail_notify_auto;
gboolean newmail_notify_manu;
gchar *newmail_notify_cmd;
blob - eff9d9b58fed50ae6502c32041d5a276d8f65dc0
blob + 1e8e9adcf016cc9c4bd898d79c75cd8c20fc143e
--- src/prefs_receive.c
+++ src/prefs_receive.c
GtkWidget *checkbtn_incext;
GtkWidget *entry_incext;
- GtkWidget *checkbtn_autochk;
- GtkWidget *spinbtn_autochk_sec;
- GtkWidget *spinbtn_autochk_min;
- GtkWidget *spinbtn_autochk_hour;
- GtkWidget *checkbtn_chkonstartup;
GtkWidget *checkbtn_newmail_auto;
GtkWidget *checkbtn_newmail_manu;
GtkWidget *entry_newmail_notify_cmd;
gtk_widget_set_sensitive(prefs_receive->hbox_newmail_notify, toggled);
}
-static void prefs_receive_itv_spinbutton_value_changed_cb(GtkWidget *w, gpointer data)
-{
- ReceivePage *page = (ReceivePage *)data;
- gint seconds = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (page->spinbtn_autochk_sec));
- gint minutes = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON (page->spinbtn_autochk_min));
- gint hours = gtk_spin_button_get_value_as_int (
- GTK_SPIN_BUTTON(page->spinbtn_autochk_hour));
- if (seconds < PREFS_RECV_AUTOCHECK_MIN_INTERVAL && minutes == 0 && hours == 0) {
- gtk_spin_button_set_value (
- GTK_SPIN_BUTTON (page->spinbtn_autochk_sec),
- PREFS_RECV_AUTOCHECK_MIN_INTERVAL);
- }
-}
-
static void prefs_receive_create_widget(PrefsPage *_page, GtkWindow *window,
gpointer data)
{
GtkWidget *label_incext;
GtkWidget *entry_incext;
- GtkWidget *hbox_autochk;
- GtkWidget *checkbtn_autochk;
- GtkAdjustment *spinbtn_autochk_adj;
- GtkWidget *spinbtn_autochk_sec;
- GtkWidget *spinbtn_autochk_min;
- GtkWidget *spinbtn_autochk_hour;
- GtkWidget *label_autochk2;
- GtkWidget *label_autochk1;
- GtkWidget *label_autochk0;
- GtkWidget *checkbtn_chkonstartup;
-
GtkWidget *frame;
GtkWidget *vbox3;
GtkWidget *hbox_newmail_notify;
gtk_widget_show (entry_incext);
gtk_box_pack_start (GTK_BOX (hbox), entry_incext, TRUE, TRUE, 0);
- /* Auto-checking */
- vbox2 = gtkut_get_options_frame(vbox1, &frame, _("Automatic checking"));
-
- hbox_autochk = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
- gtk_widget_show (hbox_autochk);
- gtk_box_pack_start (GTK_BOX (vbox2), hbox_autochk, FALSE, FALSE, 0);
-
- PACK_CHECK_BUTTON (hbox_autochk, checkbtn_autochk,
- _("Check for new mail every"));
-
- spinbtn_autochk_adj = GTK_ADJUSTMENT(gtk_adjustment_new (5, 0, 99, 1, 10, 0));
- spinbtn_autochk_hour = gtk_spin_button_new
- (GTK_ADJUSTMENT (spinbtn_autochk_adj), 1, 0);
-
- gtk_widget_show (spinbtn_autochk_hour);
- gtk_box_pack_start (GTK_BOX (hbox_autochk), spinbtn_autochk_hour, FALSE, FALSE, 0);
-
- label_autochk0 = gtk_label_new (_("hours"));
- gtk_widget_show (label_autochk0);
- gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk0, FALSE, FALSE, 0);
-
- spinbtn_autochk_adj = GTK_ADJUSTMENT(gtk_adjustment_new (5, 0, 59, 1, 10, 0));
- spinbtn_autochk_min = gtk_spin_button_new
- (GTK_ADJUSTMENT (spinbtn_autochk_adj), 1, 0);
- gtk_widget_show (spinbtn_autochk_min);
- gtk_box_pack_start (GTK_BOX (hbox_autochk), spinbtn_autochk_min, FALSE, FALSE, 0);
-
- label_autochk1 = gtk_label_new (_("minutes"));
- gtk_widget_show (label_autochk1);
- gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk1, FALSE, FALSE, 0);
-
- spinbtn_autochk_adj = GTK_ADJUSTMENT(gtk_adjustment_new (5, 0, 59, 1, 10, 0));
- spinbtn_autochk_sec = gtk_spin_button_new
- (GTK_ADJUSTMENT (spinbtn_autochk_adj), 1, 0);
- gtk_widget_show (spinbtn_autochk_sec);
- gtk_box_pack_start (GTK_BOX (hbox_autochk), spinbtn_autochk_sec, FALSE, FALSE, 0);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_autochk_sec), TRUE);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_autochk_min), TRUE);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_autochk_hour), TRUE);
-
- label_autochk2 = gtk_label_new (_("seconds"));
- gtk_widget_show (label_autochk2);
- gtk_box_pack_start (GTK_BOX (hbox_autochk), label_autochk2, FALSE, FALSE, 0);
-
- SET_TOGGLE_SENSITIVITY(checkbtn_autochk, spinbtn_autochk_sec);
- SET_TOGGLE_SENSITIVITY(checkbtn_autochk, spinbtn_autochk_min);
- SET_TOGGLE_SENSITIVITY(checkbtn_autochk, spinbtn_autochk_hour);
- SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk0);
- SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk1);
- SET_TOGGLE_SENSITIVITY(checkbtn_autochk, label_autochk2);
-
- PACK_CHECK_BUTTON (vbox2, checkbtn_chkonstartup,
- _("Check for new mail on start-up"));
-
/* receive dialog */
vbox2 = gtkut_get_options_frame(vbox1, &frame, _("Dialogs"));
prefs_common.newmail_notify_manu);
gtk_entry_set_text(GTK_ENTRY(entry_newmail_notify_cmd),
prefs_common.newmail_notify_cmd);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_autochk),
- prefs_common.autochk_newmail);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_incext),
prefs_common.use_extinc);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_show_recv_err_dialog),
prefs_common.show_recv_err_dialog);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_close_recv_dialog),
prefs_common.close_recv_dialog);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_chkonstartup),
- prefs_common.chk_on_startup);
gtk_entry_set_text(GTK_ENTRY(entry_incext),
prefs_common.extinc_cmd);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_autochk_hour),
- prefs_common.autochk_itv / 3600);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_autochk_min),
- (prefs_common.autochk_itv % 3600) / 60);
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinbtn_autochk_sec),
- (prefs_common.autochk_itv % 3600) % 60);
combobox_select_by_data(GTK_COMBO_BOX(optmenu_recvdialog),
prefs_common.recv_dialog_mode);
prefs_receive->window = GTK_WIDGET(window);
prefs_receive->checkbtn_incext = checkbtn_incext;
prefs_receive->entry_incext = entry_incext;
- prefs_receive->checkbtn_autochk = checkbtn_autochk;
- prefs_receive->spinbtn_autochk_sec = spinbtn_autochk_sec;
- prefs_receive->spinbtn_autochk_min = spinbtn_autochk_min;
- prefs_receive->spinbtn_autochk_hour = spinbtn_autochk_hour;
- prefs_receive->checkbtn_chkonstartup = checkbtn_chkonstartup;
prefs_receive->checkbtn_newmail_auto = checkbtn_newmail_auto;
prefs_receive->checkbtn_newmail_manu = checkbtn_newmail_manu;
prefs_receive->entry_newmail_notify_cmd = entry_newmail_notify_cmd;
g_signal_connect(G_OBJECT(checkbtn_newmail_manu), "toggled",
G_CALLBACK(prefs_common_recv_dialog_newmail_notify_toggle_cb),
NULL);
- g_signal_connect(G_OBJECT(spinbtn_autochk_hour), "value-changed",
- G_CALLBACK(prefs_receive_itv_spinbutton_value_changed_cb),
- (gpointer) prefs_receive);
- g_signal_connect(G_OBJECT(spinbtn_autochk_min), "value-changed",
- G_CALLBACK(prefs_receive_itv_spinbutton_value_changed_cb),
- (gpointer) prefs_receive);
- g_signal_connect(G_OBJECT(spinbtn_autochk_sec), "value-changed",
- G_CALLBACK(prefs_receive_itv_spinbutton_value_changed_cb),
- (gpointer) prefs_receive);
}
static void prefs_receive_save(PrefsPage *_page)
GTK_TOGGLE_BUTTON(page->checkbtn_show_recv_err_dialog));
prefs_common.close_recv_dialog = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(page->checkbtn_close_recv_dialog));
- prefs_common.chk_on_startup = gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON(page->checkbtn_chkonstartup));
prefs_common.newmail_notify_auto = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(page->checkbtn_newmail_auto));
prefs_common.newmail_notify_manu = gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(page->checkbtn_newmail_manu));
- prefs_common.autochk_newmail = gtk_toggle_button_get_active(
- GTK_TOGGLE_BUTTON(page->checkbtn_autochk));
- prefs_common.autochk_itv =
- (3600 * gtk_spin_button_get_value_as_int(
- GTK_SPIN_BUTTON(page->spinbtn_autochk_hour)))
- + (60 * gtk_spin_button_get_value_as_int(
- GTK_SPIN_BUTTON(page->spinbtn_autochk_min)))
- + gtk_spin_button_get_value_as_int(
- GTK_SPIN_BUTTON(page->spinbtn_autochk_sec));
tmp = gtk_editable_get_chars(GTK_EDITABLE(page->entry_incext), 0, -1);
g_free(prefs_common.extinc_cmd);
prefs_common.newmail_notify_cmd = tmp;
prefs_common.recv_dialog_mode =
combobox_get_active_data(GTK_COMBO_BOX(page->optmenu_recvdialog));
-
- inc_autocheck_timer_remove();
- inc_autocheck_timer_set();
-
}
-static void prefs_receive_destroy_widget(PrefsPage *_page)
-{
-}
+static void prefs_receive_destroy_widget(PrefsPage *_page) {}
void prefs_receive_init(void)
{
blob - 2178b3267aa30592c424a826b7a57dec78f9adfe
blob + 81d812da20c528ad5a0b642d33f4edad9d8fbca9
--- src/toolbar.c
+++ src/toolbar.c
void inc_all_account_mail_cb(gpointer data, guint action, GtkWidget *widget)
{
MainWindow *mainwin = (MainWindow*)data;
-
- inc_all_account_mail(mainwin, FALSE, FALSE, prefs_common.newmail_notify_manu);
+ inc_all_account_mail(mainwin, prefs_common.newmail_notify_manu);
}
void send_queue_cb(gpointer data, guint action, GtkWidget *widget)