2005-02-21 [colin] 1.0.1cvs15.4
[claws.git] / src / prefs_common.c
index 910bff44c7d6b6913701c011d3a182ce6b895388..0faf4cbddd6457339c9ae2d6f2aec2766cf324a7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2004 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 Hiroyuki Yamamoto
  *
  * 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
@@ -24,6 +24,7 @@
 #include "defs.h"
 
 #include <glib.h>
+#include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #include <stdio.h>
@@ -34,7 +35,6 @@
 #include <sys/stat.h>
 #include <errno.h>
 
-#include "intl.h"
 #include "main.h"
 #include "prefs_gtk.h"
 #include "prefs_common.h"
 #include "folderview.h"
 #include "stock_pixmap.h"
 #include "quote_fmt.h"
+#include "prefswindow.h"
+
+enum {
+       DATEFMT_FMT,
+       DATEFMT_TXT,
+       N_DATEFMT_COLUMNS
+};
 
 PrefsCommon prefs_common;
 
-static PrefsDialog dialog;
+GtkWidget *notebook;
 
 static struct Receive {
        GtkWidget *checkbtn_incext;
@@ -142,7 +149,6 @@ static struct Message {
        GtkWidget *chkbtn_disphdr;
        GtkWidget *spinbtn_linespc;
        GtkObject *spinbtn_linespc_adj;
-       GtkWidget *chkbtn_headspc;
 
        GtkWidget *chkbtn_smoothscroll;
        GtkWidget *spinbtn_scrollstep;
@@ -373,7 +379,7 @@ static PrefParam param[] = {
        /* new fonts */
        {"widget_font_gtk2",    NULL,
          &prefs_common.widgetfont,             P_STRING, NULL, NULL, NULL},
-       {"message_font_gtk2",   "fixed 9",
+       {"message_font_gtk2",   "Monospace 9",
         &prefs_common.textfont,                P_STRING, NULL, NULL, NULL},
        {"small_font_gtk2",     "Sans 9",
          &prefs_common.smallfont,              P_STRING, NULL, NULL, NULL},
@@ -592,9 +598,6 @@ static PrefParam param[] = {
        {"line_space", "2", &prefs_common.line_space, P_INT,
         &message.spinbtn_linespc,
         prefs_set_data_from_spinbtn, prefs_set_spinbtn},
-       {"enable_head_space", "FALSE", &prefs_common.head_space, P_BOOL,
-        &message.chkbtn_headspc,
-        prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"enable_smooth_scroll", "FALSE",
         &prefs_common.enable_smooth_scroll, P_BOOL,
@@ -701,6 +704,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"summary_quicksearch_sticky", "1", &prefs_common.summary_quicksearch_sticky, P_INT,
         NULL, NULL, NULL},
+       {"summary_quicksearch_recurse", "1", &prefs_common.summary_quicksearch_recurse, P_INT,
+        NULL, NULL, NULL},
 
        {"io_timeout_secs", "60", &prefs_common.io_timeout_secs,
         P_INT, &other.spinbtn_iotimeout,
@@ -750,11 +755,10 @@ static gboolean date_format_on_delete             (GtkWidget      *dialogwidget,
                                                 GtkWidget     **widget);
 static void date_format_entry_on_change                (GtkEditable    *editable,
                                                 GtkLabel       *example);
-static void date_format_select_row             (GtkWidget      *date_format_list,
-                                                gint            row,
-                                                gint            column,
-                                                GdkEventButton *event,
-                                                GtkWidget      *date_format);
+static void date_format_select_row             (GtkTreeView *list_view,
+                                                GtkTreePath *path,
+                                                GtkTreeViewColumn *column,
+                                                GtkWidget *date_format);
 static GtkWidget *date_format_create            (GtkButton      *button,
                                                  void           *data);
 
@@ -768,19 +772,67 @@ static gboolean prefs_keybind_key_pressed (GtkWidget      *widget,
 static void prefs_keybind_cancel               (void);
 static void prefs_keybind_apply_clicked                (GtkWidget      *widget);
 
-static gint prefs_common_deleted       (GtkWidget      *widget,
-                                        GdkEventAny    *event,
-                                        gpointer        data);
-static gboolean prefs_common_key_pressed(GtkWidget     *widget,
-                                        GdkEventKey    *event,
-                                        gpointer        data);
-static void prefs_common_ok            (void);
 static void prefs_common_apply         (void);
-static void prefs_common_cancel                (void);
+
+typedef struct CommonPage
+{
+        PrefsPage page;
+        GtkWidget *vbox;
+} CommonPage;
+
+static CommonPage common_page;
+
+static void create_widget_func(PrefsPage * _page,
+                                           GtkWindow * window,
+                                           gpointer data)
+{
+       CommonPage *page = (CommonPage *) _page;
+       GtkWidget *vbox;
+
+       vbox = gtk_vbox_new(FALSE, 6);
+       gtk_widget_show(vbox);
+
+       if (notebook == NULL)
+               prefs_common_create();
+       gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
+       gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);
+
+       prefs_set_dialog(param);
+
+       page->vbox = vbox;
+
+       page->page.widget = vbox;
+}
+
+static void destroy_widget_func(PrefsPage *_page)
+{
+       CommonPage *page = (CommonPage *) _page;
+
+       gtk_container_remove(GTK_CONTAINER (page->vbox), notebook);
+}
+
+static void save_func(PrefsPage * _page)
+{
+       prefs_common_apply();
+}
 
 void prefs_common_init(void) 
 {
+        static gchar *path[2];
+
        prefs_common.disphdr_list = NULL;
+            
+        path[0] = _("Common");
+        path[2] = NULL;
+        
+        common_page.page.path = path;
+       common_page.page.weight = 1000.0;
+        common_page.page.create_widget = create_widget_func;
+        common_page.page.destroy_widget = destroy_widget_func;
+        common_page.page.save_page = save_func;
+
+        prefs_gtk_register_page((PrefsPage *) &common_page);
 }
 
 PrefsCommon *prefs_common_get(void)
@@ -820,8 +872,12 @@ GList *prefs_common_read_history(const gchar *history)
 
 void prefs_common_read_config(void)
 {
-       prefs_read_config(param, "Common", COMMON_RC);
-
+       gchar *rcpath;
+       
+       rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
+       prefs_read_config(param, "Common", rcpath, NULL);
+       g_free(rcpath);
+       
        prefs_common.mime_open_cmd_history =
                prefs_common_read_history(COMMAND_HISTORY);
        prefs_common.summary_quicksearch_history =
@@ -864,68 +920,41 @@ void prefs_common_write_config(void)
                prefs_common.summary_quicksearch_history);
 }
 
-void prefs_common_open(void)
-{
-       if (prefs_rc_is_readonly(COMMON_RC))
-               return;
-
-       inc_lock();
-
-       if (!dialog.window) {
-               prefs_common_create();
-       }
-
-       manage_window_set_transient(GTK_WINDOW(dialog.window));
-       gtk_notebook_set_current_page(GTK_NOTEBOOK(dialog.notebook), 0);
-       gtk_widget_grab_focus(dialog.ok_btn);
-
-       prefs_set_dialog(param);
-
-       gtk_widget_show(dialog.window);
-}
-
 static void prefs_common_create(void)
 {
        gint page = 0;
 
        debug_print("Creating common preferences window...\n");
 
-       prefs_dialog_create(&dialog);
-       gtk_window_set_title (GTK_WINDOW(dialog.window),
-                             _("Common Preferences"));
-       g_signal_connect (G_OBJECT(dialog.window), "delete_event",
-                         G_CALLBACK(prefs_common_deleted), NULL);
-       g_signal_connect (G_OBJECT(dialog.window), "key_press_event",
-                         G_CALLBACK(prefs_common_key_pressed), NULL);
-       MANAGE_WINDOW_SIGNALS_CONNECT(dialog.window);
-
-       g_signal_connect (G_OBJECT(dialog.ok_btn), "clicked",
-                         G_CALLBACK(prefs_common_ok), NULL);
-       g_signal_connect (G_OBJECT(dialog.apply_btn), "clicked",
-                         G_CALLBACK(prefs_common_apply), NULL);
-       g_signal_connect_swapped(G_OBJECT(dialog.cancel_btn), "clicked",
-                                G_CALLBACK(prefs_common_cancel),
-                                G_OBJECT(dialog.window));
+       notebook = gtk_notebook_new ();
+       gtk_widget_show(notebook);
+       gtk_container_set_border_width (GTK_CONTAINER (notebook), 2);
+       /* GTK_WIDGET_UNSET_FLAGS (notebook, GTK_CAN_FOCUS); */
+       gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
+       
+       gtk_notebook_popup_enable (GTK_NOTEBOOK (notebook));
+
+       gtk_widget_ref(notebook);
 
        /* create all widgets on notebook */
        prefs_receive_create();
-       SET_NOTEBOOK_LABEL(dialog.notebook, _("Receive"),   page++);
+       SET_NOTEBOOK_LABEL(notebook, _("Receive"),   page++);
        prefs_send_create();
-       SET_NOTEBOOK_LABEL(dialog.notebook, _("Send"),      page++);
+       SET_NOTEBOOK_LABEL(notebook, _("Send"),      page++);
        prefs_compose_create();
-       SET_NOTEBOOK_LABEL(dialog.notebook, _("Compose"),   page++);
+       SET_NOTEBOOK_LABEL(notebook, _("Compose"),   page++);
        prefs_quote_create();
-       SET_NOTEBOOK_LABEL(dialog.notebook, _("Quote"),   page++);
+       SET_NOTEBOOK_LABEL(notebook, _("Quote"),     page++);
        prefs_display_create();
-       SET_NOTEBOOK_LABEL(dialog.notebook, _("Display"),   page++);
+       SET_NOTEBOOK_LABEL(notebook, _("Display"),   page++);
        prefs_message_create();
-       SET_NOTEBOOK_LABEL(dialog.notebook, _("Message"),   page++);
+       SET_NOTEBOOK_LABEL(notebook, _("Message"),   page++);
        prefs_interface_create();
-       SET_NOTEBOOK_LABEL(dialog.notebook, _("Interface"), page++);
+       SET_NOTEBOOK_LABEL(notebook, _("Interface"), page++);
        prefs_other_create();
-       SET_NOTEBOOK_LABEL(dialog.notebook, _("Other"),     page++);
+       SET_NOTEBOOK_LABEL(notebook, _("Other"),     page++);
 
-       gtk_widget_show_all(dialog.window);
+       gtk_widget_show_all(notebook);
 }
 
 static void prefs_receive_create(void)
@@ -966,7 +995,7 @@ static void prefs_receive_create(void)
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
+       gtk_container_add (GTK_CONTAINER (notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
        PACK_FRAME(vbox1, frame_incext, _("External program"));
@@ -1151,7 +1180,7 @@ static void prefs_send_create(void)
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
+       gtk_container_add (GTK_CONTAINER (notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
        vbox2 = gtk_vbox_new (FALSE, 0);
@@ -1205,9 +1234,7 @@ static void prefs_send_create(void)
 
        SET_MENUITEM(_("Automatic (Recommended)"),       CS_AUTO);
        SET_MENUITEM(_("7bit ascii (US-ASCII)"),         CS_US_ASCII);
-#if HAVE_ICONV
        SET_MENUITEM(_("Unicode (UTF-8)"),               CS_UTF_8);
-#endif
        SET_MENUITEM(_("Western European (ISO-8859-1)"),  CS_ISO_8859_1);
        SET_MENUITEM(_("Western European (ISO-8859-15)"), CS_ISO_8859_15);
        SET_MENUITEM(_("Central European (ISO-8859-2)"),  CS_ISO_8859_2);
@@ -1215,14 +1242,10 @@ static void prefs_send_create(void)
        SET_MENUITEM(_("Baltic (ISO-8859-4)"),            CS_ISO_8859_4);
        SET_MENUITEM(_("Greek (ISO-8859-7)"),             CS_ISO_8859_7);
        SET_MENUITEM(_("Turkish (ISO-8859-9)"),           CS_ISO_8859_9);
-#if HAVE_ICONV
        SET_MENUITEM(_("Cyrillic (ISO-8859-5)"),          CS_ISO_8859_5);
-#endif
        SET_MENUITEM(_("Cyrillic (KOI8-R)"),             CS_KOI8_R);
-#if HAVE_ICONV
        SET_MENUITEM(_("Cyrillic (Windows-1251)"),       CS_WINDOWS_1251);
        SET_MENUITEM(_("Cyrillic (KOI8-U)"),             CS_KOI8_U);
-#endif
        SET_MENUITEM(_("Japanese (ISO-2022-JP)"),        CS_ISO_2022_JP);
 #if 0
        SET_MENUITEM(_("Japanese (EUC-JP)"),             CS_EUC_JP);
@@ -1327,7 +1350,7 @@ static void prefs_compose_create(void)
        
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
+       gtk_container_add (GTK_CONTAINER (notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
         /* Account autoselection */
@@ -1447,7 +1470,7 @@ static void prefs_quote_create(void)
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
+       gtk_container_add (GTK_CONTAINER (notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
        /* reply */
@@ -1480,15 +1503,18 @@ static void prefs_quote_create(void)
 
        scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL);
        gtk_widget_show (scrolledwin_quotefmt);
-       gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt, TRUE, TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt,
+                           TRUE, TRUE, 0);
        gtk_scrolled_window_set_policy
                (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt),
                 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+       gtk_scrolled_window_set_shadow_type
+               (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), GTK_SHADOW_IN);
 
        text_quotefmt = gtk_text_view_new ();
        gtk_widget_show (text_quotefmt);
        gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt), text_quotefmt);
-       gtk_text_view_set_editable (GTK_TEXT_VIEW(text_quotefmt), TRUE);
+       gtk_text_view_set_editable (GTK_TEXT_VIEW (text_quotefmt), TRUE);
        gtk_widget_set_size_request(text_quotefmt, -1, 60);
 
        /* forward */
@@ -1520,17 +1546,20 @@ static void prefs_quote_create(void)
 
        scrolledwin_quotefmt = gtk_scrolled_window_new (NULL, NULL);
        gtk_widget_show (scrolledwin_quotefmt);
-       gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt, TRUE, TRUE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox_quote), scrolledwin_quotefmt,
+                           TRUE, TRUE, 0);
        gtk_scrolled_window_set_policy
                (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt),
                 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+       gtk_scrolled_window_set_shadow_type
+               (GTK_SCROLLED_WINDOW (scrolledwin_quotefmt), GTK_SHADOW_IN);
 
        text_fw_quotefmt = gtk_text_view_new ();
        gtk_widget_show (text_fw_quotefmt);
        gtk_container_add(GTK_CONTAINER(scrolledwin_quotefmt),
                          text_fw_quotefmt);
        gtk_text_view_set_editable (GTK_TEXT_VIEW (text_fw_quotefmt), TRUE);
-       gtk_widget_set_size_request(text_fw_quotefmt, -1, 60);
+       gtk_widget_set_size_request (text_fw_quotefmt, -1, 60);
 
        hbox1 = gtk_hbox_new (FALSE, 32);
        gtk_widget_show (hbox1);
@@ -1601,7 +1630,7 @@ static void prefs_display_create(void)
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
+       gtk_container_add (GTK_CONTAINER (notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
        vbox2 = gtk_vbox_new (FALSE, 0);
@@ -1720,7 +1749,6 @@ static void prefs_message_create(void)
        GtkWidget *label_linespc;
        GtkObject *spinbtn_linespc_adj;
        GtkWidget *spinbtn_linespc;
-       GtkWidget *chkbtn_headspc;
 
        GtkWidget *frame_scr;
        GtkWidget *vbox_scr;
@@ -1735,7 +1763,7 @@ static void prefs_message_create(void)
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
+       gtk_container_add (GTK_CONTAINER (notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
        vbox2 = gtk_vbox_new (FALSE, 0);
@@ -1798,8 +1826,6 @@ static void prefs_message_create(void)
        gtk_box_pack_start (GTK_BOX (hbox_linespc), label_linespc,
                            FALSE, FALSE, 0);
 
-       PACK_CHECK_BUTTON(hbox1, chkbtn_headspc, _("Indent text"));
-
        PACK_FRAME(vbox1, frame_scr, _("Scroll"));
 
        vbox_scr = gtk_vbox_new (FALSE, 0);
@@ -1850,7 +1876,6 @@ static void prefs_message_create(void)
        message.chkbtn_disphdrpane = chkbtn_disphdrpane;
        message.chkbtn_disphdr     = chkbtn_disphdr;
        message.spinbtn_linespc    = spinbtn_linespc;
-       message.chkbtn_headspc     = chkbtn_headspc;
 
        message.chkbtn_smoothscroll    = chkbtn_smoothscroll;
        message.spinbtn_scrollstep     = spinbtn_scrollstep;
@@ -1884,7 +1909,7 @@ static void prefs_interface_create(void)
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
+       gtk_container_add (GTK_CONTAINER (notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
        vbox2 = gtk_vbox_new (FALSE, 0);
@@ -2011,7 +2036,7 @@ static void prefs_other_create(void)
 #endif
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
-       gtk_container_add (GTK_CONTAINER (dialog.notebook), vbox1);
+       gtk_container_add (GTK_CONTAINER (notebook), vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
 
        PACK_FRAME (vbox1, frame_addr, _("Address book"));
@@ -2204,7 +2229,7 @@ static void date_format_entry_on_change(GtkEditable *editable,
        g_free(text);
 
        text = conv_codeset_strdup(buffer,
-                                  conv_get_current_charset_str(),
+                                  conv_get_locale_charset_str(),
                                   CS_UTF_8);
        if (!text)
                text = g_strdup(buffer);
@@ -2214,8 +2239,9 @@ static void date_format_entry_on_change(GtkEditable *editable,
        g_free(text);
 }
 
-static void date_format_select_row(GtkWidget *date_format_list, gint row,
-                                  gint column, GdkEventButton *event,
+static void date_format_select_row(GtkTreeView *list_view,
+                                  GtkTreePath *path,
+                                  GtkTreeViewColumn *column,
                                   GtkWidget *date_format)
 {
        gint cur_pos;
@@ -2223,21 +2249,25 @@ static void date_format_select_row(GtkWidget *date_format_list, gint row,
        const gchar *old_format;
        gchar *new_format;
        GtkWidget *datefmt_sample;
+       GtkTreeIter iter;
+       GtkTreeModel *model;
+       
+       g_return_if_fail(date_format != NULL);
 
        /* only on double click */
-       if (!event || event->type != GDK_2BUTTON_PRESS) return;
-
-
        datefmt_sample = GTK_WIDGET(g_object_get_data(G_OBJECT(date_format), 
                                                      "datefmt_sample"));
 
-       g_return_if_fail(date_format_list != NULL);
-       g_return_if_fail(date_format != NULL);
        g_return_if_fail(datefmt_sample != NULL);
 
-       /* get format from clist */
-       gtk_clist_get_text(GTK_CLIST(date_format_list), row, 0, &format);
+       model = gtk_tree_view_get_model(list_view);
 
+       /* get format from list */
+       if (!gtk_tree_model_get_iter(model, &iter, path))
+               return;
+
+       gtk_tree_model_get(model, &iter, DATEFMT_FMT, &format, -1);             
+       
        cur_pos = gtk_editable_get_position(GTK_EDITABLE(datefmt_sample));
        old_format = gtk_entry_get_text(GTK_ENTRY(datefmt_sample));
 
@@ -2258,9 +2288,10 @@ static void date_format_select_row(GtkWidget *date_format_list, gint row,
 static GtkWidget *date_format_create(GtkButton *button, void *data)
 {
        static GtkWidget *datefmt_win = NULL;
+
        GtkWidget *vbox1;
        GtkWidget *scrolledwindow1;
-       GtkWidget *datefmt_clist;
+       GtkWidget *datefmt_list_view;
        GtkWidget *table;
        GtkWidget *label1;
        GtkWidget *label2;
@@ -2269,6 +2300,7 @@ static GtkWidget *date_format_create(GtkButton *button, void *data)
        GtkWidget *ok_btn;
        GtkWidget *cancel_btn;
        GtkWidget *datefmt_entry;
+       GtkListStore *store;
 
        struct {
                gchar *fmt;
@@ -2300,6 +2332,10 @@ static GtkWidget *date_format_create(GtkButton *button, void *data)
        const gint TIME_FORMAT_ELEMS =
                sizeof time_format / sizeof time_format[0];
 
+       GtkCellRenderer *renderer;
+       GtkTreeViewColumn *column;
+       GtkTreeSelection *selection;
+
        time_format[0].txt  = _("the full abbreviated weekday name");
        time_format[1].txt  = _("the full weekday name");
        time_format[2].txt  = _("the abbreviated month name");
@@ -2322,6 +2358,21 @@ static GtkWidget *date_format_create(GtkButton *button, void *data)
 
        if (datefmt_win) return datefmt_win;
 
+       store = gtk_list_store_new(N_DATEFMT_COLUMNS,
+                                  G_TYPE_STRING,
+                                  G_TYPE_STRING,
+                                  -1);
+
+       for (i = 0; i < TIME_FORMAT_ELEMS; i++) {
+               GtkTreeIter iter;
+
+               gtk_list_store_append(store, &iter);
+               gtk_list_store_set(store, &iter,
+                                  DATEFMT_FMT, time_format[i].fmt,
+                                  DATEFMT_TXT, time_format[i].txt,
+                                  -1);
+       }
+
        datefmt_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_container_set_border_width(GTK_CONTAINER(datefmt_win), 8);
        gtk_window_set_title(GTK_WINDOW(datefmt_win), _("Date format"));
@@ -2339,23 +2390,32 @@ static GtkWidget *date_format_create(GtkButton *button, void *data)
        gtk_widget_show(scrolledwindow1);
        gtk_box_pack_start(GTK_BOX(vbox1), scrolledwindow1, TRUE, TRUE, 0);
 
-       titles[0] = _("Specifier");
-       titles[1] = _("Description");
-       datefmt_clist = gtk_clist_new_with_titles(2, titles);
-       gtk_widget_show(datefmt_clist);
-       gtk_container_add(GTK_CONTAINER(scrolledwindow1), datefmt_clist);
-       /* gtk_clist_set_column_width(GTK_CLIST(datefmt_clist), 0, 80); */
-       gtk_clist_set_selection_mode(GTK_CLIST(datefmt_clist),
-                                    GTK_SELECTION_BROWSE);
+       datefmt_list_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+       g_object_unref(G_OBJECT(store));
+       gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(datefmt_list_view), TRUE);
+       gtk_widget_show(datefmt_list_view);
+       gtk_container_add(GTK_CONTAINER(scrolledwindow1), datefmt_list_view);
 
-       for (i = 0; i < TIME_FORMAT_ELEMS; i++) {
-               gchar *text[2];
-               /* phoney casting necessary because of gtk... */
-               text[0] = (gchar *)time_format[i].fmt;
-               text[1] = (gchar *)time_format[i].txt;
-               gtk_clist_append(GTK_CLIST(datefmt_clist), text);
-       }
+       renderer = gtk_cell_renderer_text_new();
+       column = gtk_tree_view_column_new_with_attributes
+                       (_("Specifier"), renderer, "text", DATEFMT_FMT,
+                        NULL);
+       gtk_tree_view_append_column(GTK_TREE_VIEW(datefmt_list_view), column);
+       
+       renderer = gtk_cell_renderer_text_new();
+       column = gtk_tree_view_column_new_with_attributes
+                       (_("Description"), renderer, "text", DATEFMT_TXT,
+                        NULL);
+       gtk_tree_view_append_column(GTK_TREE_VIEW(datefmt_list_view), column);
+       
+       /* gtk_clist_set_column_width(GTK_CLIST(datefmt_clist), 0, 80); */
+       selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(datefmt_list_view));
+       gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
 
+       g_signal_connect(G_OBJECT(datefmt_list_view), "row_activated", 
+                        G_CALLBACK(date_format_select_row),
+                        datefmt_win);
+       
        table = gtk_table_new(2, 2, FALSE);
        gtk_widget_show(table);
        gtk_box_pack_start(GTK_BOX(vbox1), table, FALSE, FALSE, 0);
@@ -2394,12 +2454,12 @@ static GtkWidget *date_format_create(GtkButton *button, void *data)
        gtk_label_set_justify(GTK_LABEL(label3), GTK_JUSTIFY_LEFT);
        gtk_misc_set_alignment(GTK_MISC(label3), 0, 0.5);
 
-       gtkut_button_set_create(&confirm_area, &ok_btn, _("OK"),
-                               &cancel_btn, _("Cancel"), NULL, NULL);
-       gtk_widget_grab_default(ok_btn);
-       gtk_widget_show(confirm_area);
+       gtkut_stock_button_set_create(&confirm_area, &ok_btn, GTK_STOCK_OK,
+                               &cancel_btn, GTK_STOCK_CANCEL, NULL, NULL);
 
        gtk_box_pack_start(GTK_BOX(vbox1), confirm_area, FALSE, FALSE, 0);
+       gtk_widget_show(confirm_area);
+       gtk_widget_grab_default(ok_btn);
 
        /* set the current format */
        gtk_entry_set_text(GTK_ENTRY(datefmt_entry), prefs_common.date_format);
@@ -2422,10 +2482,6 @@ static GtkWidget *date_format_create(GtkButton *button, void *data)
                         G_CALLBACK(date_format_entry_on_change),
                         label3);
 
-       g_signal_connect(G_OBJECT(datefmt_clist), "select_row",
-                        G_CALLBACK(date_format_select_row),
-                        datefmt_win);
-
        gtk_window_set_position(GTK_WINDOW(datefmt_win), GTK_WIN_POS_CENTER);
        gtk_window_set_modal(GTK_WINDOW(datefmt_win), TRUE);
 
@@ -2493,8 +2549,9 @@ static void prefs_keybind_select(void)
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_box_pack_start (GTK_BOX (vbox1), hbox1, FALSE, FALSE, 0);
 
-       gtkut_button_set_create (&confirm_area, &ok_btn, _("OK"),
-                                &cancel_btn, _("Cancel"), NULL, NULL);
+       gtkut_stock_button_set_create (&confirm_area, &ok_btn, GTK_STOCK_OK,
+                                      &cancel_btn, GTK_STOCK_CANCEL,
+                                      NULL, NULL);
        gtk_box_pack_end (GTK_BOX (hbox1), confirm_area, FALSE, FALSE, 0);
        gtk_widget_grab_default (ok_btn);
 
@@ -2566,7 +2623,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
        gint n_menurc;
 
        static struct KeyBind default_menurc[] = {
-               {"<Main>/File/Empty trash",                     ""},
+               {"<Main>/File/Empty all Trash folders",         ""},
                {"<Main>/File/Save as...",                      "<control>S"},
                {"<Main>/File/Print...",                        ""},
                {"<Main>/File/Exit",                            "<control>Q"},
@@ -2576,8 +2633,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/Edit/Find in current message...",      "<control>F"},
                {"<Main>/Edit/Search folder...",                "<shift><control>F"},
 
-               {"<Main>/View/Expand Summary View",             "V"},
-               {"<Main>/View/Expand Message View",             "<shift>V"},
+               {"<Main>/View/Show or hide/Message View",       "V"},
                {"<Main>/View/Thread view",                     "<control>T"},
                {"<Main>/View/Go to/Prev message",              "P"},
                {"<Main>/View/Go to/Next message",              "N"},
@@ -2585,12 +2641,13 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/View/Go to/Next unread message",       "<shift>N"},
                {"<Main>/View/Go to/Other folder...",           "G"},
                {"<Main>/View/Open in new window",              "<control><alt>N"},
-               {"<Main>/View/View source",                     "<control>U"},
+               {"<Main>/View/Message source",                  "<control>U"},
                {"<Main>/View/Show all headers",                "<control>H"},
-               {"<Main>/View/Update",                          "<control><alt>U"},
+               {"<Main>/View/Update summary",                  "<control><alt>U"},
 
-               {"<Main>/Message/Receive/Get new mail",         "<control>I"},
-               {"<Main>/Message/Receive/Get from all accounts",        "<shift><control>I"},
+               {"<Main>/Message/Receive/Get from current account",
+                                                               "<control>I"},
+               {"<Main>/Message/Receive/Get from all accounts","<shift><control>I"},
                {"<Main>/Message/Compose an email message",     "<control>M"},
                {"<Main>/Message/Reply",                        "<control>R"},
                {"<Main>/Message/Reply to/all",                 "<shift><control>R"},
@@ -2610,7 +2667,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/Tools/Execute",                        "X"},
                {"<Main>/Tools/Log window",                     "<shift><control>L"},
 
-               {"<Compose>/File/Close",                                "<control>W"},
+               {"<Compose>/Message/Close",                             "<control>W"},
                {"<Compose>/Edit/Select all",                           "<control>A"},
                {"<Compose>/Edit/Advanced/Move a word backward",        ""},
                {"<Compose>/Edit/Advanced/Move a word forward",         ""},
@@ -2620,7 +2677,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
        };
 
        static struct KeyBind mew_wl_menurc[] = {
-               {"<Main>/File/Empty trash",                     "<shift>D"},
+               {"<Main>/File/Empty all Trash folders",                 "<shift>D"},
                {"<Main>/File/Save as...",                      "Y"},
                {"<Main>/File/Print...",                        "<shift>numbersign"},
                {"<Main>/File/Exit",                            "<shift>Q"},
@@ -2630,8 +2687,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/Edit/Find in current message...",      "<control>F"},
                {"<Main>/Edit/Search folder...",                "<control>S"},
 
-               {"<Main>/View/Expand Summary View",             ""},
-               {"<Main>/View/Expand Message View",             ""},
+               {"<Main>/View/Show or hide/Message View",       ""},
                {"<Main>/View/Thread view",                     "<shift>T"},
                {"<Main>/View/Go to/Prev message",              "P"},
                {"<Main>/View/Go to/Next message",              "N"},
@@ -2639,12 +2695,13 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/View/Go to/Next unread message",       "<shift>N"},
                {"<Main>/View/Go to/Other folder...",           "G"},
                {"<Main>/View/Open in new window",              "<control><alt>N"},
-               {"<Main>/View/View source",                     "<control>U"},
+               {"<Main>/View/Message source",                  "<control>U"},
                {"<Main>/View/Show all headers",                "<shift>H"},
-               {"<Main>/View/Update",                          "<shift>S"},
+               {"<Main>/View/Update summary",                  "<shift>S"},
 
-               {"<Main>/Message/Receive/Get new mail",         "<control>I"},
-               {"<Main>/Message/Receive/Get from all accounts",        "<shift><control>I"},
+               {"<Main>/Message/Receive/Get from current account",
+                                                               "<control>I"},
+               {"<Main>/Message/Receive/Get from all accounts","<shift><control>I"},
                {"<Main>/Message/Compose an email message",     "W"},
                {"<Main>/Message/Reply",                        "<control>R"},
                {"<Main>/Message/Reply to/all",                 "<shift>A"},
@@ -2664,7 +2721,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/Tools/Execute",                        "X"},
                {"<Main>/Tools/Log window",                     "<shift><control>L"},
 
-               {"<Compose>/File/Close",                                "<alt>W"},
+               {"<Compose>/Message/Close",                             "<alt>W"},
                {"<Compose>/Edit/Select all",                           ""},
                {"<Compose>/Edit/Advanced/Move a word backward,"        "<alt>B"},
                {"<Compose>/Edit/Advanced/Move a word forward",         "<alt>F"},
@@ -2674,7 +2731,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
        };
 
        static struct KeyBind mutt_menurc[] = {
-               {"<Main>/File/Empty trash",                     ""},
+               {"<Main>/File/Empty all Trash folders",         ""},
                {"<Main>/File/Save as...",                      "S"},
                {"<Main>/File/Print...",                        "P"},
                {"<Main>/File/Exit",                            "Q"},
@@ -2684,7 +2741,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/Edit/Find in current message...",      "<control>F"},
                {"<Main>/Edit/Search messages...",              "slash"},
 
-               {"<Main>/View/Toggle summary view",             "V"},
+               {"<Main>/View/Show or hide/Message view",       "V"},
                {"<Main>/View/Thread view",                     "<control>T"},
                {"<Main>/View/Go to/Prev message",              ""},
                {"<Main>/View/Go to/Next message",              ""},
@@ -2692,12 +2749,13 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/View/Go to/Next unread message",       ""},
                {"<Main>/View/Go to/Other folder...",           "C"},
                {"<Main>/View/Open in new window",              "<control><alt>N"},
-               {"<Main>/View/View source",                     "<control>U"},
+               {"<Main>/View/Message source",                  "<control>U"},
                {"<Main>/View/Show all headers",                "<control>H"},
-               {"<Main>/View/Update",                          "<control><alt>U"},
+               {"<Main>/View/Update summary",                          "<control><alt>U"},
 
-               {"<Main>/Message/Receive/Get new mail",                 "<control>I"},
-               {"<Main>/Message/Receive/Get from all accounts",        "<shift><control>I"},
+               {"<Main>/Message/Receive/Get from current account",
+                                                               "<control>I"},
+               {"<Main>/Message/Receive/Get from all accounts","<shift><control>I"},
                {"<Main>/Message/Compose an email message",             "M"},
                {"<Main>/Message/Reply",                        "R"},
                {"<Main>/Message/Reply to/all",                 "G"},
@@ -2717,7 +2775,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/Tools/Execute",                        "X"},
                {"<Main>/Tools/Log window",                     "<shift><control>L"},
 
-               {"<Compose>/File/Close",                                "<alt>W"},
+               {"<Compose>/Message/Close",                             "<alt>W"},
                {"<Compose>/Edit/Select all",                           ""},
                {"<Compose>/Edit/Advanced/Move a word backward",        "<alt>B"},
                {"<Compose>/Edit/Advanced/Move a word forward",         "<alt>F"},
@@ -2727,7 +2785,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
        };
 
        static struct KeyBind old_sylpheed_menurc[] = {
-               {"<Main>/File/Empty trash",                     ""},
+               {"<Main>/File/Empty all Trash folders",         ""},
                {"<Main>/File/Save as...",                      ""},
                {"<Main>/File/Print...",                        "<alt>P"},
                {"<Main>/File/Exit",                            "<alt>Q"},
@@ -2737,8 +2795,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/Edit/Find in current message...",      "<control>F"},
                {"<Main>/Edit/Search folder...",                "<control>S"},
 
-               {"<Main>/View/Expand Summary View",             ""},
-               {"<Main>/View/Expand Message View",             ""},
+               {"<Main>/View/Show or hide/Message View",       ""},
                {"<Main>/View/Thread view",                     "<control>T"},
                {"<Main>/View/Go to/Prev message",              "P"},
                {"<Main>/View/Go to/Next message",              "N"},
@@ -2746,12 +2803,13 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/View/Go to/Next unread message",       "<shift>N"},
                {"<Main>/View/Go to/Other folder...",           "<alt>G"},
                {"<Main>/View/Open in new window",              "<shift><control>N"},
-               {"<Main>/View/View source",                     "<control>U"},
+               {"<Main>/View/Message source",                  "<control>U"},
                {"<Main>/View/Show all headers",                "<control>H"},
-               {"<Main>/View/Update",                          "<alt>U"},
+               {"<Main>/View/Update summary",                  "<alt>U"},
 
-               {"<Main>/Message/Receive/Get new mail",                 "<alt>I"},
-               {"<Main>/Message/Receive/Get from all accounts",        "<shift><alt>I"},
+               {"<Main>/Message/Receive/Get from current account",
+                                                               "<alt>I"},
+               {"<Main>/Message/Receive/Get from all accounts","<shift><alt>I"},
                {"<Main>/Message/Compose an email message",     "<alt>N"},
                {"<Main>/Message/Reply",                        "<alt>R"},
                {"<Main>/Message/Reply to/all",                 "<shift><alt>R"},
@@ -2771,7 +2829,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                {"<Main>/Tools/Execute",                        "<alt>X"},
                {"<Main>/Tools/Log window",                     "<alt>L"},
 
-               {"<Compose>/File/Close",                                "<alt>W"},
+               {"<Compose>/Message/Close",                             "<alt>W"},
                {"<Compose>/Edit/Select all",                           ""},
                {"<Compose>/Edit/Advanced/Move a word backward",        "<alt>B"},
                {"<Compose>/Edit/Advanced/Move a word forward",         "<alt>F"},
@@ -2934,29 +2992,6 @@ static void prefs_common_send_dialog_set_optmenu(PrefParam *pparam)
        gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
 }
 
-static gint prefs_common_deleted(GtkWidget *widget, GdkEventAny *event,
-                                gpointer data)
-{
-       prefs_common_cancel();
-       return TRUE;
-}
-
-static gboolean prefs_common_key_pressed(GtkWidget *widget, GdkEventKey *event,
-                                        gpointer data)
-{
-       if (event && event->keyval == GDK_Escape)
-               prefs_common_cancel();
-       return FALSE;
-}
-
-static void prefs_common_ok(void)
-{
-       prefs_common_apply();
-       gtk_widget_hide(dialog.window);
-
-       inc_unlock();
-}
-
 static void prefs_common_apply(void)
 {
        MainWindow *mainwindow;
@@ -3011,12 +3046,13 @@ static void prefs_nextunreadmsgdialog_set_optmenu(PrefParam *pparam)
        gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
 }
 
+/*
 static void prefs_common_cancel(void)
 {
        gtk_widget_hide(dialog.window);
        inc_unlock();
 }
-
+*/
 
 /* static void prefs_recvdialog_set_data_from_optmenu(PrefParam *pparam)
 {