#include "pluginwindow.h"
#include "hooks.h"
#include "progressindicator.h"
+#include "localfolder.h"
#define AC_LABEL_WIDTH 240
static void ac_menu_popup_closed (GtkMenuShell *menu_shell,
gpointer data);
-static gint main_window_close_cb (GtkWidget *widget,
- GdkEventAny *event,
- gpointer data);
-static gint folder_window_close_cb (GtkWidget *widget,
- GdkEventAny *event,
- gpointer data);
-static gint message_window_close_cb (GtkWidget *widget,
- GdkEventAny *event,
- gpointer data);
+static gint main_window_close_cb (GtkWidget *widget,
+ GdkEventAny *event,
+ gpointer data);
+static gint folder_window_close_cb (GtkWidget *widget,
+ GdkEventAny *event,
+ gpointer data);
+static gint message_window_close_cb (GtkWidget *widget,
+ GdkEventAny *event,
+ gpointer data);
-static void main_window_size_allocate_cb(GtkWidget *widget,
- GtkAllocation *allocation,
- gpointer data);
+static void main_window_size_allocate_cb (GtkWidget *widget,
+ GtkAllocation *allocation,
+ gpointer data);
+static void folder_window_size_allocate_cb (GtkWidget *widget,
+ GtkAllocation *allocation,
+ gpointer data);
+static void message_window_size_allocate_cb (GtkWidget *widget,
+ GtkAllocation *allocation,
+ gpointer data);
static void new_folder_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
-static void add_mbox_cb (MainWindow *mainwin,
- guint action,
- GtkWidget *widget);
static void rename_folder_cb (MainWindow *mainwin,
guint action,
GtkWidget *widget);
NULL, update_folderview_cb, 0, NULL},
{N_("/_File/_Add mailbox"), NULL, NULL, 0, "<Branch>"},
{N_("/_File/_Add mailbox/MH..."), NULL, add_mailbox_cb, 0, NULL},
- {N_("/_File/_Add mailbox/mbox..."), NULL, add_mbox_cb, 0, NULL},
{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},
debug_print("done.\n");
- messageview->visible = TRUE;
+ messageview->visible = prefs_common.msgview_visible;
main_window_set_widgets(mainwin, type);
summary_init(summaryview);
messageview_init(messageview);
log_window_init(mainwin->logwin);
+ log_window_set_clipping(mainwin->logwin, prefs_common.cliplog,
+ prefs_common.loglength);
#ifdef USE_OPENSSL
sslcertwindow_register_hook();
#endif
main_window_set_menu_sensitive(mainwin);
+ prefs_common.msgview_visible = mainwin->messageview->visible;
+
gtk_widget_grab_focus(summaryview->ctree);
}
allocation = &(GTK_WIDGET_PTR(mainwin->summaryview)->allocation);
- prefs_common.summaryview_width = allocation->width;
+ if (allocation->width > 1 && allocation->height > 1) {
+ prefs_common.summaryview_width = allocation->width;
- if ((mainwin->type == SEPARATE_NONE ||
- mainwin->type == SEPARATE_FOLDER) &&
- messageview_is_visible(mainwin->messageview))
- prefs_common.summaryview_height = allocation->height;
+ if ((mainwin->type == SEPARATE_NONE ||
+ mainwin->type == SEPARATE_FOLDER) &&
+ messageview_is_visible(mainwin->messageview))
+ prefs_common.summaryview_height = allocation->height;
- prefs_common.mainview_width = allocation->width;
+ prefs_common.mainview_width = allocation->width;
+ }
allocation = &mainwin->window->allocation;
- prefs_common.mainview_height = allocation->height;
- prefs_common.mainwin_width = allocation->width;
- prefs_common.mainwin_height = allocation->height;
+ if (allocation->width > 1 && allocation->height > 1) {
+ prefs_common.mainview_height = allocation->height;
+ prefs_common.mainwin_width = allocation->width;
+ prefs_common.mainwin_height = allocation->height;
+ }
allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation);
- prefs_common.folderview_width = allocation->width;
- prefs_common.folderview_height = allocation->height;
+ if (allocation->width > 1 && allocation->height > 1) {
+ prefs_common.folderview_width = allocation->width;
+ prefs_common.folderview_height = allocation->height;
+ }
allocation = &(GTK_WIDGET_PTR(mainwin->messageview)->allocation);
- prefs_common.msgview_width = allocation->width;
- prefs_common.msgview_height = allocation->height;
+ if (allocation->width > 1 && allocation->height > 1) {
+ prefs_common.msgview_width = allocation->width;
+ prefs_common.msgview_height = allocation->height;
+ }
+
+ debug_print("summaryview size: %d x %d\n",
+ prefs_common.summaryview_width,
+ prefs_common.summaryview_height);
+ debug_print("folderview size: %d x %d\n",
+ prefs_common.folderview_width,
+ prefs_common.folderview_height);
+ debug_print("messageview size: %d x %d\n",
+ prefs_common.msgview_width,
+ prefs_common.msgview_height);
}
void main_window_get_position(MainWindow *mainwin)
prefs_common.mainwin_x = x;
prefs_common.mainwin_y = y;
- debug_print("window position: x = %d, y = %d\n", x, y);
+ debug_print("main window position: %d, %d\n", x, y);
window = main_window_get_folder_window(mainwin);
if (window) {
gtkut_widget_get_uposition(window, &x, &y);
prefs_common.folderwin_x = x;
prefs_common.folderwin_y = y;
+ debug_print("folder window position: %d, %d\n", x, y);
}
window = main_window_get_message_window(mainwin);
if (window) {
gtkut_widget_get_uposition(window, &x, &y);
prefs_common.main_msgwin_x = x;
prefs_common.main_msgwin_y = y;
+ debug_print("message window position: %d, %d\n", x, y);
}
}
folderview_set(mainwin->folderview);
}
-void main_window_add_mbox(MainWindow *mainwin)
-{
- gchar *path;
- Folder *folder;
- FolderItem * item;
-
- path = input_dialog(_("Add mbox mailbox"),
- _("Input the location of mailbox."),
- "mail");
-
- if (!path) return;
-
- if (folder_find_from_path(path)) {
- alertpanel_error(_("The mailbox `%s' already exists."), path);
- g_free(path);
- return;
- }
-
- folder = folder_new(folder_get_class_from_string("mbox"),
- g_basename(path), path);
- g_free(path);
-
- if (folder->klass->create_tree(folder) < 0) {
- alertpanel_error(_("Creation of the mailbox failed."));
- folder_destroy(folder);
- return;
- }
-
- folder_add(folder);
-
- item = folder_item_new(folder, folder->name, NULL);
- item->folder = folder;
- folder->node = g_node_new(item);
-
- folder_create_folder(item, "inbox");
- folder_create_folder(item, "outbox");
- folder_create_folder(item, "queue");
- folder_create_folder(item, "draft");
- folder_create_folder(item, "trash");
-
- folderview_set(mainwin->folderview);
-}
-
SensitiveCond main_window_get_current_state(MainWindow *mainwin)
{
SensitiveCond state = 0;
{"/File/Add mailbox" , M_UNLOCKED},
{"/File/Add mailbox/MH..." , M_UNLOCKED},
- {"/File/Add mailbox/mbox..." , 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/Save as...", M_TARGET_EXIST|M_UNLOCKED},
{"/File/Print..." , M_TARGET_EXIST|M_UNLOCKED},
/* {"/File/Close" , M_UNLOCKED}, */
{"/File/Exit" , M_UNLOCKED},
}
SET_CHECK_MENU_ACTIVE("/View/Show all headers",
- mainwin->messageview->textview->show_all_headers);
+ mainwin->messageview->mimeview->textview->show_all_headers);
SET_CHECK_MENU_ACTIVE("/View/Thread view", (state & M_THREADED) != 0);
#undef SET_CHECK_MENU_ACTIVE
gtk_widget_show(mainwin->window);
gtk_widget_show(mainwin->vbox_body);
- switch (mainwin->type) {
- case SEPARATE_FOLDER:
- gtk_widget_show(mainwin->win.sep_folder.folderwin);
- break;
- case SEPARATE_MESSAGE:
- gtk_widget_show(mainwin->win.sep_message.messagewin);
- break;
- case SEPARATE_BOTH:
- gtk_widget_show(mainwin->win.sep_both.folderwin);
- gtk_widget_show(mainwin->win.sep_both.messagewin);
- break;
- default:
- break;
+ gtk_widget_set_uposition(mainwin->window,
+ prefs_common.mainwin_x,
+ prefs_common.mainwin_y);
+
+ gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->folderview),
+ prefs_common.folderview_width,
+ prefs_common.folderview_height);
+ gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->summaryview),
+ prefs_common.summaryview_width,
+ prefs_common.summaryview_height);
+ gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->messageview),
+ prefs_common.msgview_width,
+ prefs_common.msgview_height);
+
+ if (mainwin->type & SEPARATE_FOLDER) {
+ GtkWidget *folderwin;
+
+ folderwin = main_window_get_folder_window(mainwin);
+ gtk_widget_show(folderwin);
+ gtk_widget_set_uposition(folderwin, prefs_common.folderwin_x,
+ prefs_common.folderwin_y);
+ }
+
+ if (mainwin->type & SEPARATE_MESSAGE) {
+ GtkWidget *messagewin;
+
+ messagewin = main_window_get_message_window(mainwin);
+ gtk_widget_show(messagewin);
+ gtk_widget_set_uposition(messagewin, prefs_common.main_msgwin_x,
+ prefs_common.main_msgwin_y);
}
}
void main_window_hide(MainWindow *mainwin)
{
+ main_window_get_size(mainwin);
+ main_window_get_position(mainwin);
+
gtk_widget_hide(mainwin->window);
gtk_widget_hide(mainwin->vbox_body);
- switch (mainwin->type) {
- case SEPARATE_FOLDER:
+ if (mainwin->type & SEPARATE_FOLDER) {
gtk_widget_hide(mainwin->win.sep_folder.folderwin);
- break;
- case SEPARATE_MESSAGE:
+ }
+
+ if (mainwin->type & SEPARATE_MESSAGE) {
gtk_widget_hide(mainwin->win.sep_message.messagewin);
- break;
- case SEPARATE_BOTH:
- gtk_widget_hide(mainwin->win.sep_both.folderwin);
- gtk_widget_hide(mainwin->win.sep_both.messagewin);
- break;
- default:
- break;
}
}
GtkWidget *menuitem;
GtkItemFactory *msgview_ifactory;
- debug_print("Setting widgets...");
+ debug_print("Setting widgets... ");
/* create separated window(s) if needed */
if (type & SEPARATE_FOLDER) {
gtk_signal_connect(GTK_OBJECT(folderwin), "delete_event",
GTK_SIGNAL_FUNC(folder_window_close_cb),
mainwin);
+ gtk_container_add(GTK_CONTAINER(folderwin),
+ GTK_WIDGET_PTR(mainwin->folderview));
+ gtk_widget_realize(folderwin);
+ if (prefs_common.folderview_visible)
+ gtk_widget_show(folderwin);
}
if (type & SEPARATE_MESSAGE) {
messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_signal_connect(GTK_OBJECT(messagewin), "delete_event",
GTK_SIGNAL_FUNC(message_window_close_cb),
mainwin);
+ if (messageview_is_visible(mainwin->messageview))
+ gtk_widget_show(messagewin);
}
gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->folderview),
switch (type) {
case SEPARATE_NONE:
hpaned = gtk_hpaned_new();
- gtk_widget_show(hpaned);
gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
gtk_paned_add1(GTK_PANED(hpaned),
GTK_WIDGET_PTR(mainwin->folderview));
+ gtk_widget_show(hpaned);
+ gtk_widget_queue_resize(hpaned);
vpaned = gtk_vpaned_new();
if (messageview_is_visible(mainwin->messageview)) {
gtk_paned_add2(GTK_PANED(vpaned),
GTK_WIDGET_PTR(mainwin->messageview));
gtk_widget_show(vpaned);
+ gtk_widget_queue_resize(vpaned);
mainwin->win.sep_none.hpaned = hpaned;
mainwin->win.sep_none.vpaned = vpaned;
gtk_paned_add2(GTK_PANED(vpaned),
GTK_WIDGET_PTR(mainwin->messageview));
gtk_widget_show(vpaned);
-
- gtk_container_add(GTK_CONTAINER(folderwin),
- GTK_WIDGET_PTR(mainwin->folderview));
+ gtk_widget_queue_resize(vpaned);
mainwin->win.sep_folder.folderwin = folderwin;
mainwin->win.sep_folder.vpaned = vpaned;
- gtk_widget_show_all(folderwin);
-
/* remove headerview if not in prefs */
headerview_set_visibility(mainwin->messageview->headerview,
prefs_common.display_header_pane);
case SEPARATE_MESSAGE:
hpaned = gtk_hpaned_new();
gtk_box_pack_start(GTK_BOX(vbox_body), hpaned, TRUE, TRUE, 0);
-
gtk_paned_add1(GTK_PANED(hpaned),
GTK_WIDGET_PTR(mainwin->folderview));
gtk_paned_add2(GTK_PANED(hpaned),
GTK_WIDGET_PTR(mainwin->summaryview));
gtk_widget_show(hpaned);
-
+ gtk_widget_queue_resize(hpaned);
messageview_add_toolbar(mainwin->messageview, messagewin);
msgview_ifactory = gtk_item_factory_from_widget(mainwin->messageview->menubar);
menu_set_sensitive(msgview_ifactory, "/File/Close", FALSE);
mainwin->win.sep_message.messagewin = messagewin;
mainwin->win.sep_message.hpaned = hpaned;
- gtk_widget_show(messagewin);
+ gtk_widget_realize(messagewin);
+ gtk_widget_show_all(GTK_WIDGET_PTR(mainwin->messageview));
+ gtk_widget_show_all(messagewin);
+ toolbar_set_style(mainwin->messageview->toolbar->toolbar,
+ mainwin->messageview->handlebox,
+ prefs_common.toolbar_style);
+
break;
case SEPARATE_BOTH:
+ messageview_add_toolbar(mainwin->messageview, messagewin);
+ msgview_ifactory = gtk_item_factory_from_widget(mainwin->messageview->menubar);
+ menu_set_sensitive(msgview_ifactory, "/File/Close", FALSE);
+
gtk_box_pack_start(GTK_BOX(vbox_body),
GTK_WIDGET_PTR(mainwin->summaryview),
TRUE, TRUE, 0);
- gtk_container_add(GTK_CONTAINER(folderwin),
- GTK_WIDGET_PTR(mainwin->folderview));
- gtk_container_add(GTK_CONTAINER(messagewin),
- GTK_WIDGET_PTR(mainwin->messageview));
-
+
mainwin->win.sep_both.folderwin = folderwin;
mainwin->win.sep_both.messagewin = messagewin;
+
+ gtk_widget_realize(messagewin);
+ gtk_widget_show_all(GTK_WIDGET_PTR(mainwin->messageview));
+ gtk_widget_show_all(messagewin);
+ toolbar_set_style(mainwin->messageview->toolbar->toolbar,
+ mainwin->messageview->handlebox,
+ prefs_common.toolbar_style);
- gtk_widget_show(folderwin);
- gtk_widget_show(messagewin);
break;
}
prefs_common.mainwin_y);
gtk_widget_queue_resize(vbox_body);
+ gtk_widget_queue_resize(mainwin->vbox);
gtk_widget_queue_resize(mainwin->window);
/* CLAWS: previous "gtk_widget_show_all" makes noticeview
* and mimeview icon list/ctree lose track of their visibility states */
if (!noticeview_is_visible(mainwin->messageview->noticeview))
gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->noticeview));
+ if (!noticeview_is_visible(mainwin->messageview->mimeview->siginfoview))
+ gtk_widget_hide(GTK_WIDGET_PTR(mainwin->messageview->mimeview->siginfoview));
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainwin->messageview->mimeview->mime_toggle)))
gtk_widget_hide(mainwin->messageview->mimeview->icon_mainbox);
else
mainwin->type = type;
- mainwin->messageview->visible = TRUE;
/* toggle menu state */
menuitem = gtk_item_factory_get_item
(ifactory, "/View/Show or hide/Folder tree");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
+ (type & SEPARATE_FOLDER) == 0 ? TRUE :
+ prefs_common.folderview_visible);
+ gtk_widget_set_sensitive(menuitem, ((type & SEPARATE_FOLDER) != 0));
menuitem = gtk_item_factory_get_item
(ifactory, "/View/Show or hide/Message view");
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
+ (type & SEPARATE_MESSAGE) == 0 ? TRUE :
+ prefs_common.msgview_visible);
menuitem = gtk_item_factory_get_item
(ifactory, "/View/Separate folder tree");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
((type & SEPARATE_MESSAGE) != 0));
+ if (folderwin) {
+ gtk_signal_connect
+ (GTK_OBJECT(folderwin), "size_allocate",
+ GTK_SIGNAL_FUNC(folder_window_size_allocate_cb),
+ mainwin);
+ }
+ if (messagewin) {
+ gtk_signal_connect
+ (GTK_OBJECT(messagewin), "size_allocate",
+ GTK_SIGNAL_FUNC(message_window_size_allocate_cb),
+ mainwin);
+ }
+
debug_print("done.\n");
}
main_window_get_size(mainwin);
}
-static void add_mailbox_cb(MainWindow *mainwin, guint action,
- GtkWidget *widget)
+static void folder_window_size_allocate_cb(GtkWidget *widget,
+ GtkAllocation *allocation,
+ gpointer data)
{
- main_window_add_mailbox(mainwin);
+ MainWindow *mainwin = (MainWindow *)data;
+
+ main_window_get_size(mainwin);
+}
+
+static void message_window_size_allocate_cb(GtkWidget *widget,
+ GtkAllocation *allocation,
+ gpointer data)
+{
+ MainWindow *mainwin = (MainWindow *)data;
+
+ main_window_get_size(mainwin);
}
-static void add_mbox_cb(MainWindow *mainwin, guint action,
- GtkWidget *widget)
+static void add_mailbox_cb(MainWindow *mainwin, guint action,
+ GtkWidget *widget)
{
- main_window_add_mbox(mainwin);
+ main_window_add_mailbox(mainwin);
}
static void update_folderview_cb(MainWindow *mainwin, guint action,
gtk_widget_hide(mainwin->win.sep_both.folderwin);
break;
}
+
+ prefs_common.folderview_visible = active;
}
static void toggle_message_cb(MainWindow *mainwin, guint action,
if (GTK_WIDGET_HAS_FOCUS(mainwin->summaryview->ctree))
summary_select_all(mainwin->summaryview);
else if (messageview_is_visible(msgview) &&
- (GTK_WIDGET_HAS_FOCUS(msgview->textview->text) ||
- GTK_WIDGET_HAS_FOCUS(msgview->mimeview->textview->text)))
+ (GTK_WIDGET_HAS_FOCUS(msgview->mimeview->textview->text)))
messageview_select_all(mainwin->messageview);
}
g_return_val_if_fail(data, FALSE);
summary = ((MainWindow *)data)->summaryview;
g_return_val_if_fail(summary, FALSE);
+
+ if (GTK_CLIST(summary->ctree)->selection &&
+ g_list_length(GTK_CLIST(summary->ctree)->selection) > 1)
+ return FALSE;
+
if (summary->selected != summary->displayed)
summary_select_node(summary, summary->displayed, FALSE, TRUE);
return FALSE;