diff options
author | Ted Gould <ted@gould.cx> | 2011-08-19 12:03:29 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-08-19 12:03:29 -0500 |
commit | df3f3b8129650e2e843f9295bb092166f89e4057 (patch) | |
tree | c09e6dae0b220c7c7888d63a9e0ece7b0580c691 | |
parent | cb15da3ae85cbd185e4878aa0156e928db5d790e (diff) | |
download | ayatana-indicator-session-df3f3b8129650e2e843f9295bb092166f89e4057.tar.gz ayatana-indicator-session-df3f3b8129650e2e843f9295bb092166f89e4057.tar.bz2 ayatana-indicator-session-df3f3b8129650e2e843f9295bb092166f89e4057.zip |
Porting the keys for the device and user manager over to use gsettings
-rw-r--r-- | src/device-menu-mgr.c | 24 | ||||
-rw-r--r-- | src/gconf-helper.h | 10 | ||||
-rw-r--r-- | src/user-menu-mgr.c | 13 |
3 files changed, 27 insertions, 20 deletions
diff --git a/src/device-menu-mgr.c b/src/device-menu-mgr.c index cbddaa3..ef9567b 100644 --- a/src/device-menu-mgr.c +++ b/src/device-menu-mgr.c @@ -44,7 +44,8 @@ struct _DeviceMenuMgr UdevMgr* udev_mgr; }; -static GConfClient *gconf_client = NULL; +static GSettings *lockdown_settings = NULL; +static GSettings *keybinding_settings = NULL; static DbusmenuMenuitem *lock_menuitem = NULL; static DbusmenuMenuitem *system_settings_menuitem = NULL; static DbusmenuMenuitem *display_settings_menuitem = NULL; @@ -125,6 +126,7 @@ device_menu_mgr_class_init (DeviceMenuMgrClass *klass) object_class->finalize = device_menu_mgr_finalize; } +#if 0 // TODO // Is this needed anymore static void @@ -171,6 +173,7 @@ keybinding_changed (GConfClient *client, } return; } +#endif /* Check to see if the lockdown key is protecting from locking the screen. If not, lock it. */ @@ -178,7 +181,7 @@ static void lock_if_possible (DeviceMenuMgr* self) { device_menu_mgr_ensure_gconf_client (self); - if (!gconf_client_get_bool (gconf_client, LOCKDOWN_KEY_SCREENSAVER, NULL)) { + if (!g_settings_get_boolean (lockdown_settings, LOCKDOWN_KEY_SCREENSAVER)) { lock_screen (NULL, 0, NULL); } return; @@ -660,9 +663,8 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self, gboolean greeter_mode) /* Make sure we have a valid GConf client, and build one if needed */ device_menu_mgr_ensure_gconf_client (self); - can_lockscreen = !gconf_client_get_bool ( gconf_client, - LOCKDOWN_KEY_SCREENSAVER, - NULL); + can_lockscreen = !g_settings_get_boolean (lockdown_settings, + LOCKDOWN_KEY_SCREENSAVER); /* Lock screen item */ if (can_lockscreen) { lock_menuitem = dbusmenu_menuitem_new(); @@ -670,7 +672,7 @@ device_menu_mgr_build_static_items (DeviceMenuMgr* self, gboolean greeter_mode) DBUSMENU_MENUITEM_PROP_LABEL, _("Lock Screen")); - gchar * shortcut = gconf_client_get_string(gconf_client, KEY_LOCK_SCREEN, NULL); + gchar * shortcut = g_settings_get_string(keybinding_settings, KEY_LOCK_SCREEN); if (shortcut != NULL) { g_debug("Lock screen shortcut: %s", shortcut); dbusmenu_menuitem_property_set_shortcut_string(lock_menuitem, shortcut); @@ -832,8 +834,13 @@ setup_restart_watch (DeviceMenuMgr* self) static void device_menu_mgr_ensure_gconf_client (DeviceMenuMgr* self) { - if (!gconf_client) { - gconf_client = gconf_client_get_default (); + if (!lockdown_settings) { + lockdown_settings = g_settings_new (LOCKDOWN_SCHEMA); + } + if (!keybinding_settings) { + keybinding_settings = g_settings_new (KEYBINDING_SCHEMA); + } +#if 0 gconf_client_add_dir(gconf_client, LOCKDOWN_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); gconf_client_notify_add (gconf_client, LOCKDOWN_DIR, @@ -850,6 +857,7 @@ device_menu_mgr_ensure_gconf_client (DeviceMenuMgr* self) NULL, NULL); } +#endif } DbusmenuMenuitem* diff --git a/src/gconf-helper.h b/src/gconf-helper.h index b3b5151..1adb269 100644 --- a/src/gconf-helper.h +++ b/src/gconf-helper.h @@ -37,11 +37,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #define RESTART_KEY "suppress_restart_menuitem" #define SHUTDOWN_KEY "suppress_shutdown_menuitem" -#define LOCKDOWN_DIR "/desktop/gnome/lockdown" -#define LOCKDOWN_KEY_USER LOCKDOWN_DIR "/disable_user_switching" -#define LOCKDOWN_KEY_SCREENSAVER LOCKDOWN_DIR "/disable_lock_screen" -#define KEYBINDING_DIR "/apps/gnome_settings_daemon/keybindings" -#define KEY_LOCK_SCREEN KEYBINDING_DIR "/screensaver" +#define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown" +#define LOCKDOWN_KEY_USER "disable_user_switching" +#define LOCKDOWN_KEY_SCREENSAVER "disable_lock_screen" +#define KEYBINDING_SCHEMA "org.gnome.settings-daemon.plugins.media-keys" +#define KEY_LOCK_SCREEN "screensaver" typedef struct _RestartShutdownLogoutMenuItems { diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index 44c1960..3062f04 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -26,7 +26,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "lock-helper.h" #include "users-service-dbus.h" -static GConfClient * gconf_client = NULL; +static GSettings* settings = NULL; static DbusmenuMenuitem *switch_menuitem = NULL; struct _UserMenuMgr @@ -114,7 +114,7 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) /* Check to see which menu items we're allowed to have */ can_activate = users_service_dbus_can_activate_session (self->users_dbus_interface) && - !gconf_client_get_bool (gconf_client, LOCKDOWN_KEY_USER, NULL); + !g_settings_get_boolean (settings, LOCKDOWN_KEY_USER); /* Remove the old menu items if that makes sense */ children = dbusmenu_menuitem_take_children (self->root_item); @@ -290,7 +290,7 @@ static void lock_if_possible (void) { ensure_gconf_client (); - if (!gconf_client_get_bool (gconf_client, LOCKDOWN_KEY_SCREENSAVER, NULL)) { + if (!g_settings_get_boolean (settings, LOCKDOWN_KEY_SCREENSAVER)) { lock_screen(NULL, 0, NULL); } @@ -375,11 +375,10 @@ user_change (UsersServiceDbus *service, static void ensure_gconf_client () { - if (!gconf_client) { - gconf_client = gconf_client_get_default (); - gconf_client_add_dir (gconf_client, LOCKDOWN_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); - gconf_client_add_dir (gconf_client, KEYBINDING_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + if(!settings) { + settings = g_settings_new (SESSION_SCHEMA); } + return; } DbusmenuMenuitem* |