2005-01-27 [colin] 1.0.0cvs16
[claws.git] / src / mainwindow.c
index 8ccf41df3a931b24883baf4542f6866dca666abf..498f824ed19d6607b6266112cf35d6b72eb9e086 100644 (file)
@@ -160,6 +160,9 @@ static void import_mbox_cb   (MainWindow    *mainwin,
 static void export_mbox_cb      (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
+static void export_list_mbox_cb  (MainWindow   *mainwin, 
+                                 guint          action,
+                                 GtkWidget     *widget);
 static void empty_trash_cb      (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
@@ -260,6 +263,10 @@ static void set_charset_cb         (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
 
+static void set_decode_cb              (MainWindow     *mainwin,
+                                        guint           action,
+                                        GtkWidget      *widget);
+
 static void hide_read_messages   (MainWindow   *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
@@ -435,10 +442,15 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_File"),                          NULL, NULL, 0, "<Branch>"},
        {N_("/_File/_Add mailbox"),             NULL, NULL, 0, "<Branch>"},
        {N_("/_File/_Add mailbox/MH..."),       NULL, add_mailbox_cb, 0, NULL},
+       {N_("/_File/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_File/Change folder order"),      NULL, foldersort_cb,  0, NULL},
+       {N_("/_File/---"),                      NULL, NULL, 0, "<Separator>"},
        {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 all Trash folders"),  "<shift>D", empty_trash_cb, 0, NULL},
+       {N_("/_File/_Export selected to mbox file..."), 
+                                               NULL, export_list_mbox_cb, 0, NULL},
+       {N_("/_File/---"),                      NULL, NULL, 0, "<Separator>"},
+       {N_("/_File/Empty all _Trash folders"), "<shift>D", empty_trash_cb, 0, NULL},
        {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},
@@ -614,6 +626,22 @@ static GtkItemFactoryEntry mainwin_entries[] =
 #undef CODESET_SEPARATOR
 #undef CODESET_ACTION
 
+#define DECODE_SEPARATOR \
+       {N_("/_View/Decode/---"),               NULL, NULL, 0, "<Separator>"}
+#define DECODE_ACTION(action) \
+        NULL, set_decode_cb, action, "/View/Decode/Auto detect"
+       {N_("/_View/Decode"),           NULL, NULL, 0, "<Branch>"},
+       {N_("/_View/Decode/_Auto detect"),
+        NULL, set_decode_cb, 0, "<RadioItem>"},
+       {N_("/_View/Decode/---"),               NULL, NULL, 0, "<Separator>"},
+       {N_("/_View/Decode/_8bit"),             DECODE_ACTION(ENC_8BIT)},
+       {N_("/_View/Decode/_Quoted printable"), DECODE_ACTION(ENC_QUOTED_PRINTABLE)},
+       {N_("/_View/Decode/_Base64"),           DECODE_ACTION(ENC_BASE64)},
+       {N_("/_View/Decode/_Uuencode"),         DECODE_ACTION(ENC_X_UUENCODE)},
+
+#undef DECODE_SEPARATOR
+#undef DECODE_ACTION
+
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_View/Open in new _window"),      "<control><alt>N", open_msg_cb, 0, NULL},
        {N_("/_View/Mess_age source"),          "<control>U", view_source_cb, 0, NULL},
@@ -724,8 +752,8 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Configuration/_Edit accounts..."),
                                                NULL, account_edit_open, 0, NULL},
        {N_("/_Configuration/---"),             NULL, NULL, 0, "<Separator>"},
-       {N_("/_Configuration/_Common preferences..."),
-                                               NULL, prefs_common_open_cb, 0, NULL},
+       {N_("/_Configuration/_Preferences..."),
+                                               NULL, prefs_open_cb, 0, NULL},
        {N_("/_Configuration/Pre-processing..."),
                                                NULL, prefs_pre_processing_open_cb, 0, NULL},
        {N_("/_Configuration/Post-processing..."),
@@ -734,7 +762,6 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                NULL, prefs_filtering_open_cb, 0, NULL},
        {N_("/_Configuration/_Templates..."),   NULL, prefs_template_open_cb, 0, NULL},
        {N_("/_Configuration/_Actions..."),     NULL, prefs_actions_open_cb, 0, NULL},
-       {N_("/_Configuration/_Other Preferences..."),  NULL, prefs_open_cb, 0, NULL},
        {N_("/_Configuration/Plugins..."),      NULL, plugins_open_cb, 0, NULL},
 
        {N_("/_Help"),                          NULL, NULL, 0, "<Branch>"},
@@ -1571,7 +1598,7 @@ void main_window_empty_trash(MainWindow *mainwin, gboolean confirm)
                manage_window_focus_in(mainwin->window, NULL, NULL);
        }
 
-       procmsg_empty_trash();
+       procmsg_empty_all_trash();
 
        if (mainwin->summaryview->folder_item &&
            mainwin->summaryview->folder_item->stype == F_TRASH)
@@ -1958,6 +1985,7 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                if (prefs_common.folderview_visible)
                        gtk_widget_show(folderwin);
        }
+
        if (type & SEPARATE_MESSAGE) {
                messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
                gtk_window_set_title(GTK_WINDOW(messagewin),
@@ -1975,6 +2003,9 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                                   mainwin);
                if (messageview_is_visible(mainwin->messageview))
                        gtk_widget_show(messagewin);
+       } else {
+               mainwin->messageview->statusbar = mainwin->statusbar;
+               mainwin->messageview->statusbar_cid = mainwin->messageview_cid;
        }
 
        gtk_widget_set_usize(GTK_WIDGET_PTR(mainwin->folderview),
@@ -2261,6 +2292,9 @@ static gint message_window_close_cb(GtkWidget *widget, GdkEventAny *event,
                (mainwin->menu_factory, "/View/Show or hide/Message view");
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), FALSE);
 
+       mainwin->messageview->statusbar = mainwin->statusbar;
+       mainwin->messageview->statusbar_cid = mainwin->messageview_cid;
+
        return TRUE;
 }
 
@@ -2322,6 +2356,12 @@ static void export_mbox_cb(MainWindow *mainwin, guint action,
        export_mbox(mainwin->summaryview->folder_item);
 }
 
+static void export_list_mbox_cb(MainWindow *mainwin, guint action,
+                               GtkWidget *widget)
+{
+       summaryview_export_mbox_list(mainwin->summaryview);
+}
+
 static void empty_trash_cb(MainWindow *mainwin, guint action,
                           GtkWidget *widget)
 {
@@ -2415,16 +2455,12 @@ void main_window_reply_cb(MainWindow *mainwin, guint action,
 {
        MessageView *msgview = (MessageView*)mainwin->messageview;
        GSList *msginfo_list = NULL;
-       gchar *body;
 
        g_return_if_fail(msgview != NULL);
 
        msginfo_list = summary_get_selection(mainwin->summaryview);
        g_return_if_fail(msginfo_list != NULL);
-       
-       body = messageview_get_selection(msgview);
-       compose_reply_mode((ComposeMode)action, msginfo_list, body);
-       g_free(body);
+       compose_reply_from_messageview(msgview, msginfo_list, action);
        g_slist_free(msginfo_list);
 }
 
@@ -2603,15 +2639,29 @@ static void set_charset_cb(MainWindow *mainwin, guint action,
 
        if (GTK_CHECK_MENU_ITEM(widget)->active) {
                str = conv_get_charset_str((CharSet)action);
-               g_free(prefs_common.force_charset);
-               prefs_common.force_charset = str ? g_strdup(str) : NULL;
-
+               
+               g_free(mainwin->messageview->forced_charset);
+               mainwin->messageview->forced_charset = str ? g_strdup(str) : NULL;
+               procmime_force_charset(str);
+               
                summary_redisplay_msg(mainwin->summaryview);
                
                debug_print("forced charset: %s\n", str ? str : "Auto-Detect");
        }
 }
 
+static void set_decode_cb(MainWindow *mainwin, guint action,
+                          GtkWidget *widget)
+{
+       if (GTK_CHECK_MENU_ITEM(widget)->active) {
+               mainwin->messageview->forced_encoding = (EncodingType)action;
+               
+               summary_redisplay_msg(mainwin->summaryview);
+               
+               debug_print("forced encoding: %d\n", action);
+       }
+}
+
 static void hide_read_messages (MainWindow *mainwin, guint action,
                                GtkWidget *widget)
 {
@@ -2693,7 +2743,7 @@ static void delete_duplicated_cb(MainWindow *mainwin, guint action,
 {
        FolderItem *item;
 
-       item = folderview_get_selected(mainwin->folderview);
+       item = folderview_get_selected_item(mainwin->folderview);
        if (item) {
                main_window_cursor_wait(mainwin);
                STATUSBAR_PUSH(mainwin, _("Deleting duplicated messages..."));
@@ -2868,7 +2918,7 @@ static void create_processing_cb(MainWindow *mainwin, guint action,
 static void prefs_common_open_cb(MainWindow *mainwin, guint action,
                                 GtkWidget *widget)
 {
-       prefs_common_open();
+       /* prefs_common_open(); */
 }
 
 static void prefs_pre_processing_open_cb(MainWindow *mainwin, guint action,