diff options
-rw-r--r-- | data/com.canonical.indicator.session | 3 | ||||
-rw-r--r-- | debian/changelog | 8 | ||||
-rw-r--r-- | src/service.c | 45 |
3 files changed, 45 insertions, 11 deletions
diff --git a/data/com.canonical.indicator.session b/data/com.canonical.indicator.session index 7b69873..e2ec730 100644 --- a/data/com.canonical.indicator.session +++ b/data/com.canonical.indicator.session @@ -9,5 +9,8 @@ ObjectPath=/com/canonical/indicator/session/desktop [desktop_greeter] ObjectPath=/com/canonical/indicator/session/desktop_greeter +[desktop_lockscreen] +ObjectPath=/com/canonical/indicator/session/desktop_lockscreen + [ubiquity] ObjectPath=/com/canonical/indicator/session/desktop_greeter diff --git a/debian/changelog b/debian/changelog index 5e12a0f..e34c3d3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +indicator-session (12.10.5+14.04.20140311.1-0ubuntu1) trusty; urgency=low + + [ Marco Trevisan (Treviño) ] + * IndicatorSessionService: add desktop_lockscreen mode, show users and + switch to account items + + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Tue, 11 Mar 2014 19:21:29 +0000 + indicator-session (12.10.5+14.04.20140214-0ubuntu1) trusty; urgency=low [ Robert Ancell ] diff --git a/src/service.c b/src/service.c index b65079f..2321d0a 100644 --- a/src/service.c +++ b/src/service.c @@ -66,13 +66,15 @@ enum { PROFILE_DESKTOP, PROFILE_GREETER, + PROFILE_LOCKSCREEN, N_PROFILES }; static const char * const menu_names[N_PROFILES] = { "desktop", - "desktop_greeter" + "desktop_greeter", + "desktop_lockscreen" }; struct ProfileMenuInfo @@ -229,7 +231,7 @@ update_header_action (IndicatorSessionService * self) **** USERS ***/ -static GMenuModel * create_switch_section (IndicatorSessionService * self); +static GMenuModel * create_switch_section (IndicatorSessionService * self, int profile); static void add_user (IndicatorSessionService * self, guint uid) @@ -480,11 +482,11 @@ serialize_icon_file (const gchar * filename) } static GMenuModel * -create_switch_section (IndicatorSessionService * self) +create_switch_section (IndicatorSessionService * self, int profile) { - gchar * str; GMenu * menu; GMenuItem * item; + gboolean want_accel; guint i; gpointer guser; GHashTableIter iter; @@ -499,12 +501,15 @@ create_switch_section (IndicatorSessionService * self) { const char * action = "indicator.switch-to-screensaver"; item = g_menu_item_new (_("Start Screen Saver"), action); + want_accel = TRUE; } - else if (indicator_session_guest_is_active (p->backend_guest)) + else if (profile == PROFILE_LOCKSCREEN || + indicator_session_guest_is_active (p->backend_guest)) { const char * action = "indicator.switch-to-greeter"; item = g_menu_item_new (ellipsis ? _("Switch Account…") : _("Switch Account"), action); + want_accel = FALSE; } else { @@ -515,13 +520,20 @@ create_switch_section (IndicatorSessionService * self) else item = g_menu_item_new (ellipsis ? _("Lock/Switch Account…") : _("Lock/Switch Account"), action); + + want_accel = TRUE; + } + + if (want_accel) + { + gchar * str = g_settings_get_string (p->keybinding_settings, "screensaver"); + g_menu_item_set_attribute (item, "accel", "s", str); + g_free (str); } - str = g_settings_get_string (p->keybinding_settings, "screensaver"); - g_menu_item_set_attribute (item, "accel", "s", str); - g_free (str); + g_menu_append_item (menu, item); g_object_unref (item); - + if (indicator_session_guest_is_allowed (p->backend_guest)) { GMenuItem *item; @@ -555,6 +567,9 @@ create_switch_section (IndicatorSessionService * self) const IndicatorSessionUser * u = g_ptr_array_index (users, i); GVariant * serialized_icon; + if (profile == PROFILE_LOCKSCREEN && u->is_current_user) + continue; + item = g_menu_item_new (get_user_label (u), NULL); g_menu_item_set_action_and_target (item, "indicator.switch-to-user", "s", u->user_name); g_menu_item_set_attribute (item, "x-canonical-type", "s", "indicator.user-menu-item"); @@ -640,7 +655,7 @@ create_menu (IndicatorSessionService * self, int profile) { sections[n++] = create_admin_section (); sections[n++] = create_settings_section (self); - sections[n++] = create_switch_section (self); + sections[n++] = create_switch_section (self, profile); sections[n++] = create_logout_section (self); sections[n++] = create_session_section (self); } @@ -648,6 +663,11 @@ create_menu (IndicatorSessionService * self, int profile) { sections[n++] = create_session_section (self); } + else if (profile == PROFILE_LOCKSCREEN) + { + sections[n++] = create_switch_section (self, profile); + sections[n++] = create_session_section (self); + } /* add sections to the submenu */ submenu = g_menu_new (); @@ -862,6 +882,7 @@ rebuild_now (IndicatorSessionService * self, int sections) priv_t * p = self->priv; struct ProfileMenuInfo * desktop = &p->menus[PROFILE_DESKTOP]; struct ProfileMenuInfo * greeter = &p->menus[PROFILE_GREETER]; + struct ProfileMenuInfo * lockscreen = &p->menus[PROFILE_LOCKSCREEN]; if (sections & SECTION_HEADER) { @@ -880,7 +901,8 @@ rebuild_now (IndicatorSessionService * self, int sections) if (sections & SECTION_SWITCH) { - rebuild_section (desktop->submenu, 2, create_switch_section(self)); + rebuild_section (desktop->submenu, 2, create_switch_section(self, PROFILE_DESKTOP)); + rebuild_section (lockscreen->submenu, 0, create_switch_section(self, PROFILE_LOCKSCREEN)); update_switch_actions (self); } @@ -893,6 +915,7 @@ rebuild_now (IndicatorSessionService * self, int sections) { rebuild_section (desktop->submenu, 4, create_session_section(self)); rebuild_section (greeter->submenu, 0, create_session_section(self)); + rebuild_section (lockscreen->submenu, 1, create_session_section(self)); } } |