Merge lp:~cjcurran/indicator-session/hide-user-menu-via-gsettings-key into lp:indicator-session/0.1

Proposed by Conor Curran
Status: Merged
Approved by: Ted Gould
Approved revision: 206
Merged at revision: 204
Proposed branch: lp:~cjcurran/indicator-session/hide-user-menu-via-gsettings-key
Merge into: lp:indicator-session/0.1
Diff against target: 134 lines (+31/-16)
4 files modified
data/com.canonical.indicator.session.gschema.xml.in (+6/-0)
src/settings-helper.c (+6/-0)
src/settings-helper.h (+3/-0)
src/user-menu-mgr.c (+16/-16)
To merge this branch: bzr merge lp:~cjcurran/indicator-session/hide-user-menu-via-gsettings-key
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+74262@code.launchpad.net

This proposal supersedes a proposal from 2011-09-06.

Description of the change

The user menu turns up on the live CD, this new gsettings entry will allow casper to set the usermenu entry to false for the live cd and hence always ensure the user menu is hidden during the live session.

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
review: Approve
207. By Conor Curran

updated the schema entry with the correct key

208. By Conor Curran

updated the schema entry with the correct key

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.gschema.xml.in'
2--- data/com.canonical.indicator.session.gschema.xml.in 2011-08-23 21:30:32 +0000
3+++ data/com.canonical.indicator.session.gschema.xml.in 2011-09-06 17:09:25 +0000
4@@ -20,5 +20,11 @@
5 <_summary>Remove the shutdown item from the session menu</_summary>
6 <_description>Makes it so that the shutdown button doesn’t show in the session menu.</_description>
7 </key>
8+ <key type="b" name="user-show-menu">
9+ <default>true</default>
10+ <summary>Determine the visibility of the User Menu</summary>
11+ <description>Allow for the user menu to be hidden by the user.</description>
12+ </key>
13 </schema>
14+
15 </schemalist>
16
17=== modified file 'src/settings-helper.c'
18--- src/settings-helper.c 2011-08-22 12:32:00 +0000
19+++ src/settings-helper.c 2011-09-06 17:09:25 +0000
20@@ -53,6 +53,12 @@
21 }
22
23 gboolean
24+should_show_user_menu (void) {
25+ build_settings();
26+ return g_settings_get_boolean (settings, SHOW_USER_MENU) ;
27+}
28+
29+gboolean
30 show_logout (void) {
31 build_settings();
32 return !g_settings_get_boolean (settings, LOGOUT_KEY) ;
33
34=== modified file 'src/settings-helper.h'
35--- src/settings-helper.h 2011-08-19 20:09:03 +0000
36+++ src/settings-helper.h 2011-09-06 17:09:25 +0000
37@@ -36,6 +36,7 @@
38 #define LOGOUT_KEY "suppress-logout-menuitem"
39 #define RESTART_KEY "suppress-restart-menuitem"
40 #define SHUTDOWN_KEY "suppress-shutdown-menuitem"
41+#define SHOW_USER_MENU "user-show-menu"
42
43 #define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown"
44 #define LOCKDOWN_KEY_USER "disable-user-switching"
45@@ -56,5 +57,7 @@
46 gboolean show_logout (void);
47 gboolean show_restart (void);
48 gboolean show_shutdown (void);
49+gboolean should_show_user_menu (void);
50+
51
52 #endif /* __GCONF_HELPER__ */
53
54=== modified file 'src/user-menu-mgr.c'
55--- src/user-menu-mgr.c 2011-08-30 16:17:19 +0000
56+++ src/user-menu-mgr.c 2011-09-06 17:09:25 +0000
57@@ -18,7 +18,6 @@
58 */
59
60 #include <libdbusmenu-glib/client.h>
61-
62 #include "user-menu-mgr.h"
63 #include "settings-helper.h"
64 #include "dbus-shared-names.h"
65@@ -54,22 +53,19 @@
66 gpointer user_data);
67 static void activate_user_accounts (DbusmenuMenuitem *mi,
68 guint timestamp,
69- gpointer user_data);
70-
71+ gpointer user_data);
72 static void user_menu_mgr_rebuild_items (UserMenuMgr *self,
73 gboolean greeter_mode);
74 static gboolean check_new_session ();
75 static void user_change (UsersServiceDbus *service,
76 const gchar *user_id,
77 gpointer user_data);
78-
79 static void ensure_settings_client ();
80-static gboolean check_guest_session (void);
81+static gboolean is_this_guest_session (void);
82 static void activate_guest_session (DbusmenuMenuitem * mi,
83 guint timestamp,
84 gpointer user_data);
85
86-
87 G_DEFINE_TYPE (UserMenuMgr, user_menu_mgr, G_TYPE_OBJECT);
88
89
90@@ -148,7 +144,7 @@
91 self->users_dbus_interface);
92 }
93
94- if (check_guest_session ())
95+ if (is_this_guest_session ())
96 {
97 guest_mi = dbusmenu_menuitem_new ();
98 dbusmenu_menuitem_property_set (guest_mi,
99@@ -177,14 +173,18 @@
100 users = users_service_dbus_get_user_list (self->users_dbus_interface);
101 self->user_count = g_list_length(users);
102
103- gboolean user_menu_is_visible = FALSE;
104-
105- if (!greeter_mode){
106- user_menu_is_visible = TRUE;
107- }
108-
109- session_dbus_set_user_menu_visibility (self->session_dbus_interface,
110- user_menu_is_visible);
111+ gboolean user_menu_is_visible = should_show_user_menu();
112+
113+ if (user_menu_is_visible == FALSE || greeter_mode == TRUE){
114+ session_dbus_set_user_menu_visibility (self->session_dbus_interface,
115+ FALSE);
116+ }
117+ else{
118+ // This needs to be updated once the ability to query guest session support is available
119+ session_dbus_set_user_menu_visibility (self->session_dbus_interface,
120+ user_menu_is_visible);
121+ }
122+
123
124 if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) {
125 users = g_list_sort (users, (GCompareFunc)compare_users_by_username);
126@@ -415,7 +415,7 @@
127
128 /* Checks to see if we should show the guest suession item */
129 static gboolean
130-check_guest_session (void)
131+is_this_guest_session (void)
132 {
133 if (geteuid() < 500) {
134 /* System users shouldn't have guest account shown. Mostly

Subscribers

People subscribed via source and target branches