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
=== modified file 'panels/user-accounts/data/user-accounts-dialog.ui'
--- panels/user-accounts/data/user-accounts-dialog.ui 2012-08-18 17:12:38 +0000
+++ panels/user-accounts/data/user-accounts-dialog.ui 2014-02-17 21:23:56 +0000
@@ -436,6 +436,34 @@
436 <property name="y_options">0</property>436 <property name="y_options">0</property>
437 </packing>437 </packing>
438 </child>438 </child>
439 <child>
440 <object class="GtkLabel" id="show-login-name-spacer">
441 <property name="visible">True</property>
442 </object>
443 <packing>
444 <property name="right_attach">2</property>
445 <property name="top_attach">7</property>
446 <property name="bottom_attach">8</property>
447 </packing>
448 </child>
449 <child>
450 <object class="GtkCheckButton" id="show-login-name-checkbutton">
451 <property name="label" translatable="yes">_Show my login name in the menu bar</property>
452 <property name="use_underline">True</property>
453 <property name="visible">True</property>
454 <property name="can_focus">True</property>
455 <property name="receives_default">False</property>
456 <property name="xalign">0</property>
457 <property name="draw_indicator">True</property>
458 </object>
459 <packing>
460 <property name="right_attach">2</property>
461 <property name="top_attach">8</property>
462 <property name="bottom_attach">9</property>
463 <property name="x_options">GTK_FILL</property>
464 <property name="y_options">0</property>
465 </packing>
466 </child>
439 </object>467 </object>
440 <packing>468 <packing>
441 <property name="expand">False</property>469 <property name="expand">False</property>
442470
=== modified file 'panels/user-accounts/um-user-panel.c'
--- panels/user-accounts/um-user-panel.c 2013-11-29 06:28:37 +0000
+++ panels/user-accounts/um-user-panel.c 2014-02-17 21:23:56 +0000
@@ -55,6 +55,7 @@
55#include "cc-common-language.h"55#include "cc-common-language.h"
5656
57#define USER_ACCOUNTS_PERMISSION "com.canonical.controlcenter.user-accounts.administration"57#define USER_ACCOUNTS_PERMISSION "com.canonical.controlcenter.user-accounts.administration"
58#define INDICATOR_SESSION_SCHEMA "com.canonical.indicator.session"
5859
59CC_PANEL_REGISTER (UmUserPanel, um_user_panel)60CC_PANEL_REGISTER (UmUserPanel, um_user_panel)
6061
@@ -71,6 +72,8 @@
7172
72 UmPasswordDialog *password_dialog;73 UmPasswordDialog *password_dialog;
73 UmPhotoDialog *photo_dialog;74 UmPhotoDialog *photo_dialog;
75
76 GSettings *indicator_session_schema;
74};77};
7578
76static GtkWidget *79static GtkWidget *
@@ -635,6 +638,14 @@
635 !is_using_ecryptfs (um_user_get_user_name (user));638 !is_using_ecryptfs (um_user_get_user_name (user));
636 gtk_widget_set_visible (widget, show);639 gtk_widget_set_visible (widget, show);
637 gtk_widget_set_visible (label, show);640 gtk_widget_set_visible (label, show);
641
642 /* Menu bar: show when self and have indicator schema */
643 widget = get_widget (d, "show-login-name-checkbutton");
644 label = get_widget (d, "show-login-name-spacer");
645 show = um_user_get_uid (user) == getuid() &&
646 d->indicator_session_schema;
647 gtk_widget_set_visible (widget, show);
648 gtk_widget_set_visible (label, show);
638}649}
639650
640static void on_permission_changed (GPermission *permission, GParamSpec *pspec, gpointer data);651static void on_permission_changed (GPermission *permission, GParamSpec *pspec, gpointer data);
@@ -1295,6 +1306,7 @@
1295 const gchar *filename;1306 const gchar *filename;
1296 GtkWidget *button;1307 GtkWidget *button;
1297 GtkStyleContext *context;1308 GtkStyleContext *context;
1309 GSettingsSchema *schema;
12981310
1299 d = self->priv = UM_USER_PANEL_PRIVATE (self);1311 d = self->priv = UM_USER_PANEL_PRIVATE (self);
13001312
@@ -1330,6 +1342,13 @@
1330 gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);1342 gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
1331 context = gtk_widget_get_style_context (get_widget (d, "add-remove-toolbar"));1343 context = gtk_widget_get_style_context (get_widget (d, "add-remove-toolbar"));
1332 gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);1344 gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
1345
1346 schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (), INDICATOR_SESSION_SCHEMA, TRUE);
1347 if (schema) {
1348 d->indicator_session_schema = g_settings_new (INDICATOR_SESSION_SCHEMA);
1349 g_settings_bind (d->indicator_session_schema, "show-real-name-on-panel", get_widget (d, "show-login-name-checkbutton"), "active", G_SETTINGS_BIND_DEFAULT);
1350 g_object_unref (schema);
1351 }
1333}1352}
13341353
1335static void1354static void

Subscribers

People subscribed via source and target branches