aboutsummaryrefslogtreecommitdiff
path: root/src/users-service-dbus.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-08-22 19:33:19 +0100
committerConor Curran <conor.curran@canonical.com>2011-08-22 19:33:19 +0100
commitd6b49642e37a60736767c356a5a0eac6ca394a4a (patch)
tree1f58ab49168f934b003f41bac8a701a51298c3b7 /src/users-service-dbus.c
parentc8b7d9a2d30fbcd6e0d072a60318b6466653ebb1 (diff)
parent2d97d089958309db8115a5c9cfd9ffa4cb5ff39d (diff)
downloadayatana-indicator-session-d6b49642e37a60736767c356a5a0eac6ca394a4a.tar.gz
ayatana-indicator-session-d6b49642e37a60736767c356a5a0eac6ca394a4a.tar.bz2
ayatana-indicator-session-d6b49642e37a60736767c356a5a0eac6ca394a4a.zip
merged the dynamic users work
Diffstat (limited to 'src/users-service-dbus.c')
-rw-r--r--src/users-service-dbus.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c
index e7507a4..03d1144 100644
--- a/src/users-service-dbus.c
+++ b/src/users-service-dbus.c
@@ -711,11 +711,6 @@ sync_users (UsersServiceDbus *self)
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 @@ sync_users (UsersServiceDbus *self)
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 @@ user_added (DBusGProxy *proxy,
{
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 *