summaryrefslogtreecommitdiff
path: root/gui/gdmuser.c
diff options
context:
space:
mode:
authorWilliam Jon McCann <mccann@jhu.edu>2005-07-19 23:39:43 +0000
committerWilliam Jon McCann <mccann@src.gnome.org>2005-07-19 23:39:43 +0000
commitf3806b9da53dd41301c27258711dbf6d84bb913a (patch)
tree73e0297531a5de206a6a8066b5b0a47383ed51ef /gui/gdmuser.c
parent3d38a4c9747ca77a3621fff99ed15db371968e0b (diff)
downloadgdm-f3806b9da53dd41301c27258711dbf6d84bb913a.tar.gz
Use common function for loading face images.
2005-07-19 William Jon McCann <mccann@jhu.edu> * gui/greeter/greeter_item_ulist.c (gdm_greeter_users_init): Use common function for loading face images. * gui/greeter/greeter.c (greeter_ctrl_handler): Update for new common code. * gui/gdmuser.c (gdm_user_alloc): Use common function for loading face images. (setup_user): Define as static. * gui/gdmlogin.c (gdm_kill_thingies): Make static. (gdm_login_ctrl_handler): Update for new gdm_common_login_sound. Add gdm_kill_thingies before all abort calls since they are not in gdm_common_abort anymore. (main): Use new common get face function. * gui/Makefile.am: * gui/gdmcommon.c (gdm_common_show_info_msg, gdm_common_login_sound): Make more common by not depending on external variables. (gdm_common_abort): Make more common by not depending on external functions. (gdm_common_get_face): Add a common function for loading face images. * daemon/slave.c (path_is_local, check_user_file) (check_global_file, get_facefile_from_gnome2_dir_config) (get_facefile_from_home, get_facefile_from_global, run_pictures): Don't stat or read from remote home directories. Fixes #310545. * configure.in: * daemon/Makefile.am: * daemon/fstype.c: Add ability to detect filesystem types. * gui/greeter/greeter_item_ulist.c (gdm_greeter_users_init): * gui/gdmlogin.c (main): Try GTK+ themed icon stock_person before falling back to nobody.png. Fixes #310906.
Diffstat (limited to 'gui/gdmuser.c')
-rw-r--r--gui/gdmuser.c67
1 files changed, 31 insertions, 36 deletions
diff --git a/gui/gdmuser.c b/gui/gdmuser.c
index 7dcb3c76..87536d56 100644
--- a/gui/gdmuser.c
+++ b/gui/gdmuser.c
@@ -1,4 +1,6 @@
-/* GDM - The GNOME Display Manager
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * GDM - The GNOME Display Manager
* Copyright (C) 1999, 2000 Martin K. Petersen <mkp@mkp.net>
*
* This file Copyright (c) 2003 George Lebl
@@ -45,12 +47,13 @@ extern gboolean GdmIncludeAll;
extern gboolean GdmAllowRoot;
extern gboolean GdmAllowRemoteRoot;
-static gint maxwidth = 0;
-static gint maxheight = 0;
-
static GdmUser *
-gdm_user_alloc (const gchar *logname, uid_t uid, const gchar *homedir,
- const char *gecos, GdkPixbuf *defface, gboolean read_faces)
+gdm_user_alloc (const gchar *logname,
+ uid_t uid,
+ const gchar *homedir,
+ const char *gecos,
+ GdkPixbuf *defface,
+ gboolean read_faces)
{
GdmUser *user;
GdkPixbuf *img = NULL;
@@ -153,7 +156,10 @@ gdm_user_alloc (const gchar *logname, uid_t uid, const gchar *homedir,
/* read the "done" bit, but don't check */
read (STDIN_FILENO, buf, sizeof (buf));
} else if (access (&buf[1], R_OK) == 0) {
- img = gdk_pixbuf_new_from_file (&buf[1], NULL);
+ img = gdm_common_get_face (&buf[1],
+ NULL,
+ GdmIconMaxWidth,
+ GdmIconMaxHeight);
} else {
img = NULL;
}
@@ -163,32 +169,10 @@ gdm_user_alloc (const gchar *logname, uid_t uid, const gchar *homedir,
fflush (stdout);
if (img != NULL) {
- gint w, h;
-
- w = gdk_pixbuf_get_width (img);
- h = gdk_pixbuf_get_height (img);
-
- if (w > h && w > GdmIconMaxWidth) {
- h = h * ((gfloat) GdmIconMaxWidth/w);
- w = GdmIconMaxWidth;
- } else if (h > GdmIconMaxHeight) {
- w = w * ((gfloat) GdmIconMaxHeight/h);
- h = GdmIconMaxHeight;
- }
-
if (user->picture != NULL)
g_object_unref (G_OBJECT (user->picture));
- maxwidth = MAX (maxwidth, w);
- maxheight = MAX (maxheight, h);
- if (w != gdk_pixbuf_get_width (img) ||
- h != gdk_pixbuf_get_height (img)) {
- user->picture = gdk_pixbuf_scale_simple
- (img, w, h, GDK_INTERP_BILINEAR);
- g_object_unref (G_OBJECT (img));
- } else {
- user->picture = img;
- }
+ user->picture = img;
}
return user;
@@ -257,9 +241,16 @@ gdm_sort_func (gpointer d1, gpointer d2)
}
-gboolean setup_user(struct passwd *pwent, GList **users, GList **users_string,
- char **excludes, char *exclude_user, GdkPixbuf *defface,
- int *size_of_users, gboolean is_local, gboolean read_faces)
+static gboolean
+setup_user (struct passwd *pwent,
+ GList **users,
+ GList **users_string,
+ char **excludes,
+ char *exclude_user,
+ GdkPixbuf *defface,
+ int *size_of_users,
+ gboolean is_local,
+ gboolean read_faces)
{
GdmUser *user;
int cnt = 0;
@@ -315,9 +306,13 @@ gdm_is_user_valid (const char *username)
}
void
-gdm_users_init (GList **users, GList **users_string, char *exclude_user,
- GdkPixbuf *defface, int *size_of_users, gboolean is_local,
- gboolean read_faces)
+gdm_users_init (GList **users,
+ GList **users_string,
+ char *exclude_user,
+ GdkPixbuf *defface,
+ int *size_of_users,
+ gboolean is_local,
+ gboolean read_faces)
{
struct passwd *pwent;
char **includes;