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
=== modified file 'src/user-menu-mgr.c'
--- src/user-menu-mgr.c 2011-08-18 15:21:02 +0000
+++ src/user-menu-mgr.c 2011-08-19 17:17:33 +0000
@@ -76,7 +76,7 @@
76 G_CALLBACK (user_change),76 G_CALLBACK (user_change),
77 self);77 self);
78 g_signal_connect (G_OBJECT (self->users_dbus_interface),78 g_signal_connect (G_OBJECT (self->users_dbus_interface),
79 "user-removed",79 "user-deleted",
80 G_CALLBACK (user_change),80 G_CALLBACK (user_change),
81 self);81 self);
82}82}
@@ -364,9 +364,9 @@
364 const gchar *user_id,364 const gchar *user_id,
365 gpointer user_data)365 gpointer user_data)
366{366{
367 //DbusmenuMenuitem *root = (DbusmenuMenuitem *)user_data;367 g_return_if_fail (USER_IS_MENU_MGR (user_data));
368 // TODO sort this out.368 UserMenuMgr* user_mgr = USER_MENU_MGR(user_data);
369 //rebuild_user_items (root, service);369 user_menu_mgr_rebuild_items (user_mgr, FALSE);
370 return;370 return;
371}371}
372372
373373
=== modified file 'src/users-service-dbus.c'
--- src/users-service-dbus.c 2011-08-18 11:20:19 +0000
+++ src/users-service-dbus.c 2011-08-19 17:17:33 +0000
@@ -711,11 +711,6 @@
711 g_return_if_fail(IS_USERS_SERVICE_DBUS(self));711 g_return_if_fail(IS_USERS_SERVICE_DBUS(self));
712 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);712 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
713713
714 if (g_hash_table_size (priv->users) > 0)
715 {
716 return;
717 }
718
719 if (priv->count > MINIMUM_USERS && priv->count < MAXIMUM_USERS)714 if (priv->count > MINIMUM_USERS && priv->count < MAXIMUM_USERS)
720 {715 {
721 GPtrArray *users = NULL;716 GPtrArray *users = NULL;
@@ -758,7 +753,13 @@
758753
759 continue;754 continue;
760 }755 }
761756 // Double check we havent processed this user already
757 if (users_service_dbus_get_user_by_username (self,
758 g_value_get_string (g_hash_table_lookup (properties, "UserName"))) != NULL)
759 {
760 continue;
761 }
762
762 user = g_new0 (UserData, 1);763 user = g_new0 (UserData, 1);
763764
764 user->uid = g_value_get_uint64 (g_hash_table_lookup (properties, "Uid"));765 user->uid = g_value_get_uint64 (g_hash_table_lookup (properties, "Uid"));
@@ -788,25 +789,35 @@
788{789{
789 UsersServiceDbus *service = (UsersServiceDbus *)user_data;790 UsersServiceDbus *service = (UsersServiceDbus *)user_data;
790 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service);791 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service);
791
792 priv->count++;792 priv->count++;
793793
794 if (priv->count < MAXIMUM_USERS)794 if (priv->count < MAXIMUM_USERS)
795 {795 {
796 sync_users (service);796 sync_users (service);
797 }797 }
798
799 g_signal_emit (service,
800 signals[USER_ADDED],
801 0,
802 user_id);
798}803}
799804
800static void805static void
801user_deleted (DBusGProxy *proxy,806user_deleted (DBusGProxy *proxy,
802 const gchar *user_id,807 const gchar *user_id,
803 gpointer user_data)808 gpointer user_data)
804{809{
805 UsersServiceDbus *service = (UsersServiceDbus *)user_data;810 UsersServiceDbus *service = (UsersServiceDbus *)user_data;
806 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service);811 UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service);
807812
808 priv->count--;813 priv->count--;
809 g_hash_table_remove (priv->users, user_id);814 g_hash_table_remove (priv->users, user_id);
815
816 g_signal_emit (service,
817 signals[USER_DELETED],
818 0,
819 user_id);
820
810}821}
811822
812UserData *823UserData *

Subscribers

People subscribed via source and target branches