aboutsummaryrefslogtreecommitdiff
path: root/src/user-menu-mgr.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-06-13 14:33:36 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-06-13 14:33:36 -0500
commit38dbee40c9466cb17cb71a42ed46b12377638c20 (patch)
tree68a8f4c9680417d616366f8a7acfd3500534f829 /src/user-menu-mgr.c
parent961c326fd07a11818c10cc827cd79caa83d2402c (diff)
downloadayatana-indicator-session-38dbee40c9466cb17cb71a42ed46b12377638c20.tar.gz
ayatana-indicator-session-38dbee40c9466cb17cb71a42ed46b12377638c20.tar.bz2
ayatana-indicator-session-38dbee40c9466cb17cb71a42ed46b12377638c20.zip
Have the menuitem respond to changes in the AccountsUser's ICON property
Diffstat (limited to 'src/user-menu-mgr.c')
-rw-r--r--src/user-menu-mgr.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c
index f44f888..e7c6348 100644
--- a/src/user-menu-mgr.c
+++ b/src/user-menu-mgr.c
@@ -178,6 +178,25 @@ set_user_name_collision (AccountsUser * user, gboolean b)
****
***/
+static void
+update_menuitem_icon (DbusmenuMenuitem * mi, AccountsUser * user)
+{
+ const gchar * str = accounts_user_get_icon_file (user);
+
+ if (!str || !*str)
+ {
+ str = USER_ITEM_ICON_DEFAULT;
+ }
+
+ dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_ICON, str);
+}
+
+static void
+on_user_icon_file_changed (AccountsUser * user, GParamSpec * pspec, DbusmenuMenuitem * mi)
+{
+ update_menuitem_icon (mi, user);
+}
+
static DbusmenuMenuitem*
create_user_menuitem (UserMenuMgr * menu_mgr, AccountsUser * user)
{
@@ -202,10 +221,8 @@ create_user_menuitem (UserMenuMgr * menu_mgr, AccountsUser * user)
is_logged_in);
/* set the icon property */
- const gchar * icon_str = accounts_user_get_icon_file (user);
- if (!icon_str || !*icon_str)
- icon_str = USER_ITEM_ICON_DEFAULT;
- dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_ICON, icon_str);
+ update_menuitem_icon (mi, user);
+ g_signal_connect (user, "notify::icon-file", G_CALLBACK(on_user_icon_file_changed), mi);
/* set the is-current-user property */
dbusmenu_menuitem_property_set_bool (mi,
@@ -247,12 +264,10 @@ on_user_logged_in_changed (UsersServiceDbus * users_service_dbus,
UserMenuMgr * self)
{
DbusmenuMenuitem * mi = user_get_menuitem (user);
-g_message ("%s %s() user %s corresponds to mi %p", G_STRLOC, G_STRFUNC, accounts_user_get_user_name(user), mi);
if (mi != NULL)
{
const gboolean b = users_service_dbus_is_user_logged_in (users_service_dbus, user);
-g_message ("setting %p USER_ITEM_PROP_LOGGED_IN to %d", mi, (int)b);
dbusmenu_menuitem_property_set_bool (mi, USER_ITEM_PROP_LOGGED_IN, b);
}
}