2006-01-23 [paul] 1.9.100cvs181
[claws.git] / src / mainwindow.c
index 0709294a7eaa506b117a409a67a112049ce2bfc7..b9a038ec433871ff2bc0fc0671f776fab2cda00a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws 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
@@ -455,7 +455,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {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/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},
@@ -490,14 +490,16 @@ static GtkItemFactoryEntry mainwin_entries[] =
                                                "V", toggle_message_cb, 0, "<ToggleItem>"},
        {N_("/_View/Show or hi_de/_Toolbar"),
                                                NULL, NULL, 0, "<Branch>"},
-       {N_("/_View/Show or hi_de/_Toolbar/Icon _and text"),
+       {N_("/_View/Show or hi_de/_Toolbar/Text _below icons"),
                                                NULL, toggle_toolbar_cb, TOOLBAR_BOTH, "<RadioItem>"},
-       {N_("/_View/Show or hi_de/_Toolbar/_Icon"),
-                                               NULL, toggle_toolbar_cb, TOOLBAR_ICON, "/View/Show or hide/Toolbar/Icon and text"},
-       {N_("/_View/Show or hi_de/_Toolbar/_Text"),
-                                               NULL, toggle_toolbar_cb, TOOLBAR_TEXT, "/View/Show or hide/Toolbar/Icon and text"},
-       {N_("/_View/Show or hi_de/_Toolbar/_None"),
-                                               NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Show or hide/Toolbar/Icon and text"},
+       {N_("/_View/Show or hi_de/_Toolbar/Text be_side icons"),
+                                               NULL, toggle_toolbar_cb, TOOLBAR_BOTH_HORIZ, "/View/Show or hide/Toolbar/Text below icons"},
+       {N_("/_View/Show or hi_de/_Toolbar/_Icons only"),
+                                               NULL, toggle_toolbar_cb, TOOLBAR_ICON, "/View/Show or hide/Toolbar/Text below icons"},
+       {N_("/_View/Show or hi_de/_Toolbar/_Text only"),
+                                               NULL, toggle_toolbar_cb, TOOLBAR_TEXT, "/View/Show or hide/Toolbar/Text below icons"},
+       {N_("/_View/Show or hi_de/_Toolbar/_Hide"),
+                                               NULL, toggle_toolbar_cb, TOOLBAR_NONE, "/View/Show or hide/Toolbar/Text below icons"},
        {N_("/_View/Show or hi_de/Status _bar"),
                                                NULL, toggle_statusbar_cb, 0, "<ToggleItem>"},
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
@@ -536,23 +538,23 @@ static GtkItemFactoryEntry mainwin_entries[] =
 
        {N_("/_View/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_View/_Go to"),                   NULL, NULL, 0, "<Branch>"},
-       {N_("/_View/_Go to/_Prev message"),     "P", prev_cb, 0, NULL},
+       {N_("/_View/_Go to/_Previous message"), "P", prev_cb, 0, NULL},
        {N_("/_View/_Go to/_Next message"),     "N", next_cb, 0, NULL},
        {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/P_rev unread message"),
+       {N_("/_View/_Go to/P_revious unread message"),
                                                "<shift>P", prev_unread_cb, 0, NULL},
        {N_("/_View/_Go to/N_ext unread message"),
                                                "<shift>N", next_unread_cb, 0, NULL},
        {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/Prev ne_w message"), NULL, prev_new_cb, 0, NULL},
+       {N_("/_View/_Go to/Previous ne_w message"),     NULL, prev_new_cb, 0, NULL},
        {N_("/_View/_Go to/Ne_xt new message"), NULL, next_new_cb, 0, NULL},
        {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/Prev _marked message"),
+       {N_("/_View/_Go to/Previous _marked message"),
                                                NULL, prev_marked_cb, 0, NULL},
        {N_("/_View/_Go to/Next m_arked message"),
                                                NULL, next_marked_cb, 0, NULL},
        {N_("/_View/_Go to/---"),               NULL, NULL, 0, "<Separator>"},
-       {N_("/_View/_Go to/Prev _labeled message"),
+       {N_("/_View/_Go to/Previous _labeled message"),
                                                NULL, prev_labeled_cb, 0, NULL},
        {N_("/_View/_Go to/Next la_beled message"),
                                                NULL, next_labeled_cb, 0, NULL},
@@ -794,9 +796,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Configuration/Plu_gins..."),     NULL, plugins_open_cb, 0, NULL},
 
        {N_("/_Help"),                          NULL, NULL, 0, "<Branch>"},
-#if 0 /* waiting for the new manual to be finished */
        {N_("/_Help/_Manual"),                  NULL, manual_open_cb, MANUAL_MANUAL_LOCAL, NULL},
-#endif
        {N_("/_Help/_Online User-contributed FAQ"),     
                                                NULL, manual_open_cb, MANUAL_FAQ_CLAWS, NULL},
        {N_("/_Help/Icon _Legend"),             NULL, legend_open_cb, 0, NULL},
@@ -902,9 +902,7 @@ MainWindow *main_window_create(SeparateType type)
        gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
        ifactory = gtk_item_factory_from_widget(menubar);
 
-#if 0 /* waiting for the new manual to be finished */
        menu_set_sensitive(ifactory, "/Help/Manual", manual_available(MANUAL_MANUAL_LOCAL));
-#endif
 
        if (prefs_common.toolbar_detachable) {
                handlebox = gtk_handle_box_new();
@@ -1072,19 +1070,24 @@ MainWindow *main_window_create(SeparateType type)
        switch (prefs_common.toolbar_style) {
        case TOOLBAR_NONE:
                menuitem = gtk_item_factory_get_item
-                       (ifactory, "/View/Show or hide/Toolbar/None");
+                       (ifactory, "/View/Show or hide/Toolbar/Hide");
                break;
        case TOOLBAR_ICON:
                menuitem = gtk_item_factory_get_item
-                       (ifactory, "/View/Show or hide/Toolbar/Icon");
+                       (ifactory, "/View/Show or hide/Toolbar/Icons only");
                break;
        case TOOLBAR_TEXT:
                menuitem = gtk_item_factory_get_item
-                       (ifactory, "/View/Show or hide/Toolbar/Text");
+                       (ifactory, "/View/Show or hide/Toolbar/Text only");
                break;
        case TOOLBAR_BOTH:
                menuitem = gtk_item_factory_get_item
-                       (ifactory, "/View/Show or hide/Toolbar/Icon and text");
+                       (ifactory, "/View/Show or hide/Toolbar/Text below icons");
+               break;
+       case TOOLBAR_BOTH_HORIZ:
+               menuitem = gtk_item_factory_get_item
+                       (ifactory,
+                        "/View/Show or hide/Toolbar/Text beside icons");
        }
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), TRUE);
 
@@ -1381,6 +1384,42 @@ static void main_window_set_account_receive_menu(MainWindow *mainwin,
        }
 }
 
+static void main_window_set_toolbar_combo_receive_menu(MainWindow *mainwin,
+                                                      GList *account_list)
+{
+       GList *cur_ac, *cur_item;
+       GtkWidget *menuitem;
+       PrefsAccount *ac_prefs;
+       GtkWidget *menu = NULL;
+
+       if (mainwin->toolbar->getall_btn == NULL
+       ||  mainwin->toolbar->getall_combo == NULL) /* button doesn't exist */
+               return;
+
+       menu = mainwin->toolbar->getall_combo->menu;
+
+       /* destroy all previous menu item */
+       cur_item = GTK_MENU_SHELL(menu)->children;
+       while (cur_item != NULL) {
+               GList *next = cur_item->next;
+               gtk_widget_destroy(GTK_WIDGET(cur_item->data));
+               cur_item = next;
+       }
+
+       for (cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
+               ac_prefs = (PrefsAccount *)cur_ac->data;
+
+               menuitem = gtk_menu_item_new_with_label
+                       (ac_prefs->account_name
+                        ? ac_prefs->account_name : _("Untitled"));
+               gtk_widget_show(menuitem);
+               gtk_menu_append(GTK_MENU(menu), menuitem);
+               g_signal_connect(G_OBJECT(menuitem), "activate",
+                                G_CALLBACK(account_receive_menu_cb),
+                                ac_prefs);
+       }
+}
+
 void main_window_set_account_menu(GList *account_list)
 {
        GList *cur;
@@ -1390,6 +1429,18 @@ void main_window_set_account_menu(GList *account_list)
                mainwin = (MainWindow *)cur->data;
                main_window_set_account_selector_menu(mainwin, account_list);
                main_window_set_account_receive_menu(mainwin, account_list);
+               main_window_set_toolbar_combo_receive_menu(mainwin, account_list);
+       }
+}
+
+void main_window_set_account_menu_only_toolbar(GList *account_list)
+{
+       GList *cur;
+       MainWindow *mainwin;
+
+       for (cur = mainwin_list; cur != NULL; cur = cur->next) {
+               mainwin = (MainWindow *)cur->data;
+               main_window_set_toolbar_combo_receive_menu(mainwin, account_list);
        }
 }
 
@@ -1665,8 +1716,8 @@ void main_window_empty_trash(MainWindow *mainwin, gboolean confirm)
        if (confirm) {
                if (alertpanel(_("Empty trash"),
                               _("Delete all messages in trash folders?"),
-                              GTK_STOCK_YES, GTK_STOCK_NO, NULL)
-                   != G_ALERTDEFAULT)
+                              GTK_STOCK_CANCEL, _("+_Empty trash"), NULL)
+                   != G_ALERTALTERNATE)
                        return;
                manage_window_focus_in(mainwin->window, NULL, NULL);
        }
@@ -1808,13 +1859,13 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/View/Expand all threads"        , M_MSG_EXIST},
                {"/View/Collapse all threads"      , M_MSG_EXIST},
                {"/View/Hide read messages"        , M_HIDE_READ_MSG},
-               {"/View/Go to/Prev message"        , M_MSG_EXIST},
+               {"/View/Go to/Previous message"        , M_MSG_EXIST},
                {"/View/Go to/Next message"        , M_MSG_EXIST},
-               {"/View/Go to/Prev unread message" , M_MSG_EXIST},
-               {"/View/Go to/Prev new message"    , M_MSG_EXIST},
-               {"/View/Go to/Prev marked message" , M_MSG_EXIST},
+               {"/View/Go to/Previous unread message" , M_MSG_EXIST},
+               {"/View/Go to/Previous new message"    , M_MSG_EXIST},
+               {"/View/Go to/Previous marked message" , M_MSG_EXIST},
                {"/View/Go to/Next marked message" , M_MSG_EXIST},
-               {"/View/Go to/Prev labeled message", M_MSG_EXIST},
+               {"/View/Go to/Previous labeled message", M_MSG_EXIST},
                {"/View/Go to/Next labeled message", M_MSG_EXIST},
                {"/View/Open in new window"        , M_SINGLE_TARGET_EXIST},
                {"/View/Show all headers"          , M_SINGLE_TARGET_EXIST},
@@ -1942,7 +1993,10 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                menu_set_sensitive(ifactory, "/View/Sort/Descending", FALSE);
        }
 
-       SET_CHECK_MENU_ACTIVE("/View/Show all headers",
+       if (mainwin->messageview 
+       &&  mainwin->messageview->mimeview
+       &&  mainwin->messageview->mimeview->textview)
+               SET_CHECK_MENU_ACTIVE("/View/Show all headers",
                              mainwin->messageview->mimeview->textview->show_all_headers);
        SET_CHECK_MENU_ACTIVE("/View/Thread view", (state & M_THREADED) != 0);
 
@@ -2483,8 +2537,8 @@ static void app_exit_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        if (prefs_common.confirm_on_exit) {
                if (alertpanel(_("Exit"), _("Exit Sylpheed-Claws?"),
-                              GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL)
-                   != G_ALERTDEFAULT)
+                              GTK_STOCK_CANCEL, GTK_STOCK_OK,  NULL)
+                   != G_ALERTALTERNATE)
                        return;
                manage_window_focus_in(mainwin->window, NULL, NULL);
        }
@@ -2636,7 +2690,7 @@ static void mainwindow_check_synchronise(MainWindow *mainwin, gboolean ask)
                
        if (offline_ask_sync && ask && alertpanel(_("Folder synchronisation"),
                        _("Do you want to synchronise your folders now?"),
-                       GTK_STOCK_YES, GTK_STOCK_NO, NULL) != G_ALERTDEFAULT)
+                       GTK_STOCK_CANCEL, _("_Synchronise"), NULL) != G_ALERTALTERNATE)
                return;
 
        folder_synchronise(NULL);