2004-09-28 [colin] 0.9.12cvs110
[claws.git] / src / mainwindow.c
index 7d9fa15efb521127114df5e0ad8b4f8afe956520..17acb0b4d292d588ef586dfb84f2a50d484994be 100644 (file)
@@ -89,6 +89,7 @@
 #include "localfolder.h"
 #include "filtering.h"
 #include "folderutils.h"
+#include "foldersort.h"
 
 #define AC_LABEL_WIDTH 240
 
@@ -150,6 +151,9 @@ static void update_folderview_cb (MainWindow        *mainwin,
 static void add_mailbox_cb      (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
+static void foldersort_cb       (MainWindow    *mainwin,
+                                 guint          action,
+                                 GtkWidget     *widget);
 static void import_mbox_cb      (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
@@ -213,10 +217,6 @@ static void show_all_header_cb             (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
 
-static void reedit_cb                  (MainWindow     *mainwin,
-                                        guint           action,
-                                        GtkWidget      *widget);
-
 static void move_to_cb                 (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
@@ -247,6 +247,11 @@ static void mark_as_read_cb                (MainWindow     *mainwin,
 static void mark_all_read_cb           (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
+
+static void reedit_cb                  (MainWindow     *mainwin,
+                                        guint           action,
+                                        GtkWidget      *widget);
+
 static void add_address_cb             (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
@@ -430,6 +435,7 @@ 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/Change folder order"),      NULL, foldersort_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},
@@ -639,8 +645,6 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Message/_Forward"),              "<control><alt>F", main_window_reply_cb, COMPOSE_FORWARD, NULL},
        {N_("/_Message/Redirect"),              NULL, main_window_reply_cb, COMPOSE_REDIRECT, NULL},
        {N_("/_Message/---"),                   NULL, NULL, 0, "<Separator>"},
-       {N_("/_Message/Re-_edit"),              NULL, reedit_cb, 0, NULL},
-       {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},
@@ -654,6 +658,8 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {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/---"),                   NULL, NULL, 0, "<Separator>"},
+       {N_("/_Message/Re-_edit"),              NULL, reedit_cb, 0, NULL},
 
        {N_("/_Tools"),                         NULL, NULL, 0, "<Branch>"},
        {N_("/_Tools/_Address book..."),        "<shift><control>A", addressbook_open_cb, 0, NULL},
@@ -777,6 +783,7 @@ MainWindow *main_window_create(SeparateType type)
        GtkWidget *menuitem;
        gint i;
        guint n_menu_entries;
+       gboolean hide_messageview = FALSE;
 
        static GdkGeometry geometry;
 
@@ -973,7 +980,8 @@ MainWindow *main_window_create(SeparateType type)
        debug_print("done.\n");
 
        messageview->visible = prefs_common.msgview_visible;
-
+       hide_messageview = !messageview->visible;
+       
        main_window_set_widgets(mainwin, type);
 
        gtk_signal_connect(GTK_OBJECT(window), "size_allocate",
@@ -1010,14 +1018,6 @@ MainWindow *main_window_create(SeparateType type)
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem),
                                       prefs_common.show_statusbar);
        
-       gtk_widget_hide(GTK_WIDGET(mainwin->summaryview->hbox_search));
-       
-       if (prefs_common.show_searchbar) {
-               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainwin->summaryview->toggle_search), TRUE);
-               if (prefs_common.summary_quicksearch_type != S_SEARCH_EXTENDED)
-                       gtk_widget_hide(summaryview->search_description);
-       }
-
        /* set account selection menu */
        ac_menu = gtk_item_factory_get_widget
                (ifactory, "/Configuration/Change current account");
@@ -1036,7 +1036,7 @@ MainWindow *main_window_create(SeparateType type)
                (GTK_WINDOW(win),                       \
                 gtk_item_factory_from_widget(menu)->accel_group)                
        
-       ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu,mainwin->window);
+       ADD_MENU_ACCEL_GROUP_TO_WINDOW(summaryview->popupmenu, mainwin->window);
        
        /* connect the accelerators for equivalent 
           menu items in different menus             */
@@ -1073,6 +1073,9 @@ MainWindow *main_window_create(SeparateType type)
        if (prefs_common.work_offline)
                online_switch_clicked (GTK_BUTTON(online_switch), mainwin);
 
+       if (mainwin->type == SEPARATE_NONE && hide_messageview)
+               main_window_toggle_message_view(mainwin);
+
        return mainwin;
 }
 
@@ -1691,6 +1694,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/File/Add mailbox"                          , M_UNLOCKED},
 
                 {"/File/Add mailbox/MH..."                   , M_UNLOCKED},
+               {"/File/Change folder order"                  , M_UNLOCKED},
                {"/File/Export to mbox file..."               , M_UNLOCKED},
                {"/File/Empty trash"                          , M_UNLOCKED},
                {"/File/Work offline"                         , M_UNLOCKED},
@@ -1732,12 +1736,12 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/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/Re-edit"               , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
                {"/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/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},
 
                {"/Tools/Add sender to address book"   , M_SINGLE_TARGET_EXIST},
                {"/Tools/Harvest addresses"            , M_UNLOCKED},
@@ -2104,10 +2108,6 @@ static void main_window_set_widgets(MainWindow *mainwin, SeparateType type)
        else 
                gtk_widget_hide(mainwin->messageview->mimeview->ctree_mainbox);
 
-       /* rehide quick search if necessary */
-       if (!prefs_common.show_searchbar)
-               gtk_widget_hide(mainwin->summaryview->hbox_search);
-       
        mainwin->type = type;
 
 
@@ -2304,6 +2304,12 @@ static void update_folderview_cb(MainWindow *mainwin, guint action,
        folderview_check_new_all();
 }
 
+static void foldersort_cb(MainWindow *mainwin, guint action,
+                           GtkWidget *widget)
+{
+       foldersort_open();
+}
+
 static void import_mbox_cb(MainWindow *mainwin, guint action,
                           GtkWidget *widget)
 {
@@ -2551,11 +2557,6 @@ static void show_all_header_cb(MainWindow *mainwin, guint action,
                                     GTK_CHECK_MENU_ITEM(widget)->active);
 }
 
-static void reedit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
-{
-       summary_reedit(mainwin->summaryview);
-}
-
 static void mark_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        summary_mark(mainwin->summaryview);
@@ -2584,6 +2585,11 @@ static void mark_all_read_cb(MainWindow *mainwin, guint action,
        summary_mark_all_read(mainwin->summaryview);
 }
 
+static void reedit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
+{
+       summary_reedit(mainwin->summaryview);
+}
+
 static void add_address_cb(MainWindow *mainwin, guint action,
                           GtkWidget *widget)
 {