add global setting stuff for spelling checker; 'nother 20% done
[claws.git] / src / mainwindow.c
index f97d281f116e619d7037fc2385197f9dbc813283..8032f6b2528961b4baa586d23f7b532e6e4c3ee5 100644 (file)
@@ -75,6 +75,7 @@
 #include "about.h"
 #include "manual.h"
 
+
 #define AC_LABEL_WIDTH 240
 
 #define STATUSBAR_PUSH(mainwin, str) \
@@ -536,6 +537,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Summary/_Sort/Sort by _from"),   NULL, sort_summary_cb, SORT_BY_FROM, NULL},
        {N_("/_Summary/_Sort/Sort by _subject"),NULL, sort_summary_cb, SORT_BY_SUBJECT, NULL},
        {N_("/_Summary/_Sort/Sort by sco_re"),  NULL, sort_summary_cb, SORT_BY_SCORE, NULL},
+       {N_("/_Summary/_Sort/Sort by _label"),  NULL, sort_summary_cb, SORT_BY_LABEL, NULL},
        {N_("/_Summary/_Sort/---"),             NULL, NULL, 0, "<Separator>"},
        {N_("/_Summary/_Sort/_Attract by subject"),
                                                NULL, attract_by_subject_cb, 0, NULL},
@@ -568,7 +570,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
 
        {N_("/_Help"),                          NULL, NULL, 0, "<LastBranch>"},
        {N_("/_Help/_Manual"),                  NULL, NULL, 0, "<Branch>"},
-       {N_("/_Help/_Manual/_English"),         NULL, NULL, MANUAL_LANG_EN, NULL},
+       {N_("/_Help/_Manual/_English"),         NULL, manual_open_cb, MANUAL_LANG_EN, NULL},
        {N_("/_Help/_Manual/_Japanese"),        NULL, manual_open_cb, MANUAL_LANG_JA, NULL},
        {N_("/_Help/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_Help/_About"),                   NULL, about_show, 0, NULL}
@@ -591,8 +593,8 @@ MainWindow *main_window_create(SeparateType type)
        SummaryView *summaryview;
        MessageView *messageview;
        GdkColormap *colormap;
-       GdkColor color[5];
-       gboolean success[5];
+       GdkColor color[4];
+       gboolean success[4];
        guint n_menu_entries;
        GtkItemFactory *ifactory;
        GtkWidget *ac_menu;
@@ -699,14 +701,11 @@ MainWindow *main_window_create(SeparateType type)
        summaryview->color_dim.red = summaryview->color_dim.green =
                summaryview->color_dim.blue = COLOR_DIM;
 
-       summaryview->color_normal.red = summaryview->color_normal.green =
-               summaryview->color_normal.blue = 0;
-
        folderview->color_new.red = (guint16)55000;
        folderview->color_new.green = folderview->color_new.blue = 15000;
 
-       folderview->color_normal.red = folderview->color_normal.green =
-               folderview->color_normal.blue = 0;
+       gtkut_convert_int_to_gdk_color(prefs_common.tgt_folder_col,
+                                      &folderview->color_op);
 
        summaryview->color_important.red = 0;
        summaryview->color_marked.green = 0;
@@ -714,13 +713,12 @@ MainWindow *main_window_create(SeparateType type)
 
        color[0] = summaryview->color_marked;
        color[1] = summaryview->color_dim;
-       color[2] = summaryview->color_normal;
-       color[3] = folderview->color_new;
-       color[4] = folderview->color_normal;
+       color[2] = folderview->color_new;
+       color[3] = folderview->color_op;
 
        colormap = gdk_window_get_colormap(window->window);
-       gdk_colormap_alloc_colors(colormap, color, 5, FALSE, TRUE, success);
-       for (i = 0; i < 5; i++) {
+       gdk_colormap_alloc_colors(colormap, color, 4, FALSE, TRUE, success);
+       for (i = 0; i < 4; i++) {
                if (success[i] == FALSE)
                        g_warning(_("MainWindow: color allocation %d failed\n"), i);
        }
@@ -783,7 +781,6 @@ MainWindow *main_window_create(SeparateType type)
        */
        main_window_set_thread_option(mainwin);
 
-       menu_set_sensitive(ifactory, "/Help/Manual/English", FALSE);
 
        /* set account selection menu */
        ac_menu = gtk_item_factory_get_widget
@@ -807,17 +804,6 @@ MainWindow *main_window_create(SeparateType type)
        header_window_init(mainwin->headerwin);
        log_window_init(mainwin->logwin);
 
-       {
-               GtkStyle *newstyle;
-
-               gtk_widget_ensure_style(folderview->ctree);
-               newstyle = gtk_widget_get_style(folderview->ctree);
-               newstyle = gtk_style_copy(newstyle);
-               gtk_widget_set_style(summaryview->ctree, newstyle);
-               gtk_widget_ensure_style(summaryview->ctree);
-               gtk_widget_realize(summaryview->ctree);
-       }
-
        mainwin->cursor_count = 0;
 
        if (!watch_cursor)
@@ -1233,6 +1219,7 @@ void main_window_popup(MainWindow *mainwin)
        y %= sy; if (y < 0) y += sy;
        gdk_window_move(mainwin->window->window, x, y);
        gdk_window_raise(mainwin->window->window);
+       gdk_window_show(mainwin->window->window);
 
        debug_print("window position: x = %d, y = %d\n", x, y);
 
@@ -1268,6 +1255,7 @@ void main_window_popup(MainWindow *mainwin)
                gdk_window_raise(widget->window);
                break;
        default:
+               break;
        }
 }
 
@@ -1574,7 +1562,7 @@ static void main_window_toolbar_create(MainWindow *mainwin,
        
        CREATE_TOOLBAR_ICON(stock_mail_compose_xpm);
        compose_mail_btn_plain = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
-                                             _("Compose email"),
+                                             _("Email"),
                                              _("Compose an email message"),
                                              "New",
                                              icon_wid,
@@ -1585,7 +1573,7 @@ static void main_window_toolbar_create(MainWindow *mainwin,
 
        CREATE_TOOLBAR_ICON(stock_news_compose_xpm);
        compose_news_btn_plain = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
-                                             _("Compose news"),
+                                             _("News"),
                                              _("Compose a news message"),
                                              "New",
                                              icon_wid,
@@ -1701,11 +1689,11 @@ static void main_window_toolbar_create(MainWindow *mainwin,
                mainwin);
 
        gtk_signal_connect(GTK_OBJECT(compose_mail_btn), "clicked",
-               GTK_SIGNAL_FUNC(toolbar_compose_cb),
+               GTK_SIGNAL_FUNC(toolbar_compose_mail_cb),
                mainwin);
 
        gtk_signal_connect(GTK_OBJECT(compose_news_btn), "clicked",
-               GTK_SIGNAL_FUNC(toolbar_compose_cb),
+               GTK_SIGNAL_FUNC(toolbar_compose_news_cb),
                mainwin);
 
        mainwin->toolbar         = toolbar;
@@ -2164,7 +2152,7 @@ static void compose_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
                    && mainwin->summaryview->folder_item->folder->account->protocol == A_NNTP)
                        compose_new_with_recipient(mainwin->summaryview->folder_item->folder->account, mainwin->summaryview->folder_item->path);
                else
-                       compose_new(mainwin->summaryview->folder_item->folder->account);
+                       compose_new_with_folderitem(mainwin->summaryview->folder_item->folder->account, mainwin->summaryview->folder_item);
        }
        else
                compose_new(NULL);
@@ -2180,16 +2168,21 @@ static void compose_mail_cb(MainWindow *mainwin, guint action,
        if (mainwin->summaryview->folder_item) {
                ac = mainwin->summaryview->folder_item->folder->account;
                if (ac && ac->protocol != A_NNTP) {
-                       compose_new(ac);
+                       compose_new_with_folderitem(ac, mainwin->summaryview->folder_item);
                        return;
                }
        }
 
+       if(cur_account && (cur_account->protocol != A_NNTP)) {
+               compose_new_with_folderitem(cur_account, mainwin->summaryview->folder_item);
+               return;
+       }
+
        list = account_get_list();
        for(cur = list ; cur != NULL ; cur = g_list_next(cur)) {
                ac = (PrefsAccount *) cur->data;
                if (ac->protocol != A_NNTP) {
-                       compose_new(ac);
+                       compose_new_with_folderitem(ac, mainwin->summaryview->folder_item);
                        return;
                }
        }
@@ -2443,6 +2436,8 @@ static void update_summary_cb(MainWindow *mainwin, guint action,
        if (!mainwin->summaryview->folder_item) return;
        if (!folderview->opened) return;
 
+       folder_update_op_count();
+
        fitem = gtk_ctree_node_get_row_data(GTK_CTREE(folderview->ctree),
                                            folderview->opened);
        if (!fitem) return;