Merge lp:~3v1n0/indicator-session/lockscreen-mode into lp:indicator-session/14.04

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Charles Kerr
Approved revision: 434
Merged at revision: 434
Proposed branch: lp:~3v1n0/indicator-session/lockscreen-mode
Merge into: lp:indicator-session/14.04
Diff against target: 139 lines (+32/-10)
2 files modified
data/com.canonical.indicator.session (+3/-0)
src/service.c (+29/-10)
To merge this branch: bzr merge lp:~3v1n0/indicator-session/lockscreen-mode
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+210415@code.launchpad.net

Commit message

IndicatorSessionService: add desktop_lockscreen mode, show users and switch to account items

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

Looks good to me. Thanks Trevinho!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.indicator.session'
2--- data/com.canonical.indicator.session 2013-10-18 12:18:57 +0000
3+++ data/com.canonical.indicator.session 2014-03-11 14:06:58 +0000
4@@ -9,5 +9,8 @@
5 [desktop_greeter]
6 ObjectPath=/com/canonical/indicator/session/desktop_greeter
7
8+[desktop_lockscreen]
9+ObjectPath=/com/canonical/indicator/session/desktop_lockscreen
10+
11 [ubiquity]
12 ObjectPath=/com/canonical/indicator/session/desktop_greeter
13
14=== modified file 'src/service.c'
15--- src/service.c 2014-02-05 11:39:05 +0000
16+++ src/service.c 2014-03-11 14:06:58 +0000
17@@ -66,13 +66,15 @@
18 {
19 PROFILE_DESKTOP,
20 PROFILE_GREETER,
21+ PROFILE_LOCKSCREEN,
22 N_PROFILES
23 };
24
25 static const char * const menu_names[N_PROFILES] =
26 {
27 "desktop",
28- "desktop_greeter"
29+ "desktop_greeter",
30+ "desktop_lockscreen"
31 };
32
33 struct ProfileMenuInfo
34@@ -229,7 +231,7 @@
35 **** USERS
36 ***/
37
38-static GMenuModel * create_switch_section (IndicatorSessionService * self);
39+static GMenuModel * create_switch_section (IndicatorSessionService * self, int profile);
40
41 static void
42 add_user (IndicatorSessionService * self, guint uid)
43@@ -480,7 +482,7 @@
44 }
45
46 static GMenuModel *
47-create_switch_section (IndicatorSessionService * self)
48+create_switch_section (IndicatorSessionService * self, int profile)
49 {
50 gchar * str;
51 GMenu * menu;
52@@ -500,7 +502,8 @@
53 const char * action = "indicator.switch-to-screensaver";
54 item = g_menu_item_new (_("Start Screen Saver"), action);
55 }
56- else if (indicator_session_guest_is_active (p->backend_guest))
57+ else if (profile == PROFILE_LOCKSCREEN ||
58+ indicator_session_guest_is_active (p->backend_guest))
59 {
60 const char * action = "indicator.switch-to-greeter";
61 item = g_menu_item_new (ellipsis ? _("Switch Account…")
62@@ -516,12 +519,17 @@
63 item = g_menu_item_new (ellipsis ? _("Lock/Switch Account…")
64 : _("Lock/Switch Account"), action);
65 }
66- str = g_settings_get_string (p->keybinding_settings, "screensaver");
67- g_menu_item_set_attribute (item, "accel", "s", str);
68- g_free (str);
69+
70+ if (profile != PROFILE_LOCKSCREEN)
71+ {
72+ str = g_settings_get_string (p->keybinding_settings, "screensaver");
73+ g_menu_item_set_attribute (item, "accel", "s", str);
74+ g_free (str);
75+ }
76+
77 g_menu_append_item (menu, item);
78 g_object_unref (item);
79-
80+
81 if (indicator_session_guest_is_allowed (p->backend_guest))
82 {
83 GMenuItem *item;
84@@ -555,6 +563,9 @@
85 const IndicatorSessionUser * u = g_ptr_array_index (users, i);
86 GVariant * serialized_icon;
87
88+ if (profile == PROFILE_LOCKSCREEN && u->is_current_user)
89+ continue;
90+
91 item = g_menu_item_new (get_user_label (u), NULL);
92 g_menu_item_set_action_and_target (item, "indicator.switch-to-user", "s", u->user_name);
93 g_menu_item_set_attribute (item, "x-canonical-type", "s", "indicator.user-menu-item");
94@@ -640,7 +651,7 @@
95 {
96 sections[n++] = create_admin_section ();
97 sections[n++] = create_settings_section (self);
98- sections[n++] = create_switch_section (self);
99+ sections[n++] = create_switch_section (self, profile);
100 sections[n++] = create_logout_section (self);
101 sections[n++] = create_session_section (self);
102 }
103@@ -648,6 +659,11 @@
104 {
105 sections[n++] = create_session_section (self);
106 }
107+ else if (profile == PROFILE_LOCKSCREEN)
108+ {
109+ sections[n++] = create_switch_section (self, profile);
110+ sections[n++] = create_session_section (self);
111+ }
112
113 /* add sections to the submenu */
114 submenu = g_menu_new ();
115@@ -862,6 +878,7 @@
116 priv_t * p = self->priv;
117 struct ProfileMenuInfo * desktop = &p->menus[PROFILE_DESKTOP];
118 struct ProfileMenuInfo * greeter = &p->menus[PROFILE_GREETER];
119+ struct ProfileMenuInfo * lockscreen = &p->menus[PROFILE_LOCKSCREEN];
120
121 if (sections & SECTION_HEADER)
122 {
123@@ -880,7 +897,8 @@
124
125 if (sections & SECTION_SWITCH)
126 {
127- rebuild_section (desktop->submenu, 2, create_switch_section(self));
128+ rebuild_section (desktop->submenu, 2, create_switch_section(self, PROFILE_DESKTOP));
129+ rebuild_section (lockscreen->submenu, 0, create_switch_section(self, PROFILE_LOCKSCREEN));
130 update_switch_actions (self);
131 }
132
133@@ -893,6 +911,7 @@
134 {
135 rebuild_section (desktop->submenu, 4, create_session_section(self));
136 rebuild_section (greeter->submenu, 0, create_session_section(self));
137+ rebuild_section (lockscreen->submenu, 1, create_session_section(self));
138 }
139 }
140

Subscribers

People subscribed via source and target branches