[gdm] Drop gdm_user_new_from_object_path for _gdm_user_update_from_object_path
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] Drop gdm_user_new_from_object_path for _gdm_user_update_from_object_path
- Date: Fri, 10 Sep 2010 17:36:57 +0000 (UTC)
commit 48570e22f4893c7088abc51f1de9bacfb772b13c
Author: Ray Strode <rstrode redhat com>
Date: Fri Sep 10 09:57:30 2010 -0400
Drop gdm_user_new_from_object_path for _gdm_user_update_from_object_path
This is how it works with pwent, and it has the advantage of letting us
create a stub user object destined to come from the accounts service
before we know its object path.
gui/simple-greeter/gdm-user-manager.c | 7 ++-----
gui/simple-greeter/gdm-user-private.h | 3 +++
gui/simple-greeter/gdm-user.c | 24 +++++++++++++++---------
3 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/gui/simple-greeter/gdm-user-manager.c b/gui/simple-greeter/gdm-user-manager.c
index 4382481..eecf9dc 100644
--- a/gui/simple-greeter/gdm-user-manager.c
+++ b/gui/simple-greeter/gdm-user-manager.c
@@ -830,11 +830,8 @@ add_new_user_for_object_path (const char *object_path,
if (user != NULL) {
return user;
}
- user = gdm_user_new_from_object_path (object_path);
-
- if (user == NULL) {
- return NULL;
- }
+ user = g_object_new (GDM_TYPE_USER, NULL);
+ _gdm_user_update_from_object_path (user, object_path);
manager->priv->new_users = g_slist_prepend (manager->priv->new_users, user);
diff --git a/gui/simple-greeter/gdm-user-private.h b/gui/simple-greeter/gdm-user-private.h
index 16ff415..a248532 100644
--- a/gui/simple-greeter/gdm-user-private.h
+++ b/gui/simple-greeter/gdm-user-private.h
@@ -30,6 +30,9 @@
G_BEGIN_DECLS
+void _gdm_user_update_from_object_path (GdmUser *user,
+ const char *object_path);
+
void _gdm_user_update_from_pwent (GdmUser *user,
const struct passwd *pwent);
diff --git a/gui/simple-greeter/gdm-user.c b/gui/simple-greeter/gdm-user.c
index 25951ba..317b721 100644
--- a/gui/simple-greeter/gdm-user.c
+++ b/gui/simple-greeter/gdm-user.c
@@ -1002,12 +1002,22 @@ changed_handler (DBusGProxy *proxy,
update_info (user);
}
-GdmUser *
-gdm_user_new_from_object_path (const gchar *object_path)
+/**
+ * _gdm_user_update_from_object_path:
+ * @user: the user object to update.
+ * @object_path: the object path of the user to use.
+ *
+ * Updates the properties of @user from the accounts service via
+ * the object path in @object_path.
+ **/
+void
+_gdm_user_update_from_object_path (GdmUser *user,
+ const char *object_path)
{
- GdmUser *user;
+ g_return_if_fail (GDM_IS_USER (user));
+ g_return_if_fail (object_path != NULL);
+ g_return_if_fail (user->object_path == NULL);
- user = (GdmUser *)g_object_new (GDM_TYPE_USER, NULL);
user->object_path = g_strdup (object_path);
user->accounts_proxy = dbus_g_proxy_new_for_name (user->connection,
@@ -1021,14 +1031,10 @@ gdm_user_new_from_object_path (const gchar *object_path)
G_CALLBACK (changed_handler), user, NULL);
if (!update_info (user)) {
- goto error;
+ g_warning ("Couldn't update info for user with object path %s", object_path);
}
- return user;
-
- error:
g_object_unref (user);
- return NULL;
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]