Replace GdmUser with AccountsService

The GdmUser copy+paste code has been superseded by AccountsService,
so kill the former and use the latter.

https://bugzilla.gnome.org/show_bug.cgi?id=650893
This commit is contained in:
Florian Müllner 2011-05-10 16:13:05 +02:00
parent 0751a90bd9
commit fa786fd3ef
12 changed files with 21 additions and 4453 deletions

View File

@ -22,8 +22,8 @@ const DBus = imports.dbus;
const Lang = imports.lang;
const Signals = imports.signals;
const AccountsService = imports.gi.AccountsService;
const Clutter = imports.gi.Clutter;
const Gdm = imports.gi.Gdm;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
const Pango = imports.gi.Pango;
@ -237,7 +237,7 @@ EndSessionDialog.prototype = {
_init: function() {
ModalDialog.ModalDialog.prototype._init.call(this, { styleClass: 'end-session-dialog' });
this._user = Gdm.UserManager.ref_default().get_user(GLib.get_user_name());
this._user = AccountsService.UserManager.get_default().get_user(GLib.get_user_name());
this._secondsLeft = 0;
this._totalSecondsToStayOpen = 0;

View File

@ -23,10 +23,10 @@
const Lang = imports.lang;
const Signals = imports.signals;
const Shell = imports.gi.Shell;
const AccountsService = imports.gi.AccountsService;
const Clutter = imports.gi.Clutter;
const St = imports.gi.St;
const Pango = imports.gi.Pango;
const Gdm = imports.gi.Gdm;
const Gio = imports.gi.Gio;
const Mainloop = imports.mainloop;
const Polkit = imports.gi.Polkit;
@ -92,7 +92,7 @@ AuthenticationDialog.prototype = {
let userName = userNames[0];
this._user = Gdm.UserManager.ref_default().get_user(userName);
this._user = AccountsService.UserManager.get_default().get_user(userName);
let userRealName = this._user.get_real_name()
this._userLoadedId = this._user.connect('notify::is_loaded',
Lang.bind(this, this._onUserChanged));

View File

@ -1,6 +1,6 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Gdm = imports.gi.Gdm;
const AccountsService = imports.gi.AccountsService;
const DBus = imports.dbus;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
@ -183,10 +183,9 @@ IMStatusChooserItem.prototype = {
this._IMStatusChanged(mgr, presence, s, msg);
}));
this._gdm = Gdm.UserManager.ref_default();
this._gdm.queue_load();
this._userManager = AccountsService.UserManager.get_default();
this._user = this._gdm.get_user(GLib.get_user_name());
this._user = this._userManager.get_user(GLib.get_user_name());
this._userLoadedId = this._user.connect('notify::is-loaded',
Lang.bind(this,
@ -367,10 +366,9 @@ UserMenuButton.prototype = {
this._lockdownSettings = new Gio.Settings({ schema: LOCKDOWN_SCHEMA });
this._gdm = Gdm.UserManager.ref_default();
this._gdm.queue_load();
this._userManager = AccountsService.UserManager.get_default();
this._user = this._gdm.get_user(GLib.get_user_name());
this._user = this._userManager.get_user(GLib.get_user_name());
this._presence = new GnomeSession.Presence();
this._session = new GnomeSession.SessionManager();
this._haveShutdown = true;
@ -416,9 +414,12 @@ UserMenuButton.prototype = {
this._userChangedId = this._user.connect('changed', Lang.bind(this, this._updateUserName));
this._createSubMenu();
this._gdm.connect('notify::is-loaded', Lang.bind(this, this._updateSwitchUser));
this._gdm.connect('user-added', Lang.bind(this, this._updateSwitchUser));
this._gdm.connect('user-removed', Lang.bind(this, this._updateSwitchUser));
this._userManager.connect('notify::is-loaded',
Lang.bind(this, this._updateSwitchUser));
this._userManager.connect('user-added',
Lang.bind(this, this._updateSwitchUser));
this._userManager.connect('user-removed',
Lang.bind(this, this._updateSwitchUser));
this._lockdownSettings.connect('changed::' + DISABLE_USER_SWITCH_KEY,
Lang.bind(this, this._updateSwitchUser));
this._lockdownSettings.connect('changed::' + DISABLE_LOG_OUT_KEY,
@ -459,7 +460,7 @@ UserMenuButton.prototype = {
_updateSwitchUser: function() {
let allowSwitch = !this._lockdownSettings.get_boolean(DISABLE_USER_SWITCH_KEY);
if (allowSwitch && this._gdm.can_switch ())
if (allowSwitch && this._userManager.can_switch ())
this._loginScreenItem.actor.show();
else
this._loginScreenItem.actor.hide();
@ -619,7 +620,7 @@ UserMenuButton.prototype = {
// Ensure we only move to GDM after the screensaver has activated; in some
// OS configurations, the X server may block event processing on VT switch
this._screenSaverProxy.SetActiveRemote(true, Lang.bind(this, function() {
this._gdm.goto_login_session();
this._userManager.goto_login_session();
}));
},

View File

@ -1,35 +0,0 @@
gdmuser_cflags = \
-I$(top_srcdir)/src \
-DPREFIX=\""$(prefix)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DG_DISABLE_DEPRECATED \
-DG_LOG_DOMAIN=\"GdmUser\" \
-DGDM_CACHE_DIR=\""$(localstatedir)/cache/gdm"\" \
$(GDMUSER_CFLAGS) \
$(NULL)
# please, keep this sorted alphabetically
gdmuser_source_h = \
gdmuser/gdm-user.h \
gdmuser/gdm-user-private.h \
gdmuser/gdm-user-manager.h \
$(NULL)
# please, keep this sorted alphabetically
gdmuser_source_c = \
gdmuser/gdm-user.c \
gdmuser/gdm-user-manager.c \
$(NULL)
noinst_LTLIBRARIES += libgdmuser-1.0.la
libgdmuser_1_0_la_LIBADD = $(GDMUSER_LIBS)
libgdmuser_1_0_la_SOURCES = \
$(gdmuser_source_c) \
$(gdmuser_source_h) \
$(NULL)
libgdmuser_1_0_la_CPPFLAGS = $(gdmuser_cflags)
libgdmuser_1_0_la_LDFLAGS = $(LDADD)

View File

@ -68,7 +68,6 @@ gnome-shell-extension-tool: gnome-shell-extension-tool.in Makefile
CLEANFILES += gnome-shell $(bin_SCRIPTS)
include Makefile-gdmuser.am
include Makefile-st.am
include Makefile-tray.am
include Makefile-gvc.am
@ -263,7 +262,6 @@ libgnome_shell_la_LIBADD = \
$(GNOME_SHELL_LIBS) \
$(BLUETOOTH_LIBS) \
libst-1.0.la \
libgdmuser-1.0.la \
libtray.la \
libgvc.la \
$(NULL)
@ -288,12 +286,3 @@ St_1_0_gir_FILES = $(filter-out %-private.h $(st_non_gir_sources), $(addprefix $
$(addprefix $(srcdir)/,$(st_source_c))
INTROSPECTION_GIRS += St-1.0.gir
CLEANFILES += St-1.0.gir
Gdm-1.0.gir: libgdmuser-1.0.la
Gdm_1_0_gir_INCLUDES = GObject-2.0 GdkPixbuf-2.0
Gdm_1_0_gir_CFLAGS = $(gdmuser_cflags)
Gdm_1_0_gir_LIBS = libgdmuser-1.0.la
Gdm_1_0_gir_FILES = $(filter-out %-private.h, $(addprefix $(srcdir)/,$(gdmuser_source_h))) \
$(addprefix $(srcdir)/,$(gdmuser_source_c))
INTROSPECTION_GIRS += Gdm-1.0.gir
CLEANFILES += Gdm-1.0.gir

File diff suppressed because it is too large Load Diff

View File

@ -1,91 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __GDM_USER_MANAGER_H__
#define __GDM_USER_MANAGER_H__
#include <glib-object.h>
#include "gdm-user.h"
G_BEGIN_DECLS
#define GDM_TYPE_USER_MANAGER (gdm_user_manager_get_type ())
#define GDM_USER_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_USER_MANAGER, GdmUserManager))
#define GDM_USER_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_USER_MANAGER, GdmUserManagerClass))
#define GDM_IS_USER_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_USER_MANAGER))
#define GDM_IS_USER_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_USER_MANAGER))
#define GDM_USER_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_USER_MANAGER, GdmUserManagerClass))
typedef struct GdmUserManagerPrivate GdmUserManagerPrivate;
typedef struct GdmUserManager GdmUserManager;
typedef struct GdmUserManagerClass GdmUserManagerClass;
typedef enum GdmUserManagerError GdmUserManagerError;
struct GdmUserManager
{
GObject parent;
GdmUserManagerPrivate *priv;
};
struct GdmUserManagerClass
{
GObjectClass parent_class;
void (* user_added) (GdmUserManager *user_manager,
GdmUser *user);
void (* user_removed) (GdmUserManager *user_manager,
GdmUser *user);
void (* user_is_logged_in_changed) (GdmUserManager *user_manager,
GdmUser *user);
void (* user_changed) (GdmUserManager *user_manager,
GdmUser *user);
};
enum GdmUserManagerError
{
GDM_USER_MANAGER_ERROR_GENERAL,
GDM_USER_MANAGER_ERROR_KEY_NOT_FOUND
};
#define GDM_USER_MANAGER_ERROR gdm_user_manager_error_quark ()
GQuark gdm_user_manager_error_quark (void);
GType gdm_user_manager_get_type (void);
GdmUserManager * gdm_user_manager_ref_default (void);
void gdm_user_manager_queue_load (GdmUserManager *manager);
GSList * gdm_user_manager_list_users (GdmUserManager *manager);
GdmUser * gdm_user_manager_get_user (GdmUserManager *manager,
const char *username);
GdmUser * gdm_user_manager_get_user_by_uid (GdmUserManager *manager,
gulong uid);
gboolean gdm_user_manager_activate_user_session (GdmUserManager *manager,
GdmUser *user);
gboolean gdm_user_manager_can_switch (GdmUserManager *manager);
gboolean gdm_user_manager_goto_login_session (GdmUserManager *manager);
G_END_DECLS
#endif /* __GDM_USER_MANAGER_H */

View File

@ -1,49 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2004-2005 James M. Cape <jcape@ignore-your.tv>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Private interfaces to the GdmUser object
*/
#ifndef __GDM_USER_PRIVATE_H_
#define __GDM_USER_PRIVATE_H_
#include <pwd.h>
#include "gdm-user.h"
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);
void _gdm_user_update_login_frequency (GdmUser *user,
guint64 login_frequency);
void _gdm_user_add_session (GdmUser *user,
const char *session_id);
void _gdm_user_remove_session (GdmUser *user,
const char *session_id);
G_END_DECLS
#endif /* !__GDM_USER_PRIVATE__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,64 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2004-2005 James M. Cape <jcape@ignore-your.tv>.
* Copyright (C) 2007-2008 William Jon McCann <mccann@jhu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Facade object for user data, owned by GdmUserManager
*/
#ifndef __GDM_USER_H__
#define __GDM_USER_H__
#include <sys/types.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS
#define GDM_TYPE_USER (gdm_user_get_type ())
#define GDM_USER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDM_TYPE_USER, GdmUser))
#define GDM_IS_USER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDM_TYPE_USER))
typedef struct _GdmUser GdmUser;
typedef struct _GdmUserClass GdmUserClass;
GType gdm_user_get_type (void) G_GNUC_CONST;
GdmUser *gdm_user_new_from_object_path (const char *path);
const char *gdm_user_get_object_path (GdmUser *user);
gulong gdm_user_get_uid (GdmUser *user);
const char *gdm_user_get_user_name (GdmUser *user);
const char *gdm_user_get_real_name (GdmUser *user);
guint gdm_user_get_num_sessions (GdmUser *user);
gboolean gdm_user_is_logged_in (GdmUser *user);
gulong gdm_user_get_login_frequency (GdmUser *user);
const char *gdm_user_get_icon_file (GdmUser *user);
const char *gdm_user_get_primary_session_id (GdmUser *user);
GdkPixbuf *gdm_user_render_icon (GdmUser *user,
gint icon_size);
gint gdm_user_collate (GdmUser *user1,
GdmUser *user2);
gboolean gdm_user_is_loaded (GdmUser *user);
G_END_DECLS
#endif

View File

@ -534,7 +534,7 @@ main (int argc, char **argv)
/* Disable debug spew from various libraries */
g_log_set_handler ("Gvc", G_LOG_LEVEL_DEBUG,
muted_log_handler, NULL);
g_log_set_handler ("GdmUser", G_LOG_LEVEL_DEBUG,
g_log_set_handler ("AccountsService", G_LOG_LEVEL_DEBUG,
muted_log_handler, NULL);
g_log_set_handler ("Bluetooth", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_MESSAGE,
muted_log_handler, NULL);

View File

@ -68,7 +68,7 @@ fi
# Non-devel packages needed by gnome-shell and its deps:
# glxinfo, gstreamer-plugins-base, gstreamer-plugins-good,
# gvfs, python, pygobject, gnome-python (gconf),
# icon-naming-utils, zenity, libtasn1-tools
# icon-naming-utils, zenity, libtasn1-tools accountsservice
if test "x$system" = xUbuntu -o "x$system" = xDebian -o "x$system" = xLinuxMint ; then
reqd="
@ -84,7 +84,7 @@ if test "x$system" = xUbuntu -o "x$system" = xDebian -o "x$system" = xLinuxMint
libltdl-dev libvorbis-dev iso-codes libgnome-keyring-dev libusb-1.0-0-dev
libupower-glib-dev libcups2-dev libproxy-dev libdb-dev libproxy-dev
libsqlite3-dev libgudev-1.0-dev libsane-dev libwebkitgtk-3.0-0
libx11-xcb-dev libupower-glib-dev
libx11-xcb-dev libupower-glib-dev accountsservice
"
if apt-cache show libxcb-util0-dev > /dev/null 2> /dev/null; then
@ -117,7 +117,7 @@ fi
if test "x$system" = xFedora ; then
reqd="
binutils curl gcc gcc-c++ make
binutils curl gcc gcc-c++ make accountsservice
automake bison flex gettext git gnome-common gnome-doc-utils gperf gvfs intltool
libtool pkgconfig dbus-glib-devel gnome-desktop-devel gnome-menus-devel
gnome-python2-gconf jasper-devel libffi-devel libical-devel libjpeg-devel libpng-devel