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