diff -up gdm-2.22.0/gui/simple-greeter/gdm-user-chooser-widget.c.fix-icon-scale gdm-2.22.0/gui/simple-greeter/gdm-user-chooser-widget.c
--- gdm-2.22.0/gui/simple-greeter/gdm-user-chooser-widget.c.fix-icon-scale 2008-05-01 18:35:35.000000000 -0400
+++ gdm-2.22.0/gui/simple-greeter/gdm-user-chooser-widget.c 2008-09-29 10:36:44.000000000 -0400
@@ -46,7 +46,7 @@ enum {
#define GDM_USER_CHOOSER_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_USER_CHOOSER_WIDGET, GdmUserChooserWidgetPrivate))
-#define ICON_SIZE 64
+#define MAX_ICON_SIZE 128
struct GdmUserChooserWidgetPrivate
{
@@ -71,6 +71,45 @@ static void gdm_user_chooser_widget_
G_DEFINE_TYPE (GdmUserChooserWidget, gdm_user_chooser_widget, GDM_TYPE_CHOOSER_WIDGET)
+static int
+get_font_height_for_widget (GtkWidget *widget)
+{
+ PangoFontMetrics *metrics;
+ PangoContext *context;
+ int ascent;
+ int descent;
+ int height;
+
+ gtk_widget_ensure_style (widget);
+ context = gtk_widget_get_pango_context (widget);
+ metrics = pango_context_get_metrics (context,
+ widget->style->font_desc,
+ pango_context_get_language (context));
+
+ ascent = pango_font_metrics_get_ascent (metrics);
+ descent = pango_font_metrics_get_descent (metrics);
+ height = PANGO_PIXELS (ascent + descent);
+ pango_font_metrics_unref (metrics);
+ return height;
+}
+
+static int
+get_icon_height_for_widget (GtkWidget *widget)
+{
+ int font_height;
+ int height;
+
+ font_height = get_font_height_for_widget (widget);
+ height = 3 * font_height;
+ if (height > MAX_ICON_SIZE) {
+ height = MAX_ICON_SIZE;
+ }
+
+ g_debug ("GdmUserChooserWidget: font height %d; using icon size %d", font_height, height);
+
+ return height;
+}
+
static void
add_user_other (GdmUserChooserWidget *widget)
{
@@ -287,10 +326,13 @@ static GdkPixbuf *
get_stock_person_pixbuf (GdmUserChooserWidget *widget)
{
GdkPixbuf *pixbuf;
+ int size;
+
+ size = get_icon_height_for_widget (widget);
pixbuf = gtk_icon_theme_load_icon (widget->priv->icon_theme,
DEFAULT_USER_ICON,
- ICON_SIZE,
+ size,
0,
NULL);
@@ -301,10 +343,13 @@ static GdkPixbuf *
get_logged_in_pixbuf (GdmUserChooserWidget *widget)
{
GdkPixbuf *pixbuf;
+ int size;
+
+ size = get_icon_height_for_widget (widget);
pixbuf = gtk_icon_theme_load_icon (widget->priv->icon_theme,
"emblem-default",
- ICON_SIZE / 3,
+ size / 3,
0,
NULL);
@@ -402,8 +447,11 @@ on_user_added (GdmUserManager *man
GdkPixbuf *pixbuf;
char *tooltip;
gboolean is_logged_in;
+ int size;
+
+ size = get_icon_height_for_widget (widget);
+ pixbuf = gdm_user_render_icon (user, size);
- pixbuf = gdm_user_render_icon (user, ICON_SIZE);
if (pixbuf == NULL && widget->priv->stock_person_pixbuf != NULL) {
pixbuf = g_object_ref (widget->priv->stock_person_pixbuf);
}