← Back to team overview

ayatana-commits team mailing list archive

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

 

Conor Curran has proposed merging lp:~cjcurran/indicator-session/dynamic-users into lp:indicator-session.

Requested reviews:
  Ted Gould (ted)

For more details, see:
https://code.launchpad.net/~cjcurran/indicator-session/dynamic-users/+merge/72230

Ensures that users which are deleted or added show up dynamically  in the user menu.
-- 
https://code.launchpad.net/~cjcurran/indicator-session/dynamic-users/+merge/72230
Your team ayatana-commits is subscribed to branch lp:indicator-session.
=== 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 @@
                     G_CALLBACK (user_change),
                     self);
   g_signal_connect (G_OBJECT (self->users_dbus_interface),
-                    "user-removed",
+                    "user-deleted",
                     G_CALLBACK (user_change),
                     self);
 }
@@ -364,9 +364,9 @@
              const gchar      *user_id,
              gpointer          user_data)
 {
-	//DbusmenuMenuitem *root = (DbusmenuMenuitem *)user_data;
-  // TODO sort this out.
-	//rebuild_user_items (root, service);
+  g_return_if_fail (USER_IS_MENU_MGR (user_data));  
+  UserMenuMgr* user_mgr = USER_MENU_MGR(user_data);  
+	user_menu_mgr_rebuild_items (user_mgr, FALSE);
 	return;
 }
 

=== 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 @@
   g_return_if_fail(IS_USERS_SERVICE_DBUS(self));
   UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self);
 
-  if (g_hash_table_size (priv->users) > 0)
-    {
-      return;
-    }
-
   if (priv->count > MINIMUM_USERS && priv->count < MAXIMUM_USERS)
     {
       GPtrArray *users = NULL;
@@ -758,7 +753,13 @@
 
               continue;
             }
-
+            // Double check we havent processed this user already
+          if (users_service_dbus_get_user_by_username (self, 
+                                                       g_value_get_string (g_hash_table_lookup (properties, "UserName"))) != NULL)
+            {
+              continue;                                     
+            }
+            
           user = g_new0 (UserData, 1);
 
           user->uid         = g_value_get_uint64 (g_hash_table_lookup (properties, "Uid"));
@@ -788,25 +789,35 @@
 {
   UsersServiceDbus *service = (UsersServiceDbus *)user_data;
   UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service);
-
   priv->count++;
 
   if (priv->count < MAXIMUM_USERS)
     {
       sync_users (service);
     }
+
+  g_signal_emit (service,
+                 signals[USER_ADDED],
+                 0,
+                 user_id);   
 }
 
 static void
 user_deleted (DBusGProxy  *proxy,
               const gchar *user_id,
               gpointer     user_data)
-{
+{  
   UsersServiceDbus *service = (UsersServiceDbus *)user_data;
   UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (service);
 
   priv->count--;
   g_hash_table_remove (priv->users, user_id);
+
+  g_signal_emit (service,
+                 signals[USER_DELETED],
+                 0,
+                 user_id);   
+  
 }
 
 UserData *


Follow ups