diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-05-18 04:58:23 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-05-18 04:58:23 +0000 |
commit | 192f216fca62585bbd810655792a25393d612b06 (patch) | |
tree | 1c464ae4407321a5b22d8739ecc5276685b9d4bf /src/mainwindow.c | |
parent | dc556e29120702f70ebea1f8d3237a26527b04e2 (diff) |
cancel online mode switch if active sessions exist.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2881 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/mainwindow.c')
-rw-r--r-- | src/mainwindow.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c index 2eb2e6b0..185c42b9 100644 --- a/src/mainwindow.c +++ b/src/mainwindow.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2010 Hiroyuki Yamamoto + * Copyright (C) 1999-2011 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -3075,10 +3075,18 @@ static void online_switch_clicked(GtkWidget *widget, gpointer data) MainWindow *mainwin = (MainWindow *)data; GtkWidget *menuitem; + debug_print("Toggle online mode: %d -> %d\n", prefs_common.online_mode, + !prefs_common.online_mode); + menuitem = gtk_item_factory_get_item(mainwin->menu_factory, "/File/Work offline"); if (prefs_common.online_mode == TRUE) { + if (folder_remote_folder_active_session_exist()) { + debug_print("Active session exist. Cancelling online switch.\n"); + return; + } + prefs_common.online_mode = FALSE; gtk_widget_hide(mainwin->online_pixmap); gtk_widget_show(mainwin->offline_pixmap); @@ -3363,6 +3371,14 @@ static void print_cb(MainWindow *mainwin, guint action, GtkWidget *widget) static void toggle_offline_cb(MainWindow *mainwin, guint action, GtkWidget *widget) { + if (GTK_CHECK_MENU_ITEM(widget)->active && + folder_remote_folder_active_session_exist()) { + debug_print("Active session exist. Cancelling online switch.\n"); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), + FALSE); + return; + } + main_window_toggle_online (mainwin, !GTK_CHECK_MENU_ITEM(widget)->active); } |