Merge lp:~robert-ancell/unity-control-center/show-login-name into lp:unity-control-center

Proposed by Robert Ancell
Status: Merged
Approved by: Robert Ancell
Approved revision: 12706
Merged at revision: 12706
Proposed branch: lp:~robert-ancell/unity-control-center/show-login-name
Merge into: lp:unity-control-center
Diff against target: 96 lines (+47/-0)
2 files modified
panels/user-accounts/data/user-accounts-dialog.ui (+28/-0)
panels/user-accounts/um-user-panel.c (+19/-0)
To merge this branch: bzr merge lp:~robert-ancell/unity-control-center/show-login-name
Reviewer Review Type Date Requested Status
Sebastien Bacher Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+206325@code.launchpad.net

Commit message

Add option to toggle username in session indicator

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
Sebastien Bacher (seb128) wrote :

Thanks for working on that Robert!

The glib API [1] suggests to use g_settings_schema_source_lookup () rather than the loop approch, can you change that?
(https://developer.gnome.org/gio/unstable/gio-GSettingsSchema-GSettingsSchemaSource.html#g-settings-schema-source-lookup)

Otherwise code/behaviour looks fine

[1] https://developer.gnome.org/gio/unstable/GSettings.html#g-settings-list-schemas

review: Needs Fixing
12706. By Robert Ancell

Use g_settings_schema_source_lookup instead of g_settings_list_schemas

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panels/user-accounts/data/user-accounts-dialog.ui'
2--- panels/user-accounts/data/user-accounts-dialog.ui 2012-08-18 17:12:38 +0000
3+++ panels/user-accounts/data/user-accounts-dialog.ui 2014-02-17 21:23:56 +0000
4@@ -436,6 +436,34 @@
5 <property name="y_options">0</property>
6 </packing>
7 </child>
8+ <child>
9+ <object class="GtkLabel" id="show-login-name-spacer">
10+ <property name="visible">True</property>
11+ </object>
12+ <packing>
13+ <property name="right_attach">2</property>
14+ <property name="top_attach">7</property>
15+ <property name="bottom_attach">8</property>
16+ </packing>
17+ </child>
18+ <child>
19+ <object class="GtkCheckButton" id="show-login-name-checkbutton">
20+ <property name="label" translatable="yes">_Show my login name in the menu bar</property>
21+ <property name="use_underline">True</property>
22+ <property name="visible">True</property>
23+ <property name="can_focus">True</property>
24+ <property name="receives_default">False</property>
25+ <property name="xalign">0</property>
26+ <property name="draw_indicator">True</property>
27+ </object>
28+ <packing>
29+ <property name="right_attach">2</property>
30+ <property name="top_attach">8</property>
31+ <property name="bottom_attach">9</property>
32+ <property name="x_options">GTK_FILL</property>
33+ <property name="y_options">0</property>
34+ </packing>
35+ </child>
36 </object>
37 <packing>
38 <property name="expand">False</property>
39
40=== modified file 'panels/user-accounts/um-user-panel.c'
41--- panels/user-accounts/um-user-panel.c 2013-11-29 06:28:37 +0000
42+++ panels/user-accounts/um-user-panel.c 2014-02-17 21:23:56 +0000
43@@ -55,6 +55,7 @@
44 #include "cc-common-language.h"
45
46 #define USER_ACCOUNTS_PERMISSION "com.canonical.controlcenter.user-accounts.administration"
47+#define INDICATOR_SESSION_SCHEMA "com.canonical.indicator.session"
48
49 CC_PANEL_REGISTER (UmUserPanel, um_user_panel)
50
51@@ -71,6 +72,8 @@
52
53 UmPasswordDialog *password_dialog;
54 UmPhotoDialog *photo_dialog;
55+
56+ GSettings *indicator_session_schema;
57 };
58
59 static GtkWidget *
60@@ -635,6 +638,14 @@
61 !is_using_ecryptfs (um_user_get_user_name (user));
62 gtk_widget_set_visible (widget, show);
63 gtk_widget_set_visible (label, show);
64+
65+ /* Menu bar: show when self and have indicator schema */
66+ widget = get_widget (d, "show-login-name-checkbutton");
67+ label = get_widget (d, "show-login-name-spacer");
68+ show = um_user_get_uid (user) == getuid() &&
69+ d->indicator_session_schema;
70+ gtk_widget_set_visible (widget, show);
71+ gtk_widget_set_visible (label, show);
72 }
73
74 static void on_permission_changed (GPermission *permission, GParamSpec *pspec, gpointer data);
75@@ -1295,6 +1306,7 @@
76 const gchar *filename;
77 GtkWidget *button;
78 GtkStyleContext *context;
79+ GSettingsSchema *schema;
80
81 d = self->priv = UM_USER_PANEL_PRIVATE (self);
82
83@@ -1330,6 +1342,13 @@
84 gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
85 context = gtk_widget_get_style_context (get_widget (d, "add-remove-toolbar"));
86 gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
87+
88+ schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), INDICATOR_SESSION_SCHEMA, TRUE);
89+ if (schema) {
90+ d->indicator_session_schema = g_settings_new (INDICATOR_SESSION_SCHEMA);
91+ g_settings_bind (d->indicator_session_schema, "show-real-name-on-panel", get_widget (d, "show-login-name-checkbutton"), "active", G_SETTINGS_BIND_DEFAULT);
92+ g_object_unref (schema);
93+ }
94 }
95
96 static void

Subscribers

People subscribed via source and target branches