aboutsummaryrefslogtreecommitdiff
path: root/src/gconf-helper.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-03-16 10:03:09 -0500
committerTed Gould <ted@gould.cx>2010-03-16 10:03:09 -0500
commit4103fca23c5dd1668e9685785b8da8dcafc72df7 (patch)
tree62b7e5180f8a60663d3836c0a0f867ad436ee76f /src/gconf-helper.c
parent9b55c3d958f7fe43e92c9e9de4b955a5eac680e7 (diff)
parentae2c94b40826bfa0274a3eae8ae515d99b07adb5 (diff)
downloadayatana-indicator-session-4103fca23c5dd1668e9685785b8da8dcafc72df7.tar.gz
ayatana-indicator-session-4103fca23c5dd1668e9685785b8da8dcafc72df7.tar.bz2
ayatana-indicator-session-4103fca23c5dd1668e9685785b8da8dcafc72df7.zip
Adding a GConf key for showing the logout item.
Diffstat (limited to 'src/gconf-helper.c')
-rw-r--r--src/gconf-helper.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gconf-helper.c b/src/gconf-helper.c
index 5efc439..588b11c 100644
--- a/src/gconf-helper.c
+++ b/src/gconf-helper.c
@@ -43,6 +43,14 @@ supress_confirmations (void) {
return gconf_client_get_bool (gconf_client, SUPPRESS_KEY, NULL) ;
}
+gboolean
+show_logout (void) {
+ if(!gconf_client) {
+ gconf_client = gconf_client_get_default ();
+ }
+ return !gconf_client_get_bool (gconf_client, LOGOUT_KEY, NULL) ;
+}
+
static void update_menu_entries_callback (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer data) {
RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi = (RestartShutdownLogoutMenuItems*) data;
GConfValue * value = gconf_entry_get_value (entry);
@@ -61,8 +69,19 @@ static void update_menu_entries_callback (GConfClient *client, guint cnxn_id, GC
}
}
+static void
+update_logout_callback (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer data) {
+ DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data;
+ GConfValue * value = gconf_entry_get_value (entry);
+ const gchar * key = gconf_entry_get_key (entry);
+
+ if(g_strcmp0 (key, LOGOUT_KEY) == 0) {
+ dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !gconf_value_get_bool(value));
+ }
+}
+
void
-update_menu_entries(RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi) {
+update_menu_entries(RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi, DbusmenuMenuitem * logoutitem) {
if(!gconf_client) {
gconf_client = gconf_client_get_default ();
}
@@ -70,5 +89,7 @@ update_menu_entries(RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi)
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
gconf_client_notify_add (gconf_client, SUPPRESS_KEY,
update_menu_entries_callback, restart_shutdown_logout_mi, NULL, NULL);
+ gconf_client_notify_add (gconf_client, LOGOUT_KEY,
+ update_logout_callback, logoutitem, NULL, NULL);
}