0.9.7claws10
[claws.git] / src / mainwindow.c
index 7931db9911862a2e3f87df23f986c3108d18266e..d68ba0c6bb433a1874459360a1b118ad025a4518 100644 (file)
@@ -86,6 +86,7 @@
 #include "pluginwindow.h"
 #include "hooks.h"
 #include "progressindicator.h"
+#include "localfolder.h"
 
 #define AC_LABEL_WIDTH 240
 
@@ -136,9 +137,6 @@ static void message_window_size_allocate_cb (GtkWidget      *widget,
 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);
@@ -425,7 +423,6 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                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},
@@ -1013,6 +1010,8 @@ MainWindow *main_window_create(SeparateType 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
@@ -1481,49 +1480,6 @@ void main_window_add_mailbox(MainWindow *mainwin)
        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;
@@ -1605,7 +1561,6 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/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},
@@ -1730,7 +1685,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        }
 
        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
@@ -1863,9 +1818,6 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                gtk_signal_connect(GTK_OBJECT(messagewin), "delete_event",
                                   GTK_SIGNAL_FUNC(message_window_close_cb),
                                   mainwin);
-               gtk_container_add(GTK_CONTAINER(messagewin),
-                                 GTK_WIDGET_PTR(mainwin->messageview));
-               gtk_widget_realize(messagewin);
                if (messageview_is_visible(mainwin->messageview))
                        gtk_widget_show(messagewin);
        }
@@ -1953,14 +1905,32 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                mainwin->win.sep_message.messagewin = messagewin;
                mainwin->win.sep_message.hpaned     = hpaned;
 
+               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);
-
+               
                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);          
 
                break;
        }
@@ -1976,6 +1946,8 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
         * 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 
@@ -2162,12 +2134,6 @@ static void add_mailbox_cb(MainWindow *mainwin, guint action,
        main_window_add_mailbox(mainwin);
 }
 
-static void add_mbox_cb(MainWindow *mainwin, guint action,
-                       GtkWidget *widget)
-{
-       main_window_add_mbox(mainwin);
-}
-
 static void update_folderview_cb(MainWindow *mainwin, guint action,
                                 GtkWidget *widget)
 {
@@ -2686,8 +2652,7 @@ static void allsel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
        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);
 }
 
@@ -2805,6 +2770,11 @@ static gboolean mainwindow_focus_in_event(GtkWidget *widget, GdkEventFocus *focu
        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;