summaryrefslogtreecommitdiff
path: root/gtk/gtkwindow.c
diff options
context:
space:
mode:
authorMichael Natterer <mitch@imendio.com>2007-02-05 14:11:39 +0000
committerMichael Natterer <mitch@src.gnome.org>2007-02-05 14:11:39 +0000
commit17fed85c24c8280217e4ebf6c75f691595abd887 (patch)
tree49a3da32c52f908883e87e4a4a475077d80fba38 /gtk/gtkwindow.c
parentaca7e2316a79855f403ca3ed90772ae08e2dd8c8 (diff)
downloadgtk+-17fed85c24c8280217e4ebf6c75f691595abd887.tar.gz
add new boolean settings gtk-enable-accels and gtk-enable-mnemonics which
2007-02-05 Michael Natterer <mitch@imendio.com> * gtk/gtksettings.c: add new boolean settings gtk-enable-accels and gtk-enable-mnemonics which enable/disable accelerators and mnemonics (bug #72375, based on a patch from Tommi Komulainen). * gtk/gtkwindow.c (gtk_window_activate_key) * gtk/gtkmenushell.c (gtk_menu_shell_key_press): don't invoke them if the resp. setting is FALSE. * gtk/gtkaccellabel.c (gtk_accel_label_refetch) * gtk/gtklabel.c (gtk_label_set_pattern_internal): don't display them if the setting is FALSE. * gtk/gtklabel.c: added signal connection to the screen's settings object and traverse all widgets on the screen when the setting changes. It's slightly ugly to also update GtkAccelLabels here, but less ugly than connecting and traversing all widgets twice. svn path=/trunk/; revision=17262
Diffstat (limited to 'gtk/gtkwindow.c')
-rw-r--r--gtk/gtkwindow.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index f72bd21be4..3766f38e18 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7698,13 +7698,29 @@ gtk_window_activate_key (GtkWindow *window,
if (found_entry)
{
+ gboolean enable_mnemonics;
+ gboolean enable_accels;
+
+ g_object_get (gtk_widget_get_settings (GTK_WIDGET (window)),
+ "gtk-enable-mnemonics", &enable_mnemonics,
+ "gtk-enable-accels", &enable_accels,
+ NULL);
+
if (found_entry->is_mnemonic)
- return gtk_window_mnemonic_activate (window, found_entry->keyval, found_entry->modifiers);
+ {
+ if (enable_mnemonics)
+ return gtk_window_mnemonic_activate (window, found_entry->keyval,
+ found_entry->modifiers);
+ }
else
- return gtk_accel_groups_activate (G_OBJECT (window), found_entry->keyval, found_entry->modifiers);
+ {
+ if (enable_accels)
+ return gtk_accel_groups_activate (G_OBJECT (window), found_entry->keyval,
+ found_entry->modifiers);
+ }
}
- else
- return FALSE;
+
+ return FALSE;
}
static void