[totem] Add GConf key to disable all keyboard shortcuts



commit c8baa5bdf6737a7e82025e99a83376f6ea174365
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Dec 15 16:16:43 2009 +0000

    Add GConf key to disable all keyboard shortcuts
    
    https://bugzilla.gnome.org/show_bug.cgi?id=573149

 data/totem.schemas.in   |   14 +++++++++++++-
 src/totem-object.c      |    2 ++
 src/totem-preferences.c |   16 ++++++++++++++++
 src/totem-private.h     |    1 +
 4 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/data/totem.schemas.in b/data/totem.schemas.in
index cc1454c..9af719b 100644
--- a/data/totem.schemas.in
+++ b/data/totem.schemas.in
@@ -292,7 +292,7 @@
       </schema>
 
       <schema>
-        <key>/schemas/apps/disable_user_plugins</key>
+        <key>/schemas/apps/totem/disable_user_plugins</key>
 	<applyto>/apps/totem/disable_user_plugins</applyto>
 	<owner>totem</owner>
 	<type>bool</type>
@@ -304,6 +304,18 @@
       </schema>
 
       <schema>
+        <key>/schemas/apps/disable_keyboard_shortcuts</key>
+	<applyto>/apps/totem/disable_keyboard_shortcuts</applyto>
+	<owner>totem</owner>
+	<type>bool</type>
+	<default>false</default>
+	<locale name="C">
+	  <short>Whether to disable the keyboard shortcuts</short>
+	  <long>Whether to disable the keyboard shortcuts</long>
+	</locale>
+      </schema>
+
+      <schema>
         <key>/schemas/apps/totem/autoload_subtitles</key>
 	<applyto>/apps/totem/autoload_subtitles</applyto>
 	<owner>totem</owner>
diff --git a/src/totem-object.c b/src/totem-object.c
index 9260ef3..2e4bd62 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -3818,6 +3818,8 @@ window_key_press_event_cb (GtkWidget *win, GdkEventKey *event, Totem *totem)
 {
 	if (totem_sidebar_is_focused (totem) != FALSE)
 		return FALSE;
+	if (totem->disable_kbd_shortcuts != FALSE)
+		return FALSE;
 
 	/* Special case Eject, Open, Open URI and
 	 * seeking keyboard shortcuts */
diff --git a/src/totem-preferences.c b/src/totem-preferences.c
index b60cfc9..3198eae 100644
--- a/src/totem-preferences.c
+++ b/src/totem-preferences.c
@@ -285,6 +285,16 @@ show_vfx_changed_cb (GConfClient *client, guint cnxn_id,
 }
 
 static void
+disable_kbd_shortcuts_changed_cb (GConfClient *client,
+				  guint cnxn_id,
+				  GConfEntry *entry,
+				  Totem *totem)
+{
+	totem->disable_kbd_shortcuts = gconf_client_get_bool (totem->gc,
+							      GCONF_PREFIX"/disable_keyboard_shortcuts", NULL);
+}
+
+static void
 lock_screensaver_on_audio_changed_cb (GConfClient *client, guint cnxn_id,
 				      GConfEntry *entry, Totem *totem)
 {
@@ -730,6 +740,12 @@ totem_setup_preferences (Totem *totem)
 			(GConfClientNotifyFunc) encoding_changed_cb,
 			totem, NULL, NULL);
 
+	/* Disable keyboard shortcuts */
+	totem->disable_kbd_shortcuts = gconf_client_get_bool (totem->gc,
+							      GCONF_PREFIX"/disable_keyboard_shortcuts", NULL);
+	gconf_client_notify_add (totem->gc, GCONF_PREFIX"/disable_keyboard_shortcuts",
+				 (GConfClientNotifyFunc) disable_kbd_shortcuts_changed_cb,
+				 totem, NULL, NULL);
 }
 
 void
diff --git a/src/totem-private.h b/src/totem-private.h
index 22e5c58..43abc26 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -162,6 +162,7 @@ struct TotemObject {
 	TotemStates state;
 	TotemOpenLocation *open_location;
 	gboolean remember_position;
+	gboolean disable_kbd_shortcuts;
 
 	/* Stored source_window of GdkDragContext from a video drag,
 	 * used to detect when the video is dropped on itself. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]