add common prefs option '/Interface/Open next message on deletion'
[claws.git] / src / prefs_common.c
index 4a1579c04978ca86375080ea5158166be65a15a8..31efadee5a7a7302f1e96b33ac8f4389f5960e8a 100644 (file)
@@ -187,8 +187,7 @@ static struct Message {
        GtkObject *spinbtn_scrollstep_adj;
        GtkWidget *chkbtn_halfpage;
 
-       GtkWidget *chkbtn_display_img;
-       GtkWidget *chkbtn_resize_image;
+       GtkWidget *chkbtn_attach_desc;
 } message;
 
 #if USE_GPGME
@@ -208,6 +207,7 @@ static struct Interface {
        GtkWidget *checkbtn_show_msg_with_cursor;
        GtkWidget *checkbtn_openunread;
        GtkWidget *checkbtn_mark_as_read_on_newwin;
+       GtkWidget *checkbtn_open_on_delete;
        GtkWidget *checkbtn_openinbox;
        GtkWidget *checkbtn_immedexec;
        GtkWidget *optmenu_recvdialog;
@@ -412,7 +412,7 @@ static PrefParam param[] = {
        {"check_while_typing", "TRUE", &prefs_common.check_while_typing,
         P_BOOL, &spelling.checkbtn_check_while_typing,
         prefs_set_data_from_toggle, prefs_set_toggle},
-       {"misspelled_color", "16711680", &prefs_common.misspelled_col, P_INT,
+       {"misspelled_color", "16711680", &prefs_common.misspelled_col, P_COLOR,
         NULL, NULL, NULL},
 #endif
        {"reply_with_quote", "TRUE", &prefs_common.reply_with_quote, P_BOOL,
@@ -640,17 +640,17 @@ static PrefParam param[] = {
         &message.chkbtn_enablecol,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
-       {"quote_level1_color", "179", &prefs_common.quote_level1_col, P_INT,
+       {"quote_level1_color", "179", &prefs_common.quote_level1_col, P_COLOR,
         NULL, NULL, NULL},
-       {"quote_level2_color", "179", &prefs_common.quote_level2_col, P_INT,
+       {"quote_level2_color", "179", &prefs_common.quote_level2_col, P_COLOR,
         NULL, NULL, NULL},
-       {"quote_level3_color", "179", &prefs_common.quote_level3_col, P_INT,
+       {"quote_level3_color", "179", &prefs_common.quote_level3_col, P_COLOR,
         NULL, NULL, NULL},
-       {"uri_color", "32512", &prefs_common.uri_col, P_INT,
+       {"uri_color", "32512", &prefs_common.uri_col, P_COLOR,
         NULL, NULL, NULL},
-       {"target_folder_color", "14294218", &prefs_common.tgt_folder_col, P_INT,
+       {"target_folder_color", "14294218", &prefs_common.tgt_folder_col, P_COLOR,
         NULL, NULL, NULL},
-       {"signature_color", "7960953", &prefs_common.signature_col, P_INT,
+       {"signature_color", "7960953", &prefs_common.signature_col, P_COLOR,
         NULL, NULL, NULL},
        {"recycle_quote_colors", "FALSE", &prefs_common.recycle_quote_colors,
         P_BOOL, NULL, NULL, NULL},
@@ -682,16 +682,13 @@ static PrefParam param[] = {
         &message.chkbtn_halfpage,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
-       {"display_img", "TRUE", &prefs_common.display_img, P_BOOL,
-        &message.chkbtn_display_img,
-        prefs_set_data_from_toggle, prefs_set_toggle},
-       {"resize_image", "TRUE", &prefs_common.resize_image, P_BOOL,
-        &message.chkbtn_resize_image,
-        prefs_set_data_from_toggle, prefs_set_toggle},
-
        {"show_other_header", "FALSE", &prefs_common.show_other_header, P_BOOL,
         NULL, NULL, NULL},
 
+       {"attach_desc", "TRUE", &prefs_common.attach_desc, P_BOOL,
+        &message.chkbtn_attach_desc,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+
        /* MIME viewer */
        {"mime_image_viewer", "display '%s'",
         &prefs_common.mime_image_viewer, P_STRING, NULL, NULL, NULL},
@@ -746,6 +743,10 @@ static PrefParam param[] = {
         &prefs_common.mark_as_read_on_new_window,
         P_BOOL, &interface.checkbtn_mark_as_read_on_newwin,
         prefs_set_data_from_toggle, prefs_set_toggle},
+       {"open_on_delete", "TRUE",
+        &prefs_common.open_on_delete,
+        P_BOOL, &interface.checkbtn_open_on_delete,
+        prefs_set_data_from_toggle, prefs_set_toggle},
        {"open_inbox_on_inc", "FALSE", &prefs_common.open_inbox_on_inc,
         P_BOOL, &interface.checkbtn_openinbox,
         prefs_set_data_from_toggle, prefs_set_toggle},
@@ -829,7 +830,7 @@ static PrefParam param[] = {
        {"cache_min_keep_time", "15", &prefs_common.cache_min_keep_time, P_INT,
         NULL, NULL, NULL},
 
-       {"color_new", "179", &prefs_common.color_new, P_INT,
+       {"color_new", "179", &prefs_common.color_new, P_COLOR,
         NULL, NULL, NULL},
 
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
@@ -922,6 +923,11 @@ void prefs_common_init() {
        prefs_common.disphdr_list = NULL;
 }
 
+PrefsCommon *prefs_common_get(void)
+{
+       return &prefs_common;
+}
+
 void prefs_common_read_config(void)
 {
        FILE *fp;
@@ -1732,7 +1738,6 @@ static void prefs_compose_create(void)
 {
        GtkWidget *vbox1;
        GtkWidget *vbox2;
-       GtkWidget *hbox1;
 
        GtkWidget *checkbtn_autoextedit;
 
@@ -2331,8 +2336,7 @@ static void prefs_message_create(void)
        GtkWidget *spinbtn_scrollstep;
        GtkWidget *chkbtn_halfpage;
 
-       GtkWidget *chkbtn_display_img;
-       GtkWidget *chkbtn_resize_image;
+       GtkWidget *chkbtn_attach_desc;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
@@ -2462,11 +2466,9 @@ static void prefs_message_create(void)
        gtk_widget_show (vbox3);
        gtk_box_pack_start (GTK_BOX (vbox1), vbox3, FALSE, FALSE, 0);
 
-       PACK_CHECK_BUTTON(vbox3, chkbtn_display_img,
-                          _("Automatically display attached images"));
+       PACK_CHECK_BUTTON(vbox3, chkbtn_attach_desc,
+                         _("Show attachment descriptions (rather than names)"));
 
-       PACK_CHECK_BUTTON(vbox3, chkbtn_resize_image,
-                         _("Resize attached images"));
 
        message.chkbtn_enablecol   = chkbtn_enablecol;
        message.button_edit_col    = button_edit_col;
@@ -2481,8 +2483,7 @@ static void prefs_message_create(void)
        message.spinbtn_scrollstep_adj = spinbtn_scrollstep_adj;
        message.chkbtn_halfpage        = chkbtn_halfpage;
 
-       message.chkbtn_display_img  = chkbtn_display_img;
-       message.chkbtn_resize_image = chkbtn_resize_image;
+       message.chkbtn_attach_desc  = chkbtn_attach_desc;
 }
 
 #if USE_GPGME
@@ -2601,6 +2602,7 @@ static void prefs_interface_create(void)
        GtkWidget *checkbtn_show_msg_with_cursor;
        GtkWidget *checkbtn_openunread;
        GtkWidget *checkbtn_mark_as_read_on_newwin;
+       GtkWidget *checkbtn_open_on_delete;
        GtkWidget *checkbtn_openinbox;
        GtkWidget *checkbtn_immedexec;
        GtkWidget *frame_dialogs;
@@ -2652,6 +2654,10 @@ static void prefs_interface_create(void)
                (vbox2, checkbtn_mark_as_read_on_newwin,
                 _("Only mark message as read when opened in new window"));
 
+       PACK_CHECK_BUTTON
+               (vbox2, checkbtn_open_on_delete,
+                _("Open next message on deletion"));
+
        PACK_CHECK_BUTTON
                (vbox2, checkbtn_openinbox,
                 _("Go to inbox after receiving new mail"));
@@ -2788,6 +2794,8 @@ static void prefs_interface_create(void)
        interface.checkbtn_openunread         = checkbtn_openunread;
        interface.checkbtn_mark_as_read_on_newwin
                                              = checkbtn_mark_as_read_on_newwin;
+       interface.checkbtn_open_on_delete
+                                             = checkbtn_open_on_delete;
        interface.checkbtn_openinbox          = checkbtn_openinbox;
        interface.checkbtn_immedexec          = checkbtn_immedexec;
        interface.optmenu_recvdialog          = optmenu_recvdialog;
@@ -4030,59 +4038,6 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
                "(menu-path \"<Compose>/Edit/Advanced/Delete a word backward\" \"<control>W\")\n"
                "(menu-path \"<Compose>/Edit/Advanced/Delete a word forward\" \"<alt>D\")";
 
-       static gchar *empty_menurc =
-               "(menu-path \"<Main>/File/Empty trash\" \"\")\n"
-               "(menu-path \"<Main>/File/Save as...\" \"\")\n"
-               "(menu-path \"<Main>/File/Print...\" \"\")\n"
-               "(menu-path \"<Main>/File/Exit\" \"\")\n"
-
-               "(menu-path \"<Main>/Edit/Copy\" \"\")\n"
-               "(menu-path \"<Main>/Edit/Select all\" \"\")\n"
-               "(menu-path \"<Main>/Edit/Find in current message...\" \"\")\n"
-               "(menu-path \"<Main>/Edit/Search folder...\" \"\")\n"
-
-               "(menu-path \"<Main>/View/Expand Summary View\" \"\")\n"
-               "(menu-path \"<Main>/View/Expand Message View\" \"\")\n"
-               "(menu-path \"<Main>/View/Thread view\" \"\")\n"
-               "(menu-path \"<Main>/View/Go to/Prev message\" \"\")\n"
-               "(menu-path \"<Main>/View/Go to/Next message\" \"\")\n"
-               "(menu-path \"<Main>/View/Go to/Prev unread message\" \"\")\n"
-               "(menu-path \"<Main>/View/Go to/Next unread message\" \"\")\n"
-               "(menu-path \"<Main>/View/Go to/Other folder...\" \"\")\n"
-               "(menu-path \"<Main>/View/Open in new window\" \"\")\n"
-               "(menu-path \"<Main>/View/View source\" \"\")\n"
-               "(menu-path \"<Main>/View/Show all headers\" \"\")\n"
-               "(menu-path \"<Main>/View/Update\" \"\")\n"
-
-               "(menu-path \"<Main>/Message/Get new mail\" \"\")\n"
-               "(menu-path \"<Main>/Message/Get from all accounts\" \"\")\n"
-               "(menu-path \"<Main>/Message/Compose an email message\" \"\")\n"
-               "(menu-path \"<Main>/Message/Reply\" \"\")\n"
-               "(menu-path \"<Main>/Message/Reply to/all\" \"\")\n"
-               "(menu-path \"<Main>/Message/Reply to/sender\" \"\")\n"
-               "(menu-path \"<Main>/Message/Reply to/mailing list\" \"\")\n"
-               "(menu-path \"<Main>/Message/Forward\" \"\")\n"
-               /* "(menu-path \"<Main>/Message/Forward as attachment\" \"\")\n" */
-               "(menu-path \"<Main>/Message/Move...\" \"\")\n"
-               "(menu-path \"<Main>/Message/Copy...\" \"\")\n"
-               "(menu-path \"<Main>/Message/Delete\" \"\")\n"
-               "(menu-path \"<Main>/Message/Mark/Mark\" \"\")\n"
-               "(menu-path \"<Main>/Message/Mark/Unmark\" \"\")\n"
-               "(menu-path \"<Main>/Message/Mark/Mark as unread\" \"\")\n"
-               "(menu-path \"<Main>/Message/Mark/Mark as read\" \"\")\n"
-
-               "(menu-path \"<Main>/Tools/Address book\" \"\")\n"
-               "(menu-path \"<Main>/Tools/Execute\" \"\")\n"
-               "(menu-path \"<Main>/Tools/Log window\" \"\")\n"
-
-               "(menu-path \"<Compose>/File/Close\" \"\")\n"
-               "(menu-path \"<Compose>/Edit/Select all\" \"\")\n"
-               "(menu-path \"<Compose>/Edit/Advanced/Move a word backward\" \"\")\n"
-               "(menu-path \"<Compose>/Edit/Advanced/Move a word forward\" \"\")\n"
-               "(menu-path \"<Compose>/Edit/Advanced/Move to beginning of line\" \"\")\n"
-               "(menu-path \"<Compose>/Edit/Advanced/Delete a word backward\" \"\")\n"
-               "(menu-path \"<Compose>/Edit/Advanced/Delete a word forward\" \"\")";
-
        text = gtk_entry_get_text(entry);
 
        if (!strcmp(text, _("Default")))
@@ -4096,7 +4051,7 @@ static void prefs_keybind_apply_clicked(GtkWidget *widget)
        else
                return;
 
-       gtk_item_factory_parse_rc_string(empty_menurc);
+       menu_factory_clear_rc(rc_str);
        gtk_item_factory_parse_rc_string(rc_str);
 
        gtk_widget_destroy(keybind.window);