2005-08-06 [paul] 1.9.13cvs18
[claws.git] / src / mainwindow.c
index 5f6875081d21ee5fba9c37f581a51f6101548307..709387860ac170203f8ff3577bc6f65700895dfa 100644 (file)
@@ -65,6 +65,7 @@
 #include "prefs_filtering.h"
 #include "prefs_account.h"
 #include "prefs_summary_column.h"
+#include "prefs_folder_column.h"
 #include "prefs_template.h"
 #include "action.h"
 #include "account.h"
@@ -229,6 +230,9 @@ static void copy_to_cb                      (MainWindow     *mainwin,
 static void delete_cb                  (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
+static void delete_trash_cb                    (MainWindow     *mainwin,
+                                        guint           action,
+                                        GtkWidget      *widget);
 
 static void cancel_cb                   (MainWindow     *mainwin,
                                         guint           action,
@@ -281,7 +285,10 @@ static void collapse_threads_cb     (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 
-static void set_display_item_cb         (MainWindow    *mainwin,
+static void set_summary_display_item_cb         (MainWindow    *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
+static void set_folder_display_item_cb  (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 static void sort_summary_cb     (MainWindow    *mainwin,
@@ -363,9 +370,6 @@ static void create_processing_cb (MainWindow        *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 
-static void prefs_common_open_cb       (MainWindow     *mainwin,
-                                        guint           action,
-                                        GtkWidget      *widget);
 static void prefs_template_open_cb     (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
@@ -436,6 +440,9 @@ void main_window_reply_cb                   (MainWindow     *mainwin,
 gboolean mainwindow_progressindicator_hook     (gpointer        source,
                                                 gpointer        userdata);
 #define  SEPARATE_ACTION 500 
+static void mainwindow_quicksearch             (MainWindow     *mainwin, 
+                                                guint           action, 
+                                                GtkWidget      *widget);
 
 static GtkItemFactoryEntry mainwin_entries[] =
 {
@@ -468,6 +475,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Edit/_Find in current message..."),
                                                "<control>F", search_cb, 0, NULL},
        {N_("/_Edit/_Search folder..."),        "<shift><control>F", search_cb, 1, NULL},
+       {N_("/_Edit/_Quick search"),            "slash", mainwindow_quicksearch, 0, NULL},
        {N_("/_View"),                          NULL, NULL, 0, "<Branch>"},
        {N_("/_View/Show or hi_de"),            NULL, NULL, 0, "<Branch>"},
        {N_("/_View/Show or hi_de/_Folder tree"),
@@ -516,7 +524,9 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_View/E_xpand all threads"),      NULL, expand_threads_cb, 0, NULL},
        {N_("/_View/Co_llapse all threads"),    NULL, collapse_threads_cb, 0, NULL},
        {N_("/_View/_Hide read messages"),      NULL, hide_read_messages, 0, "<ToggleItem>"},
-       {N_("/_View/Set displayed _items..."),  NULL, set_display_item_cb, 0, NULL},
+       {N_("/_View/Set displayed columns"),    NULL, NULL, 0, "<Branch>"},
+       {N_("/_View/Set displayed columns/in Folder list..."),  NULL, set_folder_display_item_cb, 0, NULL},
+       {N_("/_View/Set displayed columns/in Message list..."),NULL, set_summary_display_item_cb, 0, NULL},
 
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_View/_Go to"),                   NULL, NULL, 0, "<Branch>"},
@@ -579,6 +589,12 @@ static GtkItemFactoryEntry mainwin_entries[] =
         ENC_ACTION(C_ISO_8859_7)},
        ENC_SEPARATOR,
 
+       {N_("/_View/Character _encoding/Hebrew (ISO-8859-_8)"),
+        ENC_ACTION(C_ISO_8859_8)},
+       {N_("/_View/Character _encoding/Hebrew (Windows-1255)"),
+        ENC_ACTION(C_CP1255)},
+       ENC_SEPARATOR,
+
        {N_("/_View/Character _encoding/Turkish (ISO-8859-_9)"),
         ENC_ACTION(C_ISO_8859_9)},
        ENC_SEPARATOR,
@@ -678,7 +694,8 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/M_ove..."),              "<control>O", move_to_cb, 0, NULL},
        {N_("/_Message/_Copy..."),              "<shift><control>O", copy_to_cb, 0, NULL},
-       {N_("/_Message/_Delete"),               "<control>D", delete_cb,  0, NULL},
+       {N_("/_Message/Move to _trash"),        "<control>D", delete_trash_cb,  0, NULL},
+       {N_("/_Message/_Delete..."),            NULL, delete_cb,  0, NULL},
        {N_("/_Message/Cancel a news message"), "", cancel_cb,  0, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
        {N_("/_Message/_Mark"),                 NULL, NULL, 0, "<Branch>"},
@@ -880,14 +897,19 @@ MainWindow *main_window_create(SeparateType type)
        menu_set_sensitive(ifactory, "/Help/Manual (Local)", manual_available(MANUAL_MANUAL_LOCAL));
        menu_set_sensitive(ifactory, "/Help/FAQ (Local)", manual_available(MANUAL_FAQ_LOCAL));
 
-       handlebox = gtk_handle_box_new();
-       gtk_widget_show(handlebox);
-       gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
-       g_signal_connect(G_OBJECT(handlebox), "child_attached",
-                        G_CALLBACK(toolbar_child_attached), mainwin);
-       g_signal_connect(G_OBJECT(handlebox), "child_detached",
-                        G_CALLBACK(toolbar_child_detached), mainwin);
-
+       if (prefs_common.toolbar_detachable) {
+               handlebox = gtk_handle_box_new();
+               gtk_widget_show(handlebox);
+               gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
+               g_signal_connect(G_OBJECT(handlebox), "child_attached",
+                                G_CALLBACK(toolbar_child_attached), mainwin);
+               g_signal_connect(G_OBJECT(handlebox), "child_detached",
+                                G_CALLBACK(toolbar_child_detached), mainwin);
+       } else {
+               handlebox = gtk_hbox_new(FALSE, 0);
+               gtk_widget_show(handlebox);
+               gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
+       }
        /* link window to mainwin->window to avoid gdk warnings */
        mainwin->window       = window;
        
@@ -1202,13 +1224,16 @@ static void main_window_menu_callback_unblock(MainWindow *mainwin)
                mainwin->menu_lock_count--;
 }
 
+static guint prefs_tag = 0;
+
 void main_window_reflect_prefs_all(void)
 {
        main_window_reflect_prefs_all_real(FALSE);
 }
 
-void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
+static gboolean reflect_prefs_timeout_cb(gpointer data) 
 {
+       gboolean pixmap_theme_changed = GPOINTER_TO_INT(data);
        GList *cur;
        MainWindow *mainwin;
        GtkWidget *pixmap;
@@ -1246,9 +1271,20 @@ void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
                                          prefs_common.display_header_pane);
 
                textview_reflect_prefs(mainwin->messageview->mimeview->textview);
-
+               folderview_reflect_prefs();
+               summary_reflect_prefs();
                summary_redisplay_msg(mainwin->summaryview);
        }
+       prefs_tag = 0;
+       return FALSE;
+}
+
+void main_window_reflect_prefs_all_real(gboolean pixmap_theme_changed)
+{
+       if (prefs_tag == 0 || pixmap_theme_changed) {
+               prefs_tag = g_timeout_add(500, reflect_prefs_timeout_cb, 
+                                               GINT_TO_POINTER(pixmap_theme_changed));
+       }
 }
 
 void main_window_set_summary_column(void)
@@ -1262,6 +1298,17 @@ void main_window_set_summary_column(void)
        }
 }
 
+void main_window_set_folder_column(void)
+{
+       GList *cur;
+       MainWindow *mainwin;
+
+       for (cur = mainwin_list; cur != NULL; cur = cur->next) {
+               mainwin = (MainWindow *)cur->data;
+               folderview_set_column_order(mainwin->folderview);
+       }
+}
+
 static void main_window_set_account_selector_menu(MainWindow *mainwin,
                                                  GList *account_list)
 {
@@ -1653,7 +1700,7 @@ void main_window_add_mailbox(MainWindow *mainwin)
                            "Mail");
        if (!path) return;
        if (folder_find_from_path(path)) {
-               alertpanel_error(_("The mailbox `%s' already exists."), path);
+               alertpanel_error(_("The mailbox '%s' already exists."), path);
                g_free(path);
                return;
        }
@@ -1795,19 +1842,25 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
 
                {"/Message/Compose a news message", M_HAVE_NEWS_ACCOUNT},
                {"/Message/Reply"                 , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
-               {"/Message/Reply to"             , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
+               {"/Message/Reply to"              , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
                {"/Message/Follow-up and reply to", M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST|M_NEWS},
                {"/Message/Forward"               , M_HAVE_ACCOUNT|M_TARGET_EXIST},
                {"/Message/Redirect"              , M_HAVE_ACCOUNT|M_SINGLE_TARGET_EXIST},
                {"/Message/Move..."               , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
                {"/Message/Copy..."               , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
-               {"/Message/Delete"                , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED|M_NOT_NEWS},
+               {"/Message/Move to trash"         , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED|M_NOT_NEWS},
+               {"/Message/Delete..."             , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED|M_NOT_NEWS},
                {"/Message/Cancel a news message" , M_TARGET_EXIST|M_ALLOW_DELETE|M_UNLOCKED|M_NEWS},
                {"/Message/Mark"                  , M_TARGET_EXIST},
-               {"/Message/Re-edit"              , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
+               {"/Message/Re-edit"               , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
 
                {"/Tools/Add sender to address book"   , M_SINGLE_TARGET_EXIST},
                {"/Tools/Harvest addresses"            , M_UNLOCKED},
+               {"/Tools/Harvest addresses/from Folder..."       
+                                                      , M_UNLOCKED|M_MSG_EXIST},
+               {"/Tools/Harvest addresses/from Messages..."
+                                                      , M_UNLOCKED|M_MSG_EXIST|M_TARGET_EXIST},
+               {"/Tools/Harvest addresses"            , M_UNLOCKED},
                {"/Tools/Filter all messages in folder", M_MSG_EXIST|M_EXEC|M_UNLOCKED},
                {"/Tools/Filter selected messages"     , M_TARGET_EXIST|M_EXEC|M_UNLOCKED},
                {"/Tools/Create filter rule"           , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
@@ -2472,6 +2525,12 @@ static void search_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
                message_search(mainwin->messageview);
 }
 
+static void mainwindow_quicksearch(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+       prefs_common.show_searchbar = TRUE;
+       quicksearch_show(mainwin->summaryview->quicksearch);
+}
+
 static void toggle_folder_cb(MainWindow *mainwin, guint action,
                             GtkWidget *widget)
 {
@@ -2643,6 +2702,11 @@ static void delete_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
        summary_delete(mainwin->summaryview);
 }
 
+static void delete_trash_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+       summary_delete_trash(mainwin->summaryview);
+}
+
 static void cancel_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        summary_cancel(mainwin->summaryview);
@@ -2663,6 +2727,8 @@ static void show_all_header_cb(MainWindow *mainwin, guint action,
                               GtkWidget *widget)
 {
        if (mainwin->menu_lock_count) return;
+       mainwin->summaryview->messageview->all_headers = 
+                       GTK_CHECK_MENU_ITEM(widget)->active;
        summary_display_msg_selected(mainwin->summaryview,
                                     GTK_CHECK_MENU_ITEM(widget)->active);
 }
@@ -2771,12 +2837,18 @@ static void collapse_threads_cb(MainWindow *mainwin, guint action,
        summary_collapse_threads(mainwin->summaryview);
 }
 
-static void set_display_item_cb(MainWindow *mainwin, guint action,
+static void set_summary_display_item_cb(MainWindow *mainwin, guint action,
                                GtkWidget *widget)
 {
        prefs_summary_column_open();
 }
 
+static void set_folder_display_item_cb(MainWindow *mainwin, guint action,
+                               GtkWidget *widget)
+{
+       prefs_folder_column_open();
+}
+
 static void sort_summary_cb(MainWindow *mainwin, guint action,
                            GtkWidget *widget)
 {
@@ -2992,12 +3064,6 @@ static void create_processing_cb(MainWindow *mainwin, guint action,
        summary_filter_open(mainwin->summaryview, (PrefsFilterType)action, 1);
 }
 
-static void prefs_common_open_cb(MainWindow *mainwin, guint action,
-                                GtkWidget *widget)
-{
-       /* prefs_common_open(); */
-}
-
 static void prefs_pre_processing_open_cb(MainWindow *mainwin, guint action,
                                         GtkWidget *widget)
 {