static void toggle_expand_messageview_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
+static void toggle_work_offline_cb (MainWindow *mainwin,
+ guint action,
+ GtkWidget *widget);
static void separate_widget_cb (GtkCheckMenuItem *checkitem,
guint action,
GtkWidget *widget);
static void account_menu_cb (GtkMenuItem *menuitem,
gpointer data);
+static void online_switch_clicked(GtkButton *btn,
+ gpointer data);
+
static void manual_open_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
static void set_toolbar_style(MainWindow *mainwin);
-static void addr_gather_cb ( MainWindow *mainwin,
+static void addr_harvest_cb ( MainWindow *mainwin,
guint action,
GtkWidget *widget );
-static void addr_gather_msg_cb ( MainWindow *mainwin,
+static void addr_harvest_msg_cb ( MainWindow *mainwin,
guint action,
GtkWidget *widget );
{N_("/_File/_Import mbox file..."), NULL, import_mbox_cb, 0, NULL},
{N_("/_File/_Export to mbox file..."), NULL, export_mbox_cb, 0, NULL},
{N_("/_File/Empty _trash"), "<shift>D", empty_trash_cb, 0, NULL},
+ {N_("/_File/_Work offline"), "<control>W", toggle_work_offline_cb, 0, "<ToggleItem>"},
{N_("/_File/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_File/_Save as..."), "<control>S", save_as_cb, 0, NULL},
{N_("/_File/_Print..."), NULL, print_cb, 0, NULL},
{N_("/_Tools/_Address book..."), "<shift><control>A", addressbook_open_cb, 0, NULL},
{N_("/_Tools/Add sender to address boo_k"),
NULL, add_address_cb, 0, NULL},
- {N_("/_Tools/_Gather addresses"), NULL, NULL, 0, "<Branch>"},
- {N_("/_Tools/_Gather addresses/from _Folder..."), NULL, addr_gather_cb, 0, NULL},
- {N_("/_Tools/_Gather addresses/from _Messages..."), NULL, addr_gather_msg_cb, 0, NULL},
+ {N_("/_Tools/_Harvest addresses"), NULL, NULL, 0, "<Branch>"},
+ {N_("/_Tools/_Harvest addresses/from _Folder..."),
+ NULL, addr_harvest_cb, 0, NULL},
+ {N_("/_Tools/_Harvest addresses/from _Messages..."),
+ NULL, addr_harvest_msg_cb, 0, NULL},
{N_("/_Tools/---"), NULL, NULL, 0, "<Separator>"},
{N_("/_Tools/_Filter messages"), NULL, filter_cb, 0, NULL},
{N_("/_Tools/_Create filter rule"), NULL, NULL, 0, "<Branch>"},
{N_("/Forward message as _attachment"), "<shift>F", reply_cb, COMPOSE_FORWARD_AS_ATTACH, NULL}
};
-
MainWindow *main_window_create(SeparateType type)
{
MainWindow *mainwin;
GtkWidget *statuslabel;
GtkWidget *ac_button;
GtkWidget *ac_label;
+ GtkWidget *online_status;
+ GtkWidget *offline_status;
+ GtkWidget *online_switch;
+ GtkWidget *offline_switch;
FolderView *folderview;
SummaryView *summaryview;
GtkWidget *fwd_popup;
gint i;
+ static GdkGeometry geometry;
+
debug_print(_("Creating main window...\n"));
mainwin = g_new0(MainWindow, 1);
gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
gtk_window_set_wmclass(GTK_WINDOW(window), "main_window", "Sylpheed");
+
+ if (!geometry.min_height) {
+ geometry.min_width = 320;
+ geometry.min_height = 200;
+ }
+ gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
+ GDK_HINT_MIN_SIZE);
+
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(main_window_close_cb), mainwin);
MANAGE_WINDOW_SIGNALS_CONNECT(window);
gtk_widget_set_usize(progressbar, 120, 1);
gtk_box_pack_start(GTK_BOX(hbox_stat), progressbar, FALSE, FALSE, 0);
+ online_status = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_WORK_ONLINE);
+ offline_status = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_WORK_OFFLINE);
+ online_switch = gtk_button_new ();
+ offline_switch = gtk_button_new ();
+ gtk_container_add (GTK_CONTAINER(online_switch), online_status);
+ gtk_button_set_relief (GTK_BUTTON(online_switch), GTK_RELIEF_NONE);
+ gtk_signal_connect (GTK_OBJECT(online_switch), "clicked", (GtkSignalFunc)online_switch_clicked, mainwin);
+ gtk_box_pack_start (GTK_BOX(hbox_stat), online_switch, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER(offline_switch), offline_status);
+ gtk_button_set_relief (GTK_BUTTON(offline_switch), GTK_RELIEF_NONE);
+ gtk_signal_connect (GTK_OBJECT(offline_switch), "clicked", (GtkSignalFunc)online_switch_clicked, mainwin);
+ gtk_box_pack_start (GTK_BOX(hbox_stat), offline_switch, FALSE, FALSE, 0);
+
statuslabel = gtk_label_new("");
gtk_box_pack_start(GTK_BOX(hbox_stat), statuslabel, FALSE, FALSE, 0);
gtk_widget_show_all(hbox_stat);
+ gtk_widget_hide(offline_switch);
/* create views */
mainwin->folderview = folderview = folderview_create();
mainwin->summaryview = summaryview = summary_create();
mainwin->replyall_popup = replyall_popup;
mainwin->replysender_popup = replysender_popup;
mainwin->fwd_popup = fwd_popup;
+ mainwin->online_switch = online_switch;
+ mainwin->offline_switch = offline_switch;
/* set context IDs for status bar */
mainwin->mainwin_cid = gtk_statusbar_get_context_id
mainwin_list = g_list_append(mainwin_list, mainwin);
+ /* init work_offline */
+ if (prefs_common.work_offline)
+ online_switch_clicked (GTK_BUTTON(online_switch), mainwin);
+
return mainwin;
}
{"/File/Import mbox file..." , M_UNLOCKED},
{"/File/Export to mbox file...", M_UNLOCKED},
{"/File/Empty trash" , M_UNLOCKED},
+ {"/File/Work offline" , M_UNLOCKED},
{"/File/Save as...", M_SINGLE_TARGET_EXIST|M_UNLOCKED},
{"/File/Print..." , M_TARGET_EXIST|M_UNLOCKED},
/* {"/File/Close", M_UNLOCKED}, */
{"/Tools/Selective download..." , M_HAVE_ACCOUNT|M_UNLOCKED},
{"/Tools/Add sender to address book", M_SINGLE_TARGET_EXIST},
- {"/Tools/Gather addresses" , M_TARGET_EXIST|M_UNLOCKED},
+ {"/Tools/Harvest addresses" , M_UNLOCKED},
{"/Tools/Filter messages" , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
{"/Tools/Create filter rule" , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
{"/Tools/Execute" , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
messageview_toggle_view_real(mainwin->messageview);
}
-static void separate_widget_cb(GtkCheckMenuItem *checkitem, guint action, GtkWidget *widget)
+static void toggle_work_offline_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+ if (GTK_CHECK_MENU_ITEM(widget)->active) {
+ online_switch_clicked (GTK_BUTTON(mainwin->online_switch), mainwin);
+ } else {
+ online_switch_clicked (GTK_BUTTON(mainwin->offline_switch), mainwin);
+ }
+}
+static void online_switch_clicked (GtkButton *btn, gpointer data)
+{
+ MainWindow *mainwin;
+ GtkItemFactory *ifactory;
+ GtkCheckMenuItem *menuitem;
+
+ mainwin = (MainWindow *) data;
+
+ ifactory = gtk_item_factory_from_widget(mainwin->menubar);
+ menuitem = GTK_CHECK_MENU_ITEM (gtk_item_factory_get_widget(ifactory, "/File/Work offline"));
+
+ g_return_if_fail(mainwin != NULL);
+ g_return_if_fail(menuitem != NULL);
+
+ if (btn == GTK_BUTTON(mainwin->online_switch)) {
+ /* go offline */
+ gtk_widget_hide (mainwin->online_switch);
+ gtk_widget_show (mainwin->offline_switch);
+ menuitem->active = TRUE;
+ prefs_common.work_offline = TRUE;
+ inc_autocheck_timer_remove();
+ } else {
+ /*go online */
+ gtk_widget_hide (mainwin->offline_switch);
+ gtk_widget_show (mainwin->online_switch);
+ menuitem->active = FALSE;
+ prefs_common.work_offline = FALSE;
+ inc_autocheck_timer_set();
+ }
+}
+
+static void separate_widget_cb(GtkCheckMenuItem *checkitem, guint action, GtkWidget *widget)
{
MainWindow *mainwin;
SeparateType type;
{
GList *list;
+ if (prefs_common.work_offline)
+ if (alertpanel(_("Offline warning"),
+ _("You're working offline. Override?"),
+ _("Yes"), _("No"), NULL) != G_ALERTDEFAULT)
+ return;
+
for (list = folder_get_list(); list != NULL; list = list->next) {
Folder *folder = list->data;
}
/*
- * Gather addresses for selected folder.
+ * Harvest addresses for selected folder.
*/
-static void addr_gather_cb( MainWindow *mainwin,
+static void addr_harvest_cb( MainWindow *mainwin,
guint action,
GtkWidget *widget )
{
- addressbook_gather( mainwin->summaryview->folder_item, NULL );
+ addressbook_harvest( mainwin->summaryview->folder_item, FALSE, NULL );
}
/*
- * Gather addresses for selected messages in summary view.
+ * Harvest addresses for selected messages in summary view.
*/
-static void addr_gather_msg_cb( MainWindow *mainwin,
+static void addr_harvest_msg_cb( MainWindow *mainwin,
guint action,
GtkWidget *widget )
{
- summary_gather_address( mainwin->summaryview );
+ summary_harvest_address( mainwin->summaryview );
}
/*