2007-01-15 [paul] 2.7.0cvs30
[claws.git] / src / mainwindow.c
index 0c095697a09c60b1429cc7603b19a0674e300633..3de1ec5e394cd205467046bac9c40db4ace9611a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
  *
  * 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
@@ -56,6 +56,7 @@
 #include "stock_pixmap.h"
 #include "folder.h"
 #include "inc.h"
+#include "log.h"
 #include "compose.h"
 #include "procmsg.h"
 #include "import.h"
 static GList *mainwin_list = NULL;
 
 static GdkCursor *watch_cursor = NULL;
+static GdkCursor *hand_cursor = NULL;
 
 static void main_window_menu_callback_block    (MainWindow     *mainwin);
 static void main_window_menu_callback_unblock  (MainWindow     *mainwin);
@@ -259,6 +261,19 @@ static void mark_as_spam_cb                (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
 
+static void ignore_thread_cb           (MainWindow     *mainwin, 
+                                        guint           action,
+                                        GtkWidget      *widget);
+static void unignore_thread_cb         (MainWindow     *mainwin, 
+                                        guint           action,
+                                        GtkWidget      *widget);
+static void lock_msgs_cb               (MainWindow     *mainwin, 
+                                        guint           action,
+                                        GtkWidget      *widget);
+static void unlock_msgs_cb             (MainWindow     *mainwin, 
+                                        guint           action,
+                                        GtkWidget      *widget);
+
 static void reedit_cb                  (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
@@ -375,6 +390,9 @@ static void allsel_cb                (MainWindow    *mainwin,
 static void select_thread_cb    (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
+static void delete_thread_cb    (MainWindow    *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
 
 static void create_filter_cb    (MainWindow    *mainwin,
                                  guint          action,
@@ -475,6 +493,7 @@ static void mailing_list_open_uri(GtkWidget *w, gpointer *data);
 static void mainwindow_quicksearch             (MainWindow     *mainwin, 
                                                 guint           action, 
                                                 GtkWidget      *widget);
+static gboolean any_folder_want_synchronise(void);
 
 static GtkItemFactoryEntry mainwin_entries[] =
 {
@@ -504,6 +523,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Edit/_Copy"),                    "<control>C", copy_cb, 0, NULL},
        {N_("/_Edit/Select _all"),              "<control>A", allsel_cb, 0, NULL},
        {N_("/_Edit/Select _thread"),           NULL, select_thread_cb, 0, NULL},
+       {N_("/_Edit/_Delete thread"),           NULL, delete_thread_cb, 0, NULL},
        {N_("/_Edit/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_Edit/_Find in current message..."),
                                                "<control>F", search_cb, 0, NULL},
@@ -714,7 +734,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {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},
-       {N_("/_View/Show all headers"),         "<control>H", show_all_header_cb, 0, "<ToggleItem>"},
+       {N_("/_View/All headers"),              "<control>H", show_all_header_cb, 0, "<ToggleItem>"},
        {N_("/_View/Quotes"),                   NULL, NULL, 0, "<Branch>"},
        {N_("/_View/Quotes/_Fold all"),         "<control><shift>Q", hide_quotes_cb, 1, "<ToggleItem>"},
        {N_("/_View/Quotes/Fold from level _2"),NULL, hide_quotes_cb, 2, "<ToggleItem>"},
@@ -769,9 +789,14 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Message/_Mark/Mark as unr_ead"), "<shift>exclam", mark_as_unread_cb, 0, NULL},
        {N_("/_Message/_Mark/Mark as rea_d"),   NULL, mark_as_read_cb, 0, NULL},
        {N_("/_Message/_Mark/Mark all _read"),  NULL, mark_all_read_cb, 0, NULL},
+       {N_("/_Message/_Mark/Ignore thread"),   NULL, ignore_thread_cb, 0, NULL},
+       {N_("/_Message/_Mark/Unignore thread"), NULL, unignore_thread_cb, 0, NULL},
        {N_("/_Message/_Mark/---"),             NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/_Mark/Mark as _spam"),   NULL, mark_as_spam_cb, 1, NULL},
        {N_("/_Message/_Mark/Mark as _ham"),    NULL, mark_as_spam_cb, 0, NULL},
+       {N_("/_Message/_Mark/---"),             NULL, NULL, 0, "<Separator>"},
+       {N_("/_Message/_Mark/Lock"),            NULL, lock_msgs_cb, 0, NULL},
+       {N_("/_Message/_Mark/Unlock"),          NULL, unlock_msgs_cb, 0, NULL},
        {N_("/_Message/Color la_bel"),          NULL, NULL,            0, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/Re-_edit"),              NULL, reedit_cb, 0, NULL},
@@ -890,12 +915,13 @@ static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_i
        GtkMenuShell *menu;
        GtkCheckMenuItem **items;
        gint n;
-       GList *cur, *sel;
+       GList *cur;
+       GSList *sel;
 
        mainwin = (MainWindow *)data;
        g_return_if_fail(mainwin != NULL);
 
-       sel = GTK_CLIST(mainwin->summaryview->ctree)->selection;
+       sel = summary_get_selection(mainwin->summaryview);
        if (!sel) return;
 
        menu = GTK_MENU_SHELL(mainwin->colorlabel_menu);
@@ -925,9 +951,7 @@ static void mainwindow_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_i
                        MsgInfo *msginfo;
                        gint clabel;
 
-                       msginfo = gtk_ctree_node_get_row_data
-                               (GTK_CTREE(mainwin->summaryview->ctree),
-                                GTK_CTREE_NODE(sel->data));
+                       msginfo = (MsgInfo *)sel->data;
                        if (msginfo) {
                                clabel = MSG_GET_COLORLABEL_VALUE(msginfo->flags);
                                if (!items[clabel]->active)
@@ -1020,6 +1044,50 @@ static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refr
        mainwin->colorlabel_menu = menu;
 }
 
+static gboolean warning_icon_pressed(GtkWidget *widget, GdkEventButton *evt,
+                                   MainWindow *mainwindow)
+{
+       if (evt && evt->button == 1) {
+               log_window_show_error(mainwindow->logwin);
+               gtk_widget_hide(mainwindow->warning_btn);
+       }
+       return FALSE;
+}
+
+static gboolean warning_visi_notify(GtkWidget *widget,
+                                      GdkEventVisibility *event,
+                                      MainWindow *mainwindow)
+{
+       gdk_window_set_cursor(mainwindow->warning_btn->window, hand_cursor);
+       return FALSE;
+}
+
+static gboolean warning_leave_notify(GtkWidget *widget,
+                                     GdkEventCrossing *event,
+                                     MainWindow *mainwindow)
+{
+       gdk_window_set_cursor(mainwindow->warning_btn->window, NULL);
+       return FALSE;
+}
+
+static gboolean warning_enter_notify(GtkWidget *widget,
+                                     GdkEventCrossing *event,
+                                     MainWindow *mainwindow)
+{
+       gdk_window_set_cursor(mainwindow->warning_btn->window, hand_cursor);
+       return FALSE;
+}
+
+void mainwindow_show_error(void)
+{
+       MainWindow *mainwin = mainwindow_get_mainwindow();
+       gtk_widget_show(mainwin->warning_btn);
+}
+
+void mainwindow_clear_error(MainWindow *mainwin)
+{
+       gtk_widget_hide(mainwin->warning_btn);
+}
 
 MainWindow *main_window_create(SeparateType type)
 {
@@ -1039,9 +1107,9 @@ MainWindow *main_window_create(SeparateType type)
        GtkWidget *offline_pixmap;
        GtkWidget *online_switch;
        GtkWidget *offline_switch;
-       GtkTooltips *offline_tip;
-       GtkTooltips *online_tip;
-       GtkTooltips *sel_ac_tip;
+       GtkTooltips *tips;
+       GtkWidget *warning_icon;
+       GtkWidget *warning_btn;
 
        FolderView *folderview;
        SummaryView *summaryview;
@@ -1137,6 +1205,33 @@ MainWindow *main_window_create(SeparateType type)
        hbox_stat = gtk_hbox_new(FALSE, 2);
        gtk_box_pack_end(GTK_BOX(vbox_body), hbox_stat, FALSE, FALSE, 0);
 
+       tips = gtk_tooltips_new();
+
+       warning_icon = gtk_image_new_from_stock
+                        (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR);
+       warning_btn = gtk_event_box_new();
+       gtk_event_box_set_visible_window(GTK_EVENT_BOX(warning_btn), FALSE);
+       
+       mainwin->warning_btn      = warning_btn;
+       
+       g_signal_connect(G_OBJECT(warning_btn), "button-press-event", 
+                        G_CALLBACK(warning_icon_pressed),
+                        (gpointer) mainwin);
+       g_signal_connect(G_OBJECT(warning_btn), "visibility-notify-event",
+                        G_CALLBACK(warning_visi_notify), mainwin);
+       g_signal_connect(G_OBJECT(warning_btn), "motion-notify-event",
+                        G_CALLBACK(warning_visi_notify), mainwin);
+       g_signal_connect(G_OBJECT(warning_btn), "leave-notify-event",
+                        G_CALLBACK(warning_leave_notify), mainwin);
+       g_signal_connect(G_OBJECT(warning_btn), "enter-notify-event",
+                        G_CALLBACK(warning_enter_notify), mainwin);
+
+       gtk_container_add (GTK_CONTAINER(warning_btn), warning_icon);
+
+       gtk_tooltips_set_tip(GTK_TOOLTIPS(tips),warning_btn, 
+                            _("Some error(s) happened. Click here to view log."), NULL);
+       gtk_box_pack_start(GTK_BOX(hbox_stat), warning_btn, FALSE, FALSE, 0);
+
        statusbar = statusbar_create();
        gtk_box_pack_start(GTK_BOX(hbox_stat), statusbar, TRUE, TRUE, 0);
 
@@ -1146,13 +1241,11 @@ MainWindow *main_window_create(SeparateType type)
 
        online_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_ONLINE);
        offline_pixmap = stock_pixmap_widget(hbox_stat, STOCK_PIXMAP_OFFLINE);
-       online_tip = gtk_tooltips_new();
        online_switch = gtk_button_new ();
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(online_tip),online_switch, 
+       gtk_tooltips_set_tip(GTK_TOOLTIPS(tips),online_switch, 
                             _("You are online. Click the icon to go offline"), NULL);
-       offline_tip = gtk_tooltips_new();
        offline_switch = gtk_button_new ();
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(offline_tip),offline_switch, 
+       gtk_tooltips_set_tip(GTK_TOOLTIPS(tips),offline_switch, 
                             _("You are offline. Click the icon to go online"),
                             NULL);
        gtk_container_add (GTK_CONTAINER(online_switch), online_pixmap);
@@ -1167,9 +1260,8 @@ MainWindow *main_window_create(SeparateType type)
        statuslabel = gtk_label_new("");
        gtk_box_pack_start(GTK_BOX(hbox_stat), statuslabel, FALSE, FALSE, 0);
 
-       sel_ac_tip = gtk_tooltips_new();
        ac_button = gtk_button_new();
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(sel_ac_tip),
+       gtk_tooltips_set_tip(GTK_TOOLTIPS(tips),
                             ac_button, _("Select account"), NULL);
        GTK_WIDGET_UNSET_FLAGS(ac_button, GTK_CAN_FOCUS);
        gtk_widget_set_size_request(ac_button, -1, 0);
@@ -1183,12 +1275,17 @@ MainWindow *main_window_create(SeparateType type)
        gtk_widget_show_all(hbox_stat);
 
        gtk_widget_hide(offline_switch);
+       gtk_widget_hide(warning_btn);
        /* create views */
        mainwin->folderview  = folderview  = folderview_create();
        mainwin->summaryview = summaryview = summary_create();
        mainwin->messageview = messageview = messageview_create(mainwin);
        mainwin->logwin      = log_window_create();
 
+       log_window_init(mainwin->logwin);
+       log_window_set_clipping(mainwin->logwin, prefs_common.cliplog,
+                               prefs_common.loglength);
+
        folderview->mainwin      = mainwin;
        folderview->summaryview  = summaryview;
 
@@ -1337,9 +1434,6 @@ MainWindow *main_window_create(SeparateType type)
        folderview_init(folderview);
        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
@@ -1352,6 +1446,8 @@ MainWindow *main_window_create(SeparateType type)
 
        if (!watch_cursor)
                watch_cursor = gdk_cursor_new(GDK_WATCH);
+       if (!hand_cursor)
+               hand_cursor = gdk_cursor_new(GDK_HAND2);
 
        mainwin_list = g_list_append(mainwin_list, mainwin);
 
@@ -1701,6 +1797,7 @@ void main_window_set_account_menu(GList *account_list)
                main_window_set_toolbar_combo_receive_menu(mainwin, account_list);
                main_window_set_toolbar_combo_compose_menu(mainwin, account_list);
        }
+       hooks_invoke(ACCOUNT_LIST_CHANGED_HOOKLIST, NULL);
 }
 
 void main_window_set_account_menu_only_toolbar(GList *account_list)
@@ -1874,7 +1971,7 @@ void main_window_toggle_message_view(MainWindow *mainwin)
 
        prefs_common.msgview_visible = mainwin->messageview->visible;
 
-       gtk_widget_grab_focus(summaryview->ctree);
+       summary_grab_focus(summaryview);
 }
 
 void main_window_get_size(MainWindow *mainwin)
@@ -2088,6 +2185,9 @@ SensitiveCond main_window_get_current_state(MainWindow *mainwin)
        if (cur_account)
                state |= M_HAVE_ACCOUNT;
        
+       if (any_folder_want_synchronise())
+               state |= M_WANT_SYNC;
+
        for ( ; account_list != NULL; account_list = account_list->next) {
                if (((PrefsAccount*)account_list->data)->protocol == A_NNTP) {
                        state |= M_HAVE_NEWS_ACCOUNT;
@@ -2130,10 +2230,15 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        } entry[] = {
                {"/File/Save as...", M_TARGET_EXIST},
                {"/File/Print..."  , M_TARGET_EXIST},
+               {"/File/Synchronise folders", M_WANT_SYNC},
                {"/File/Exit"      , M_UNLOCKED},
 
                {"/Edit/Select thread"             , M_SINGLE_TARGET_EXIST},
+               {"/Edit/Delete thread"             , M_SINGLE_TARGET_EXIST},
+               {"/Edit/Find in current message...", M_SINGLE_TARGET_EXIST},
 
+               {"/View/Set displayed columns/in Folder list..."
+                                                  , M_UNLOCKED}, 
                {"/View/Sort"                      , M_EXEC},
                {"/View/Thread view"               , M_EXEC},
                {"/View/Expand all threads"        , M_MSG_EXIST},
@@ -2149,9 +2254,9 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/View/Go to/Last read message"   , M_SINGLE_TARGET_EXIST},
                {"/View/Go to/Parent message"      , M_SINGLE_TARGET_EXIST},
                {"/View/Open in new window"        , M_SINGLE_TARGET_EXIST},
-               {"/View/Show all headers"          , M_SINGLE_TARGET_EXIST},
-               {"/View/Quotes"                    , M_SINGLE_TARGET_EXIST},
                {"/View/Message source"            , M_SINGLE_TARGET_EXIST},
+               {"/View/All headers"               , M_SINGLE_TARGET_EXIST},
+               {"/View/Quotes"                    , M_SINGLE_TARGET_EXIST},
 
                {"/Message/Receive/Get from current account"
                                                 , M_HAVE_ACCOUNT|M_UNLOCKED},
@@ -2175,6 +2280,10 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/Message/Mark"                  , M_TARGET_EXIST},
                {"/Message/Mark/Mark as spam"     , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
                {"/Message/Mark/Mark as ham"      , M_TARGET_EXIST|M_CAN_LEARN_SPAM},
+               {"/Message/Mark/Ignore thread"    , M_TARGET_EXIST},
+               {"/Message/Mark/Unignore thread"  , M_TARGET_EXIST},
+               {"/Message/Mark/Lock"             , M_TARGET_EXIST},
+               {"/Message/Mark/Unlock"           , M_TARGET_EXIST},
                {"/Message/Color label"           , M_TARGET_EXIST},
                {"/Message/Re-edit"               , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
 
@@ -2280,7 +2389,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
        if (mainwin->messageview 
        &&  mainwin->messageview->mimeview
        &&  mainwin->messageview->mimeview->textview)
-               SET_CHECK_MENU_ACTIVE("/View/Show all headers",
+               SET_CHECK_MENU_ACTIVE("/View/All headers",
                              mainwin->messageview->mimeview->textview->show_all_headers);
        SET_CHECK_MENU_ACTIVE("/View/Thread view", (state & M_THREADED) != 0);
        SET_CHECK_MENU_ACTIVE("/View/Quotes/Fold all", FALSE);
@@ -2390,15 +2499,17 @@ static gint mailing_list_populate_submenu (GtkWidget *menuitem, const gchar * li
                        item = NULL;
                        if (!g_strncasecmp(url_decoded, "mailto:", 7)) {
                                item = gtk_menu_item_new_with_label ((url_decoded));
-                               gtk_signal_connect (GTK_OBJECT(item), "activate",
-                                               GTK_SIGNAL_FUNC(mailing_list_compose), NULL);
+                               g_signal_connect(G_OBJECT(item), "activate",
+                                                G_CALLBACK(mailing_list_compose),
+                                                NULL);
                        }
                        else if (!g_strncasecmp (url_decoded, "http:", 5) ||
                                 !g_strncasecmp (url_decoded, "https:",6)) {
 
                                item = gtk_menu_item_new_with_label ((url_decoded));
-                               gtk_signal_connect (GTK_OBJECT(item), "activate",
-                                               GTK_SIGNAL_FUNC(mailing_list_open_uri), NULL);
+                               g_signal_connect(G_OBJECT(item), "activate",
+                                                G_CALLBACK(mailing_list_open_uri),
+                                                NULL);
                        } 
                        if (item) {
                                gtk_menu_append (GTK_MENU(menu), item);
@@ -2492,6 +2603,9 @@ static void mailing_list_compose (GtkWidget *w, gpointer *data)
        
 void main_window_popup(MainWindow *mainwin)
 {
+       if (!GTK_WIDGET_VISIBLE(GTK_WIDGET(mainwin->window)))
+               main_window_show(mainwin);
+
        gtkut_window_popup(mainwin->window);
 
        switch (mainwin->type) {
@@ -2594,7 +2708,7 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                
                folderwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
                gtk_window_set_title(GTK_WINDOW(folderwin),
-                                    _("Sylpheed-Claws - Folder View"));
+                                    _("Claws Mail - Folder View"));
 
                gtk_window_move(GTK_WINDOW(folderwin),
                                prefs_common.folderwin_x,
@@ -2630,7 +2744,7 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
                
                messagewin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
                gtk_window_set_title(GTK_WINDOW(messagewin),
-                                    _("Sylpheed-Claws - Message View"));
+                                    _("Claws Mail - Message View"));
                                     
                gtk_window_move(GTK_WINDOW(messagewin), 
                                prefs_common.main_msgwin_x,
@@ -3021,7 +3135,7 @@ static void print_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        if (prefs_common.confirm_on_exit) {
-               if (alertpanel(_("Exit"), _("Exit Sylpheed-Claws?"),
+               if (alertpanel(_("Exit"), _("Exit Claws Mail?"),
                               GTK_STOCK_CANCEL, GTK_STOCK_QUIT,  NULL)
                    != G_ALERTALTERNATE)
                        return;
@@ -3041,8 +3155,7 @@ static void search_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 
 static void mainwindow_quicksearch(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
-       prefs_common.show_searchbar = TRUE;
-       summaryview_activate_quicksearch(mainwin->summaryview);
+       summaryview_activate_quicksearch(mainwin->summaryview, TRUE);
 }
 
 static void toggle_folder_cb(MainWindow *mainwin, guint action,
@@ -3150,23 +3263,27 @@ static void toggle_work_offline_cb (MainWindow *mainwin, guint action, GtkWidget
        main_window_toggle_work_offline(mainwin, GTK_CHECK_MENU_ITEM(widget)->active, TRUE);
 }
 
-static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
+static gboolean any_folder_want_synchronise(void)
 {
        GList *folderlist = folder_get_list();
-       gboolean found = FALSE;
 
        /* see if there are synchronised folders */
        for (; folderlist; folderlist = folderlist->next) {
                Folder *folder = (Folder *)folderlist->data;
                if (folder_want_synchronise(folder)) {
-                       found = TRUE;
-                       break;
+                       return TRUE;
                }
        }
        
-       if (!found)
+       return FALSE;
+}
+
+static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
+{
+       
+       if (!any_folder_want_synchronise())
                return;
-               
+
        if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
                        _("Do you want to synchronise your folders now?"),
                        GTK_STOCK_CANCEL, _("+_Synchronise"), NULL) != G_ALERTALTERNATE)
@@ -3201,6 +3318,7 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
                mainwindow_check_synchronise(mainwin, TRUE);
                prefs_common.work_offline = TRUE;
                imap_disconnect_all();
+               hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
        } else {
                /*go online */
                if (!prefs_common.work_offline)
@@ -3211,6 +3329,7 @@ static void online_switch_clicked (GtkButton *btn, gpointer data)
                prefs_common.work_offline = FALSE;
                inc_autocheck_timer_set();
                refresh_resolvers();
+               hooks_invoke(OFFLINE_SWITCH_HOOKLIST, NULL);
        }
 }
 
@@ -3339,6 +3458,31 @@ static void mark_as_spam_cb(MainWindow *mainwin, guint action,
        summary_mark_as_spam(mainwin->summaryview, action, NULL);
 }
 
+static void ignore_thread_cb(MainWindow *mainwin, guint action,
+                           GtkWidget *widget)
+{
+       summary_ignore_thread(mainwin->summaryview);
+}
+
+static void unignore_thread_cb(MainWindow *mainwin, guint action,
+                           GtkWidget *widget)
+{
+       summary_unignore_thread(mainwin->summaryview);
+}
+
+static void lock_msgs_cb(MainWindow *mainwin, guint action,
+                           GtkWidget *widget)
+{
+       summary_msgs_lock(mainwin->summaryview);
+}
+
+static void unlock_msgs_cb(MainWindow *mainwin, guint action,
+                           GtkWidget *widget)
+{
+       summary_msgs_unlock(mainwin->summaryview);
+}
+
+
 static void reedit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        summary_reedit(mainwin->summaryview);
@@ -3506,7 +3650,10 @@ static void delete_duplicated_all_cb(MainWindow *mainwin, guint action,
 {
        struct DelDupsData data = {0, 0};
 
+       main_window_cursor_wait(mainwin);
        folder_func_to_all_folders(deldup_all, &data);
+       main_window_cursor_normal(mainwin);
+       
        alertpanel_notice(ngettext("Deleted %d duplicate message in %d folders.\n",
                                   "Deleted %d duplicate messages in %d folders.\n",
                                   data.dups),
@@ -3625,7 +3772,7 @@ static void goto_folder_cb(MainWindow *mainwin, guint action,
 static void goto_unread_folder_cb(MainWindow *mainwin, guint action,
                           GtkWidget *widget)
 {
-       folderview_select_next_unread(mainwin->folderview);
+       folderview_select_next_unread(mainwin->folderview, FALSE);
 }
 
 static void copy_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
@@ -3647,7 +3794,13 @@ static void allsel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 static void select_thread_cb(MainWindow *mainwin, guint action,
                             GtkWidget *widget)
 {
-       summary_select_thread(mainwin->summaryview);
+       summary_select_thread(mainwin->summaryview, FALSE);
+}
+
+static void delete_thread_cb(MainWindow *mainwin, guint action,
+                            GtkWidget *widget)
+{
+       summary_select_thread(mainwin->summaryview, TRUE);
 }
 
 static void create_filter_cb(MainWindow *mainwin, guint action,
@@ -3759,7 +3912,7 @@ static void account_compose_menu_cb(GtkMenuItem *menuitem, gpointer data)
        PrefsAccount *account = (PrefsAccount *)data;
        FolderItem *item = mainwin->summaryview->folder_item;   
 
-       compose_new_with_folderitem(account, item);
+       compose_new_with_folderitem(account, item, NULL);
 }
 
 static void prefs_open_cb(GtkMenuItem *menuitem, gpointer data)
@@ -3851,7 +4004,7 @@ gboolean mainwindow_key_pressed (GtkWidget *widget, GdkEventKey *event,
                            && mainwin->summaryview->folder_item->total_msgs == 0))) {
                        g_signal_stop_emission_by_name(G_OBJECT(widget), 
                                        "key_press_event");
-                       folderview_select_next_unread(mainwin->folderview);
+                       folderview_select_next_unread(mainwin->folderview, TRUE);
                }
                break;
        default:
@@ -3938,7 +4091,7 @@ void mainwindow_jump_to(const gchar *target)
                return;
                
        if (!mainwin) {
-               printf(_("not initialized\n"));
+               printf("not initialized\n");
                return;
        }
 
@@ -3950,7 +4103,7 @@ void mainwindow_jump_to(const gchar *target)
                *p = '\0';
 
        if ((item = folder_find_item_from_identifier(tmp))) {
-               printf(_("selecting folder '%s'\n"), tmp);
+               printf("selecting folder '%s'\n", tmp);
                folderview_select(mainwin->folderview, item);
                main_window_popup(mainwin);
                g_free(tmp);
@@ -3961,20 +4114,40 @@ void mainwindow_jump_to(const gchar *target)
        if (msg) {
                *msg++ = '\0';
                if ((item = folder_find_item_from_identifier(tmp))) {
-                       printf(_("selecting folder '%s'\n"), tmp);
+                       printf("selecting folder '%s'\n", tmp);
                        folderview_select(mainwin->folderview, item);
-               } 
+               } else {
+                       printf("'%s' not found\n", tmp);
+               }
                if (item && msg && atoi(msg)) {
-                       printf(_("selecting message %d\n"), atoi(msg));
+                       printf("selecting message %d\n", atoi(msg));
                        summary_select_by_msgnum(mainwin->summaryview, atoi(msg));
                        summary_display_msg_selected(mainwin->summaryview, FALSE);
                        main_window_popup(mainwin);
                        g_free(tmp);
                        return;
-               } 
+               } else if (item && msg[0] == '<' && msg[strlen(msg)-1] == '>') {
+                       MsgInfo *msginfo = NULL;
+                       msg++;
+                       msg[strlen(msg)-1] = '\0';
+                       msginfo = folder_item_get_msginfo_by_msgid(item, msg);
+                       if (msginfo) {
+                               printf("selecting message %s\n", msg);
+                               summary_select_by_msgnum(mainwin->summaryview, msginfo->msgnum);
+                               summary_display_msg_selected(mainwin->summaryview, FALSE);
+                               main_window_popup(mainwin);
+                               g_free(tmp);
+                               procmsg_msginfo_free(msginfo);
+                               return;
+                       } else {
+                               printf("'%s' not found\n", msg);
+                       }
+               } else {
+                       printf("'%s' not found\n", msg);
+               }
+       } else {
+               printf("'%s' not found\n", tmp);
        }
        
-       printf("'%s' not found\n", tmp);
-       
        g_free(tmp);
 }