Add open_selected_on_folder_open to common prefs.
[claws.git] / src / prefs_summary_open.c
index 57654b7c874b199dbe09091ef4daf7db52a5adf1..b1c235d3a7c362f4dfed0457d0477ee857afc0b8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail 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
@@ -19,6 +19,7 @@
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 
 #include "defs.h"
@@ -55,6 +56,8 @@ static struct SummaryOpen {
 
        GtkWidget *possible_actions_list_view;
        GtkWidget *actions_list_view;
+
+       GtkWidget *open_on_select;
 } summaryopen;
 
 /* widget creating functions */
@@ -158,6 +161,7 @@ static void prefs_summary_open_create(void)
        GtkWidget *list_view_scrolledwin;
        GtkWidget *possible_actions_list_view;
        GtkWidget *actions_list_view;
+       GtkWidget *checkbtn_open_on_select;
        
        window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_summary_open");
        gtk_container_set_border_width (GTK_CONTAINER (window), 8);
@@ -294,7 +298,9 @@ static void prefs_summary_open_create(void)
        gtk_box_pack_start (GTK_BOX (btn_vbox), down_btn, FALSE, FALSE, 0);
        g_signal_connect (G_OBJECT (down_btn), "clicked",
                          G_CALLBACK (prefs_summary_open_down), NULL);
-       
+
+       PACK_CHECK_BUTTON(vbox, checkbtn_open_on_select,
+                       _("Open the selected message"));
 
        gtk_widget_show_all(window);
 
@@ -304,6 +310,7 @@ static void prefs_summary_open_create(void)
 
        summaryopen.possible_actions_list_view        = possible_actions_list_view;
        summaryopen.actions_list_view = actions_list_view;
+       summaryopen.open_on_select = checkbtn_open_on_select;
 }
 
 /* do it SUMMARY_OPEN_ACTIONS-1 times */
@@ -379,6 +386,10 @@ fill:
                                        (model_poss), action_name[i], i);       
                }
        }
+
+       gtk_toggle_button_set_active
+               (GTK_TOGGLE_BUTTON(summaryopen.open_on_select),
+                prefs_common.open_selected_on_folder_open);
 }
 
 static void prefs_summary_open_set_list(void)
@@ -542,6 +553,10 @@ static void prefs_summary_open_ok(void)
        for (i = 0; i < SUMMARY_OPEN_ACTIONS-1; i++)
                saved_summary_select_prio[i] = prefs_common.summary_select_prio[i];
 
+       prefs_common.open_selected_on_folder_open =
+               gtk_toggle_button_get_active
+               (GTK_TOGGLE_BUTTON(summaryopen.open_on_select));
+
        gtk_widget_hide(summaryopen.window);
        gtk_window_set_modal(GTK_WINDOW(summaryopen.window), FALSE);
 }