From fcf32dbec44550b677610791f905c8dc8d1d097a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 6 Aug 2010 13:40:30 -0500 Subject: Putting the shortcut on the menuitem --- configure.ac | 1 + src/session-service.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 168f5bc..aae4584 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,7 @@ AC_SUBST(APPLET_LIBS) DBUSMENUGLIB_REQUIRED_VERSION=0.1.1 PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib >= $DBUSMENUGLIB_REQUIRED_VERSION + dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION gio-unix-2.0 indicator >= $INDICATOR_REQUIRED_VERSION) diff --git a/src/session-service.c b/src/session-service.c index feef5e7..2872de0 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -36,6 +36,7 @@ with this program. If not, see . #include #include #include +#include #include @@ -136,7 +137,10 @@ keybinding_changed (GConfClient *client, } if (g_strcmp0 (key, KEY_LOCK_SCREEN) == 0) { - // TODO: set value + g_debug("Keybinding changed to: %s", gconf_value_get_string(value)); + if (lock_menuitem != NULL) { + dbusmenu_menuitem_property_set_shortcut_string(lock_menuitem, gconf_value_get_string(value)); + } } return; @@ -544,6 +548,16 @@ rebuild_items (DbusmenuMenuitem *root, if (can_lockscreen) { lock_menuitem = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, _("Lock Screen")); + + gchar * shortcut = gconf_client_get_string(gconf_client, KEY_LOCK_SCREEN, NULL); + if (shortcut != NULL) { + g_debug("Lock screen shortcut: %s", shortcut); + dbusmenu_menuitem_property_set_shortcut_string(lock_menuitem, shortcut); + g_free(shortcut); + } else { + g_debug("Unable to get lock screen shortcut."); + } + g_signal_connect(G_OBJECT(lock_menuitem), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(lock_screen), NULL); dbusmenu_menuitem_child_append(root, lock_menuitem); } -- cgit v1.2.3