Merge lp:~cjcurran/indicator-session/hide-real-name-on-panel-gsetting into lp:indicator-session/0.1

Proposed by Conor Curran
Status: Merged
Approved by: Ted Gould
Approved revision: 210
Merged at revision: 210
Proposed branch: lp:~cjcurran/indicator-session/hide-real-name-on-panel-gsetting
Merge into: lp:indicator-session/0.1
Diff against target: 117 lines (+40/-14)
3 files modified
data/com.canonical.indicator.session.gschema.xml.in (+12/-0)
src/indicator-session.c (+20/-7)
src/settings-helper.h (+8/-7)
To merge this branch: bzr merge lp:~cjcurran/indicator-session/hide-real-name-on-panel-gsetting
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+74656@code.launchpad.net

Description of the change

hide real name from panel, along for user name in switch menu item

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
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.gschema.xml.in'
2--- data/com.canonical.indicator.session.gschema.xml.in 2011-09-06 17:07:55 +0000
3+++ data/com.canonical.indicator.session.gschema.xml.in 2011-09-08 17:45:23 +0000
4@@ -20,11 +20,23 @@
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="show-real-name-on-panel">
9+ <default>true</default>
10+ <summary>Determine the visibility of the User's real name on the panel</summary>
11+ <description>Allow for the Removal of the users name from the panel</description>
12+ </key>
13 <key type="b" name="user-show-menu">
14 <default>true</default>
15 <summary>Determine the visibility of the User Menu</summary>
16 <description>Allow for the user menu to be hidden by the user.</description>
17 </key>
18+ <key type="b" name="use-username-in-switch-item">
19+ <default>false</default>
20+ <summary>Determine what string to use for the user's name in the switch menuitem.</summary>
21+ <description>The switch menuitem as part of the user menu should be default have the label 'Switch User Account'.
22+ This settings gives the user the potential to have the label read 'Switch from $username'</description>
23+ </key>
24+
25 </schema>
26
27 </schemalist>
28
29=== modified file 'src/indicator-session.c'
30--- src/indicator-session.c 2011-09-06 16:59:18 +0000
31+++ src/indicator-session.c 2011-09-08 17:45:23 +0000
32@@ -539,10 +539,16 @@
33 if (g_strcmp0(translate, "1") != 0) {
34 no_name_in_lang = TRUE;
35 }
36+
37+ GSettings* settings = g_settings_new ("com.canonical.indicator.session");
38+ gboolean use_username = g_settings_get_boolean (settings,
39+ "use-username-in-switch-item");
40+ g_object_unref (settings);
41
42 if (variant == NULL || g_variant_get_string(variant, NULL) == NULL ||
43- g_variant_get_string(variant, NULL)[0] == '\0' || no_name_in_lang) {
44- finalstring = _("Switch User…");
45+ g_variant_get_string(variant, NULL)[0] == '\0' || no_name_in_lang
46+ || use_username == FALSE) {
47+ finalstring = _("Switch User Account…");
48 set_ellipsize = FALSE;
49 }
50
51@@ -587,7 +593,6 @@
52 gtk_label_set_ellipsize(label, PANGO_ELLIPSIZE_NONE);
53 }
54 }
55-
56 return;
57 }
58
59@@ -698,13 +703,21 @@
60 static void
61 indicator_session_update_users_label (IndicatorSession* self,
62 const gchar* name)
63-{
64- g_debug ("update users label");
65-
66+{
67 if (name == NULL){
68 gtk_widget_hide(GTK_WIDGET(self->users.label));
69 return;
70 }
71+
72+ GSettings* settings = g_settings_new ("com.canonical.indicator.session");
73+ gboolean use_name = g_settings_get_boolean (settings,
74+ "show-real-name-on-panel");
75+ g_object_unref (settings);
76 gtk_label_set_text (self->users.label, g_strdup(name));
77- gtk_widget_show(GTK_WIDGET(self->users.label));
78+ if (use_name){
79+ gtk_widget_show(GTK_WIDGET(self->users.label));
80+ }
81+ else{
82+ gtk_widget_hide(GTK_WIDGET(self->users.label));
83+ }
84 }
85
86=== modified file 'src/settings-helper.h'
87--- src/settings-helper.h 2011-09-06 16:36:25 +0000
88+++ src/settings-helper.h 2011-09-08 17:45:23 +0000
89@@ -21,7 +21,7 @@
90
91
92 #ifndef __GCONF_HELPER_H__
93-#define __GCONF_HELPER_H__ 1
94+#define __GCONF_HELPER_H__
95
96 #include <glib/gi18n.h>
97
98@@ -31,12 +31,13 @@
99 #include <libdbusmenu-glib/server.h>
100 #include <libdbusmenu-glib/menuitem.h>
101
102-#define SESSION_SCHEMA "com.canonical.indicator.session"
103-#define SUPPRESS_KEY "suppress-logout-restart-shutdown"
104-#define LOGOUT_KEY "suppress-logout-menuitem"
105-#define RESTART_KEY "suppress-restart-menuitem"
106-#define SHUTDOWN_KEY "suppress-shutdown-menuitem"
107-#define SHOW_USER_MENU "user-show-menu"
108+#define SESSION_SCHEMA "com.canonical.indicator.session"
109+#define SUPPRESS_KEY "suppress-logout-restart-shutdown"
110+#define LOGOUT_KEY "suppress-logout-menuitem"
111+#define RESTART_KEY "suppress-restart-menuitem"
112+#define SHUTDOWN_KEY "suppress-shutdown-menuitem"
113+#define SHOW_USER_MENU "user-show-menu"
114+#define USER_USERNAME_IN_SWITCH_ITEM "use-username-in-switch-item"
115
116 #define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown"
117 #define LOCKDOWN_KEY_USER "disable-user-switching"

Subscribers

People subscribed via source and target branches