gnome-settings-daemon r604 - in trunk: . data plugins/keybindings
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-settings-daemon r604 - in trunk: . data plugins/keybindings
- Date: Tue, 11 Nov 2008 05:05:08 +0000 (UTC)
Author: matthiasc
Date: Tue Nov 11 05:05:08 2008
New Revision: 604
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=604&view=rev
Log:
2008-11-11 Matthias Clasen <mclasen redhat com>
Bug 553434 â lockdown in the keybinding plugin
* data/Makefile.am: Install the new schema file.
* data/desktop_gnome_keybindings.schemas.in: Add schema for
/desktop/gnome/keybindings/allowed_keys.
* plugins/keybindings/gsd-keybinding-manager.c: Support locking
down keybindings with a list of allowed keys.
Added:
trunk/data/desktop_gnome_keybindings.schemas.in
Modified:
trunk/ChangeLog
trunk/data/Makefile.am
trunk/plugins/keybindings/gsd-keybindings-manager.c
Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am (original)
+++ trunk/data/Makefile.am Tue Nov 11 05:05:08 2008
@@ -8,6 +8,7 @@
apps_gnome_settings_daemon_keybindings.schemas.in \
apps_gnome_settings_daemon_screensaver.schemas.in \
desktop_gnome_font_rendering.schemas.in \
+ desktop_gnome_keybindings.schemas.in \
apps_gnome_settings_daemon_xrandr.schemas.in \
$(NULL)
Added: trunk/data/desktop_gnome_keybindings.schemas.in
==============================================================================
--- (empty file)
+++ trunk/data/desktop_gnome_keybindings.schemas.in Tue Nov 11 05:05:08 2008
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<gconfschemafile>
+ <schemalist>
+ <schema>
+ <key>/schemas/desktop/gnome/keybindings/allowed_keys</key>
+ <applyto>/desktop/gnome/keybindings/allowed_keys</applyto>
+ <owner>gnome</owner>
+ <type>list</type>
+ <list_type>string</list_type>
+ <default>[]</default>
+ <locale name="C">
+ <short>Allowed keys</short>
+ <long>
+ If nonempty, keybindings will be ignored unless their GConf
+ directory is in the list. This is useful for lockdown.
+ </long>
+ </locale>
+ </schema>
+ </schemalist>
+</gconfschemafile>
Modified: trunk/plugins/keybindings/gsd-keybindings-manager.c
==============================================================================
--- trunk/plugins/keybindings/gsd-keybindings-manager.c (original)
+++ trunk/plugins/keybindings/gsd-keybindings-manager.c Tue Nov 11 05:05:08 2008
@@ -45,6 +45,7 @@
#include "eggaccelerators.h"
#define GCONF_BINDING_DIR "/desktop/gnome/keybindings"
+#define ALLOWED_KEYS_KEY GCONF_BINDING_DIR "/allowed_keys"
#define GSD_KEYBINDINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_KEYBINDINGS_MANAGER, GsdKeybindingsManagerPrivate))
@@ -59,6 +60,7 @@
struct GsdKeybindingsManagerPrivate
{
GSList *binding_list;
+ GSList *allowed_keys;
GSList *screens;
guint notify;
};
@@ -263,6 +265,13 @@
for (li = manager->priv->binding_list ; li != NULL; li = li->next) {
Binding *binding = (Binding *) li->data;
+ if (manager->priv->allowed_keys != NULL &&
+ !g_slist_find_custom (manager->priv->allowed_keys,
+ binding->gconf_key,
+ g_strcmp0)) {
+ continue;
+ }
+
if (binding->previous_key.keycode != binding->key.keycode ||
binding->previous_key.state != binding->key.state) {
/* Ungrab key if it changed and not clashing with previously set binding */
@@ -436,18 +445,27 @@
char** key_elems;
char* binding_entry;
- /* ensure we get binding dir not a sub component */
-
- key_elems = g_strsplit (gconf_entry_get_key (entry), "/", 15);
- binding_entry = g_strdup_printf ("/%s/%s/%s/%s",
- key_elems[1],
- key_elems[2],
- key_elems[3],
- key_elems[4]);
- g_strfreev (key_elems);
+ if (strcmp (gconf_entry_get_key (entry), ALLOWED_KEYS_KEY) == 0) {
+ g_slist_foreach (manager->priv->allowed_keys, (GFunc)g_free, NULL);
+ g_slist_free (manager->priv->allowed_keys);
+ manager->priv->allowed_keys = gconf_client_get_list (client,
+ ALLOWED_KEYS_KEY,
+ GCONF_VALUE_STRING,
+ NULL);
+ }
+ else {
+ /* ensure we get binding dir not a sub component */
+ key_elems = g_strsplit (gconf_entry_get_key (entry), "/", 15);
+ binding_entry = g_strdup_printf ("/%s/%s/%s/%s",
+ key_elems[1],
+ key_elems[2],
+ key_elems[3],
+ key_elems[4]);
+ g_strfreev (key_elems);
- bindings_get_entry (manager, client, binding_entry);
- g_free (binding_entry);
+ bindings_get_entry (manager, client, binding_entry);
+ g_free (binding_entry);
+ }
binding_register_keys (manager);
}
@@ -479,6 +497,10 @@
client = gconf_client_get_default ();
+ manager->priv->allowed_keys = gconf_client_get_list (client,
+ ALLOWED_KEYS_KEY,
+ GCONF_VALUE_STRING,
+ NULL);
manager->priv->notify = register_config_callback (manager,
client,
GCONF_BINDING_DIR,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]