From 4823f27147e1a7a604d511acde9750d65190c865 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 3 Jun 2012 15:16:26 -0500 Subject: In user-menu-mgr.c, make the static variable 'settings' a field of UserMenuMgr so that it doesn't persist between test sessions --- src/users-service-dbus.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/users-service-dbus.h') diff --git a/src/users-service-dbus.h b/src/users-service-dbus.h index b7db690..c81e768 100644 --- a/src/users-service-dbus.h +++ b/src/users-service-dbus.h @@ -50,8 +50,6 @@ struct _UserData gboolean real_name_conflict; /* The menuitem representing this user if there is one. */ DbusmenuMenuitem * menuitem; - - UsersServiceDbus *service; }; /* XXX - MAXIMUM_USERS should be set to 7 once we've -- cgit v1.2.3 From 3d6809119b9bdc0d144b7e4a3c23bca7ec2c3136 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sun, 3 Jun 2012 15:30:28 -0500 Subject: Remove the seemingly-pointless MINIMUM_USERS constant --- src/users-service-dbus.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/users-service-dbus.h') diff --git a/src/users-service-dbus.h b/src/users-service-dbus.h index c81e768..66f3b9d 100644 --- a/src/users-service-dbus.h +++ b/src/users-service-dbus.h @@ -52,11 +52,6 @@ struct _UserData DbusmenuMenuitem * menuitem; }; -/* XXX - MAXIMUM_USERS should be set to 7 once we've - * got some gdm issues worked out. - */ -#define MINIMUM_USERS 0 - struct _UsersServiceDbus { GObject parent; }; -- cgit v1.2.3 From 192be127691af87a88f4ac15d4fe3dd9296499b0 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 12 Jun 2012 00:39:31 -0500 Subject: use GDBus in users-service-dbus.c... major rewrite here. --- src/users-service-dbus.h | 94 +++++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 40 deletions(-) (limited to 'src/users-service-dbus.h') diff --git a/src/users-service-dbus.h b/src/users-service-dbus.h index 66f3b9d..bc153df 100644 --- a/src/users-service-dbus.h +++ b/src/users-service-dbus.h @@ -3,6 +3,7 @@ * * Authors: * Cody Russell + * Charles Kerr * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -22,62 +23,75 @@ #include #include -#include + +#include "dbus-user.h" /* for AccountsUser */ G_BEGIN_DECLS -#define USERS_SERVICE_DBUS_TYPE (users_service_dbus_get_type ()) -#define USERS_SERVICE_DBUS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), USERS_SERVICE_DBUS_TYPE, UsersServiceDbus)) -#define USERS_SERVICE_DBUS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), USERS_SERVICE_DBUS_TYPE, UsersServiceDbusClass)) -#define IS_USERS_SERVICE_DBUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), USERS_SERVICE_DBUS_TYPE)) -#define IS_USERS_SERVICE_DBUS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), USERS_SERVICE_DBUS_TYPE)) -#define USERS_SERVICE_DBUS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), USERS_SERVICE_DBUS_TYPE, UsersServiceDbusClass)) +#define USERS_SERVICE_DBUS_TYPE (users_service_dbus_get_type ()) +#define USERS_SERVICE_DBUS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), USERS_SERVICE_DBUS_TYPE, UsersServiceDbus)) +#define IS_USERS_SERVICE_DBUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), USERS_SERVICE_DBUS_TYPE)) -typedef struct _UsersServiceDbus UsersServiceDbus; -typedef struct _UsersServiceDbusClass UsersServiceDbusClass; -typedef struct _UserData UserData; +typedef struct _UsersServiceDbus UsersServiceDbus; +typedef struct _UsersServiceDbusClass UsersServiceDbusClass; +typedef struct _UsersServiceDbusPrivate UsersServiceDbusPrivate; -struct _UserData +/** + * A class which interacts with multiple DBus services to track + * info which is useful to the interactor's user menu: + * + * 1. A list of users to add to the user menu. + * + * Each user is an AccountsUser object, which is a GDBusProxy + * to an org.freedesktop.Accounts.User object. + * + * We initially build this list by calling org.freedesktop.Accounts' + * GetCachedUsers method. We also monitor o.f.Accounts' UserAdded + * and UserDeleted and update the list accordingly. + * + * 2. Track which users currently have X sessions. + * This is used for the menuitems' USER_ITEM_PROP_LOGGED_IN property. + * + * We initially build this list by calling org.freedesktop.ConsoleKit.Seat's + * GetDevices method. We also monitor the seat for SessionAdded and + * SessionRemoved and update the list accordingly. + * + * 3. Provide an API for user switching and guest sessions. + * These are typically pass-through functions to GDBusProxies. + * + */ +struct _UsersServiceDbus { - gint64 uid; - gchar *user_name; - gchar *real_name; - gchar *icon_file; - - GList *sessions; - - /* Whether the real name here conflicts with another in the system */ - gboolean real_name_conflict; - /* The menuitem representing this user if there is one. */ - DbusmenuMenuitem * menuitem; -}; - -struct _UsersServiceDbus { + /*< private >*/ GObject parent; + UsersServiceDbusPrivate * priv; }; -struct _UsersServiceDbusClass { +struct _UsersServiceDbusClass +{ GObjectClass parent_class; /* Signals */ - void (* user_added) (UsersServiceDbus *self, const gchar *user_id, gpointer user_data); - void (* user_deleted) (UsersServiceDbus *self, const gchar *user_id, gpointer user_data); + void (* user_added) (UsersServiceDbus*, AccountsUser*, gpointer); + void (* user_deleted) (UsersServiceDbus*, AccountsUser*, gpointer); + void (* user_logged_in_changed) (UsersServiceDbus*, AccountsUser*, gpointer); + void (* guest_logged_in_changed) (UsersServiceDbus*, gpointer); }; -GType users_service_dbus_get_type (void) G_GNUC_CONST; +GType users_service_dbus_get_type (void) G_GNUC_CONST; + +GList * users_service_dbus_get_user_list (UsersServiceDbus * self); -UserData *users_service_dbus_get_user_by_username (UsersServiceDbus *self, - const gchar *username); -GList *users_service_dbus_get_user_list (UsersServiceDbus *self); -gboolean users_service_dbus_show_greeter (UsersServiceDbus *self); -gboolean users_service_dbus_can_activate_session (UsersServiceDbus *self); -gboolean users_service_dbus_activate_user_session (UsersServiceDbus *self, - UserData *user); -gboolean users_service_dbus_activate_guest_session (UsersServiceDbus *self); -void users_service_dbus_set_guest_item (UsersServiceDbus * self, - DbusmenuMenuitem * mi); +gboolean users_service_dbus_is_guest_logged_in (UsersServiceDbus * self); +gboolean users_service_dbus_is_user_logged_in (UsersServiceDbus * self, + AccountsUser * user); -gboolean users_service_dbus_guest_session_enabled (UsersServiceDbus * self); +void users_service_dbus_show_greeter (UsersServiceDbus * self); +gboolean users_service_dbus_guest_session_enabled (UsersServiceDbus * self); +gboolean users_service_dbus_can_activate_session (UsersServiceDbus * self); +void users_service_dbus_activate_guest_session (UsersServiceDbus * self); +void users_service_dbus_activate_user_session (UsersServiceDbus * self, + AccountsUser * user); G_END_DECLS -- cgit v1.2.3 From 146081cfecfe27e69a4b93a15782924d79c6c18e Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 13 Jun 2012 14:41:31 -0500 Subject: Don't use all the new users that we get told about. The issue is fringe cases where we get notified about a user we don't want to show, such as lightdm showing up after we've switched to the greeter. Instead, let's ask org.freedesktop.Accounts for a fresh list of users so that it can apply its internal filters to the user list. --- src/users-service-dbus.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/users-service-dbus.h') diff --git a/src/users-service-dbus.h b/src/users-service-dbus.h index bc153df..0f082c3 100644 --- a/src/users-service-dbus.h +++ b/src/users-service-dbus.h @@ -37,8 +37,8 @@ typedef struct _UsersServiceDbusClass UsersServiceDbusClass; typedef struct _UsersServiceDbusPrivate UsersServiceDbusPrivate; /** - * A class which interacts with multiple DBus services to track - * info which is useful to the interactor's user menu: + * A facade class which interacts with multiple DBus services to + * track info which is useful to the interactor's user menu: * * 1. A list of users to add to the user menu. * @@ -72,8 +72,7 @@ struct _UsersServiceDbusClass GObjectClass parent_class; /* Signals */ - void (* user_added) (UsersServiceDbus*, AccountsUser*, gpointer); - void (* user_deleted) (UsersServiceDbus*, AccountsUser*, gpointer); + void (* user_list_changed) (UsersServiceDbus*, gpointer); void (* user_logged_in_changed) (UsersServiceDbus*, AccountsUser*, gpointer); void (* guest_logged_in_changed) (UsersServiceDbus*, gpointer); }; -- cgit v1.2.3