diff options
author | Ted Gould <ted@canonical.com> | 2009-09-16 11:34:26 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-09-16 11:34:26 -0500 |
commit | cd4b5a1f7a0a9a3905dee1557e3edf9be46b826e (patch) | |
tree | ea1b81c7ea1b4d6aa84e802ae5a3710ed0dd4cc4 /src/users-service.c | |
parent | 24543619fb480c635209d8f2382845cb2562a5f1 (diff) | |
parent | 35cc4970e77115c83c54bd6a4035a3af761cc0b1 (diff) | |
download | ayatana-indicator-session-cd4b5a1f7a0a9a3905dee1557e3edf9be46b826e.tar.gz ayatana-indicator-session-cd4b5a1f7a0a9a3905dee1557e3edf9be46b826e.tar.bz2 ayatana-indicator-session-cd4b5a1f7a0a9a3905dee1557e3edf9be46b826e.zip |
Merging in design team requested fixes for labels and menu item placement.
Diffstat (limited to 'src/users-service.c')
-rw-r--r-- | src/users-service.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/users-service.c b/src/users-service.c index d50a277..7ad1732 100644 --- a/src/users-service.c +++ b/src/users-service.c @@ -109,10 +109,42 @@ activate_new_session (DbusmenuMenuitem * mi, gpointer user_data) return; } +/* A fun little function to actually lock the screen. If, + that's what you want, let's do it! */ +static void +lock_screen (DbusmenuMenuitem * mi, gpointer data) +{ + g_debug("Lock Screen"); + + DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + g_return_if_fail(session_bus != NULL); + + DBusGProxy * proxy = dbus_g_proxy_new_for_name_owner(session_bus, + "org.gnome.ScreenSaver", + "/", + "org.gnome.ScreenSaver", + NULL); + g_return_if_fail(proxy != NULL); + + dbus_g_proxy_call_no_reply(proxy, + "Lock", + G_TYPE_INVALID, + G_TYPE_INVALID); + + g_object_unref(proxy); + + return; +} + static void create_items (DbusmenuMenuitem * root) { DbusmenuMenuitem * mi = NULL; + mi = dbusmenu_menuitem_new(); + dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Lock Screen")); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(lock_screen), NULL); + dbusmenu_menuitem_child_append(root, mi); + if (check_guest_session()) { mi = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Guest Session")); @@ -122,7 +154,7 @@ create_items (DbusmenuMenuitem * root) { if (check_new_session()) { mi = dbusmenu_menuitem_new(); - dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("New Session...")); + dbusmenu_menuitem_property_set(mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Switch User...")); dbusmenu_menuitem_child_append(root, mi); g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(activate_new_session), NULL); } |