2008-09-16 [colin] 3.5.0cvs109
[claws.git] / src / prefs_other.c
index 0b2036a055d339bcf574647130763e17cb3fe2e2..c5bdd298006694f59fb83e7b187e598301941794 100644 (file)
@@ -57,6 +57,7 @@ typedef struct _OtherPage
        GtkWidget *spinbtn_iotimeout;
        GtkWidget *checkbtn_gtk_can_change_accels;
        GtkWidget *checkbtn_askonfilter;
+       GtkWidget *checkbtn_use_shred;
        GtkWidget *checkbtn_real_time_sync;
 } OtherPage;
 
@@ -89,7 +90,8 @@ static void prefs_keybind_select(void)
 
        window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_other");
        gtk_container_set_border_width (GTK_CONTAINER (window), 8);
-       gtk_window_set_title (GTK_WINDOW (window), _("Select key bindings"));
+       gtk_window_set_title (GTK_WINDOW (window), 
+                               _("Choose preset keyboard shortcuts"));
        gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
        gtk_window_set_modal (GTK_WINDOW (window), TRUE);
        gtk_window_set_resizable(GTK_WINDOW (window), FALSE);
@@ -197,7 +199,7 @@ static void prefs_keybind_apply(struct KeyBind keybind[], gint num)
 
 static void prefs_keybind_apply_clicked(GtkWidget *widget)
 {
-       const gchar *text;
+       gchar *text;
        struct KeyBind *menurc;
        gint n_menurc;
 
@@ -495,7 +497,6 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        GtkWidget *frame_keys;
        GtkWidget *vbox_keys;
        GtkWidget *checkbtn_gtk_can_change_accels;
-       GtkTooltips *gtk_can_change_accels_tooltip;
        GtkWidget *button_keybind;
 
        GtkWidget *label_iotimeout;
@@ -505,7 +506,12 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        GtkWidget *vbox2;
        GtkWidget *checkbtn_askonclean;
        GtkWidget *checkbtn_askonfilter;
+       GtkWidget *checkbtn_use_shred;
        GtkWidget *checkbtn_real_time_sync;
+
+       gchar *shred_binary = NULL;
+       CLAWS_TIP_DECL();
+
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
        gtk_container_set_border_width (GTK_CONTAINER (vbox1), VBOX_BORDER);
@@ -535,18 +541,17 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        vbox_keys = gtkut_get_options_frame(vbox1, &frame_keys, _("Keyboard shortcuts"));
 
        PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_can_change_accels,
-                       _("Enable customisable menu shortcuts"));
-       gtk_can_change_accels_tooltip = gtk_tooltips_new();
-       gtk_tooltips_set_tip(GTK_TOOLTIPS(gtk_can_change_accels_tooltip),
-                       checkbtn_gtk_can_change_accels,
+                       _("Enable customisable keyboard shortcuts"));
+
+       CLAWS_SET_TIP(checkbtn_gtk_can_change_accels,
                        _("If checked, you can change the keyboard shortcuts of "
                                "most of the menu items by focusing on the menu "
                                "item and pressing a key combination.\n"
                                "Uncheck this option if you want to lock all "
-                               "existing menu shortcuts."),
-                       NULL);
+                               "existing keyboard shortcuts."));
 
-       button_keybind = gtk_button_new_with_label (_(" Set key bindings... "));
+       button_keybind = gtk_button_new_with_label(
+                               _(" Choose preset keyboard shortcuts... "));
        gtk_widget_show (button_keybind);
        hbox1 = gtk_hbox_new (FALSE, 8);
        gtk_widget_show (hbox1);
@@ -585,6 +590,21 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        PACK_CHECK_BUTTON (vbox2, checkbtn_askonfilter,
                           _("Ask about account specific filtering rules when "
                             "filtering manually"));
+       shred_binary = g_find_program_in_path("shred");
+       if (shred_binary) {
+               PACK_CHECK_BUTTON (vbox2, checkbtn_use_shred,
+                                  _("Use secure file deletion if possible"));
+               g_free(shred_binary);
+       } else {
+               PACK_CHECK_BUTTON (vbox2, checkbtn_use_shred,
+                                  _("Use secure file deletion if possible\n"
+                                    "(the 'shred' program is not available)"));
+               gtk_widget_set_sensitive(checkbtn_use_shred, FALSE);
+       }
+       CLAWS_SET_TIP(checkbtn_use_shred,
+                       _("Use the 'shred' program to overwrite files with random data before "
+                         "deleting them. This slows down deletion. Be sure to "
+                         "read shred's man page for caveats."));
        PACK_CHECK_BUTTON (vbox2, checkbtn_real_time_sync,
                           _("Synchronise offline folders as soon as possible"));
 
@@ -606,6 +626,8 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_askonfilter), 
                prefs_common.ask_apply_per_account_filtering_rules);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_use_shred), 
+               prefs_common.use_shred);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_real_time_sync), 
                prefs_common.real_time_sync);
 
@@ -617,6 +639,7 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        prefs_other->spinbtn_iotimeout = spinbtn_iotimeout;
        prefs_other->checkbtn_gtk_can_change_accels = checkbtn_gtk_can_change_accels;
        prefs_other->checkbtn_askonfilter = checkbtn_askonfilter;
+       prefs_other->checkbtn_use_shred = checkbtn_use_shred;
        prefs_other->checkbtn_real_time_sync = checkbtn_real_time_sync;
 
        prefs_other->page.widget = vbox1;
@@ -626,6 +649,7 @@ static void prefs_other_save(PrefsPage *_page)
 {
        OtherPage *page = (OtherPage *) _page;
        gboolean gtk_can_change_accels;
+       GList * list = NULL;
 
        prefs_common.add_address_by_click = gtk_toggle_button_get_active(
                GTK_TOGGLE_BUTTON(page->checkbtn_addaddrbyclick));
@@ -646,6 +670,9 @@ static void prefs_other_save(PrefsPage *_page)
        prefs_common.ask_apply_per_account_filtering_rules = 
                gtk_toggle_button_get_active(
                        GTK_TOGGLE_BUTTON(page->checkbtn_askonfilter)); 
+       prefs_common.use_shred = 
+               gtk_toggle_button_get_active(
+                       GTK_TOGGLE_BUTTON(page->checkbtn_use_shred)); 
        prefs_common.real_time_sync = 
                gtk_toggle_button_get_active(
                        GTK_TOGGLE_BUTTON(page->checkbtn_real_time_sync));