Merge lp:~cjcurran/indicator-session/dynamic-users into lp:indicator-session/0.1

Proposed by Conor Curran
Status: Merged
Merge reported by: Conor Curran
Merged at revision: not available
Proposed branch: lp:~cjcurran/indicator-session/dynamic-users
Merge into: lp:indicator-session/0.1
Diff against target: 94 lines (+23/-12)
2 files modified
src/user-menu-mgr.c (+4/-4)
src/users-service-dbus.c (+19/-8)
To merge this branch: bzr merge lp:~cjcurran/indicator-session/dynamic-users
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+72230@code.launchpad.net

Description of the change

Ensures that users which are deleted or added show up dynamically in the user menu.

To post a comment you must log in.
Revision history for this message
Conor Curran (cjcurran) wrote :

Merged into user-images branch, some of the users DBus service needs to be rewritten.

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 'src/user-menu-mgr.c'
2--- src/user-menu-mgr.c 2011-08-18 15:21:02 +0000
3+++ src/user-menu-mgr.c 2011-08-19 17:17:33 +0000
4@@ -76,7 +76,7 @@
5 G_CALLBACK (user_change),
6 self);
7 g_signal_connect (G_OBJECT (self->users_dbus_interface),
8- "user-removed",
9+ "user-deleted",
10 G_CALLBACK (user_change),
11 self);
12 }
13@@ -364,9 +364,9 @@
14 const gchar *user_id,
15 gpointer user_data)
16 {
17- //DbusmenuMenuitem *root = (DbusmenuMenuitem *)user_data;
18- // TODO sort this out.
19- //rebuild_user_items (root, service);
20+ g_return_if_fail (USER_IS_MENU_MGR (user_data));
21+ UserMenuMgr* user_mgr = USER_MENU_MGR(user_data);
22+ user_menu_mgr_rebuild_items (user_mgr, FALSE);
23 return;
24 }
25
26
27=== modified file 'src/users-service-dbus.c'
28--- src/users-service-dbus.c 2011-08-18 11:20:19 +0000
29+++ src/users-service-dbus.c 2011-08-19 17:17:33 +0000
30@@ -711,11 +711,6 @@
31 g_return_if_fail(IS_USERS_SERVICE_DBUS(self));
32 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
33
34- if (g_hash_table_size (priv->users) > 0)
35- {
36- return;
37- }
38-
39 if (priv->count > MINIMUM_USERS && priv->count < MAXIMUM_USERS)
40 {
41 GPtrArray *users = NULL;
42@@ -758,7 +753,13 @@
43
44 continue;
45 }
46-
47+ // Double check we havent processed this user already
48+ if (users_service_dbus_get_user_by_username (self,
49+ g_value_get_string (g_hash_table_lookup (properties, "UserName"))) != NULL)
50+ {
51+ continue;
52+ }
53+
54 user = g_new0 (UserData, 1);
55
56 user->uid = g_value_get_uint64 (g_hash_table_lookup (properties, "Uid"));
57@@ -788,25 +789,35 @@
58 {
59 UsersServiceDbus *service = (UsersServiceDbus *)user_data;
60 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service);
61-
62 priv->count++;
63
64 if (priv->count < MAXIMUM_USERS)
65 {
66 sync_users (service);
67 }
68+
69+ g_signal_emit (service,
70+ signals[USER_ADDED],
71+ 0,
72+ user_id);
73 }
74
75 static void
76 user_deleted (DBusGProxy *proxy,
77 const gchar *user_id,
78 gpointer user_data)
79-{
80+{
81 UsersServiceDbus *service = (UsersServiceDbus *)user_data;
82 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service);
83
84 priv->count--;
85 g_hash_table_remove (priv->users, user_id);
86+
87+ g_signal_emit (service,
88+ signals[USER_DELETED],
89+ 0,
90+ user_id);
91+
92 }
93
94 UserData *

Subscribers

People subscribed via source and target branches