add option 'enable keyboard shortcuts'
authorPaul <paul@claws-mail.org>
Tue, 8 Jan 2019 07:57:25 +0000 (07:57 +0000)
committerPaul <paul@claws-mail.org>
Tue, 8 Jan 2019 07:57:25 +0000 (07:57 +0000)
src/prefs_common.c
src/prefs_common.h
src/prefs_other.c

index 5ce34dd..bc8cc23 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2019 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
@@ -1017,6 +1017,8 @@ static PrefParam param[] = {
 
        {"gtk_can_change_accels", "FALSE", &prefs_common.gtk_can_change_accels, P_BOOL,
         NULL, NULL, NULL},
+       {"gtk_enable_accels", "TRUE", &prefs_common.gtk_enable_accels, P_BOOL,
+        NULL, NULL, NULL},
 
        {"color_new", "#0000b3", &prefs_common.color[COL_NEW],
         P_COLOR, NULL, NULL, NULL},
index 05a7896..d4f746a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2016 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2019 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
@@ -458,6 +458,7 @@ struct _PrefsCommon
        gint io_timeout_secs;
 
        gboolean gtk_can_change_accels;
+       gboolean gtk_enable_accels;
        
        /* Memory cache*/
        gint cache_max_mem_usage;
index 9bd90e2..ead5f9c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2005-2015 Colin Leroy and The Claws Mail Team
+ * Copyright (C) 2005-2019 Colin Leroy 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
@@ -59,6 +59,7 @@ typedef struct _OtherPage
        GtkWidget *checkbtn_askonclean;
        GtkWidget *checkbtn_warnqueued;
        GtkWidget *spinbtn_iotimeout;
+       GtkWidget *checkbtn_gtk_enable_accels;
        GtkWidget *checkbtn_gtk_can_change_accels;
        GtkWidget *checkbtn_askonfilter;
        GtkWidget *checkbtn_use_shred;
@@ -454,6 +455,7 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 
        GtkWidget *frame_keys;
        GtkWidget *vbox_keys;
+       GtkWidget *checkbtn_gtk_enable_accels;
        GtkWidget *checkbtn_gtk_can_change_accels;
        GtkWidget *button_keybind;
 
@@ -511,6 +513,9 @@ 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_enable_accels,
+                       _("Enable keyboard shortcuts"));
+
        PACK_CHECK_BUTTON(vbox_keys, checkbtn_gtk_can_change_accels,
                        _("Enable customisable keyboard shortcuts"));
 
@@ -629,6 +634,8 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        g_signal_connect (G_OBJECT (button_change_passphrase), "clicked",
                          G_CALLBACK (prefs_change_master_passphrase), NULL);
 #endif
+       SET_TOGGLE_SENSITIVITY(checkbtn_gtk_enable_accels, checkbtn_gtk_can_change_accels);
+       SET_TOGGLE_SENSITIVITY(checkbtn_gtk_enable_accels, button_keybind);
 
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_addaddrbyclick), 
                prefs_common.add_address_by_click);
@@ -640,6 +647,8 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
                prefs_common.ask_on_clean);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_warnqueued), 
                prefs_common.warn_queued_on_exit);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_enable_accels),
+               prefs_common.gtk_enable_accels);
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbtn_gtk_can_change_accels),
                prefs_common.gtk_can_change_accels);
 
@@ -669,6 +678,7 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
        prefs_other->checkbtn_warnqueued = checkbtn_warnqueued;
        prefs_other->spinbtn_iotimeout = spinbtn_iotimeout;
        prefs_other->checkbtn_transhdr = checkbtn_transhdr;
+       prefs_other->checkbtn_gtk_enable_accels = checkbtn_gtk_enable_accels;
        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;
@@ -684,6 +694,7 @@ static void prefs_other_create_widget(PrefsPage *_page, GtkWindow *window,
 static void prefs_other_save(PrefsPage *_page)
 {
        OtherPage *page = (OtherPage *) _page;
+       gboolean gtk_enable_accels;
        gboolean gtk_can_change_accels;
 
        prefs_common.add_address_by_click = gtk_toggle_button_get_active(
@@ -763,7 +774,26 @@ static void prefs_other_save(PrefsPage *_page)
                                "gtk-can-change-accels",
                                (glong)prefs_common.gtk_can_change_accels,
                                "XProperty");
+       }
+       gtk_enable_accels = gtk_toggle_button_get_active(
+               GTK_TOGGLE_BUTTON(page->checkbtn_gtk_enable_accels));
 
+       if (prefs_common.gtk_enable_accels != gtk_enable_accels) {
+               prefs_common.gtk_enable_accels = gtk_enable_accels;
+
+               gtk_settings_set_long_property(gtk_settings_get_default(),
+                               "gtk-enable-accels",
+                               (glong)prefs_common.gtk_enable_accels,
+                               "XProperty");
+               
+               gtk_settings_set_long_property(gtk_settings_get_default(),
+                               "gtk-enable-mnemonics",
+                               (glong)prefs_common.gtk_enable_accels,
+                               "XProperty");
+       }
+       
+       if (prefs_common.gtk_enable_accels != gtk_enable_accels ||
+           prefs_common.gtk_can_change_accels != gtk_can_change_accels) {              
                /* gtk_can_change_accels value changed : we have (only if changed)
                 * to apply the gtk property to all widgets : */
                gtk_rc_reparse_all_for_settings(gtk_settings_get_default(), TRUE);
@@ -798,6 +828,14 @@ void prefs_other_init(void)
                        "gtk-can-change-accels",
                        (glong)prefs_common.gtk_can_change_accels,
                        "XProperty");
+       gtk_settings_set_long_property(gtk_settings_get_default(),
+                       "gtk-enable-accels",
+                       (glong)prefs_common.gtk_enable_accels,
+                       "XProperty");
+       gtk_settings_set_long_property(gtk_settings_get_default(),
+                       "gtk-enable-mnemonics",
+                       (glong)prefs_common.gtk_enable_accels,
+                       "XProperty");
 }
 
 void prefs_other_done(void)