Index: gtkstatusicon.c
===================================================================
--- gtkstatusicon.c	(revision 18718)
+++ gtkstatusicon.c	(working copy)
@@ -886,46 +886,6 @@
   return priv->blank_icon;
 }
 
-#ifdef GDK_WINDOWING_X11
-
-static GtkIconSize
-find_icon_size (GtkWidget *widget, 
-		gint       pixel_size)
-{
-  GdkScreen *screen;
-  GtkSettings *settings;
-  GtkIconSize s, size;
-  gint w, h, d, dist;
-
-  screen = gtk_widget_get_screen (widget);
-
-  if (!screen)
-    return GTK_ICON_SIZE_MENU;
-
-  settings = gtk_settings_get_for_screen (screen);
-  
-  dist = G_MAXINT;
-  size = GTK_ICON_SIZE_MENU;
-
-  for (s = GTK_ICON_SIZE_MENU; s < GTK_ICON_SIZE_DIALOG; s++)
-    {
-      if (gtk_icon_size_lookup_for_settings (settings, s, &w, &h) &&
-	  w <= pixel_size && h <= pixel_size)
-	{
-	  d = MAX (pixel_size - w, pixel_size - h);
-	  if (d < dist)
-	    {
-	      dist = d;
-	      size = s;
-	    }
-	}
-    }
-  
-  return size;
-}
-
-#endif
-
 static void
 gtk_status_icon_update_image (GtkStatusIcon *status_icon)
 {
@@ -1028,10 +988,22 @@
     case GTK_IMAGE_STOCK:
       {
 #ifdef GDK_WINDOWING_X11
-	GtkIconSize size = find_icon_size (priv->image, priv->size);
-	gtk_image_set_from_stock (GTK_IMAGE (priv->image),
-				  priv->image_data.stock_id,
-				  size);
+    GtkIconTheme *icon_theme;
+    GdkPixbuf *pixbuf;
+    
+    /* get theme */
+    if (G_LIKELY (gtk_widget_has_screen (priv->image)))
+        icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (priv->image));
+    else
+        icon_theme = gtk_icon_theme_get_default ();
+	
+	/* load icon */
+    pixbuf = gtk_icon_theme_load_icon (icon_theme, priv->image_data.stock_id, priv->size, 0, NULL);
+    if (G_LIKELY (pixbuf))
+      {
+        gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
+        g_object_unref (G_OBJECT (pixbuf));
+      }
 #endif
 #ifdef GDK_WINDOWING_WIN32
 	{
@@ -1072,10 +1044,22 @@
     case GTK_IMAGE_ICON_NAME:
       {
 #ifdef GDK_WINDOWING_X11
-	GtkIconSize size = find_icon_size (priv->image, priv->size);
-	gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
-				      priv->image_data.icon_name,
-				      size);
+    GtkIconTheme *icon_theme;
+    GdkPixbuf *pixbuf;
+    
+    /* get theme */
+    if (G_LIKELY (gtk_widget_has_screen (priv->image)))
+        icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (priv->image));
+    else
+        icon_theme = gtk_icon_theme_get_default ();
+	
+	/* load icon */
+    pixbuf = gtk_icon_theme_load_icon (icon_theme, priv->image_data.icon_name, priv->size, 0, NULL);
+    if (G_LIKELY (pixbuf))
+      {
+        gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
+        g_object_unref (G_OBJECT (pixbuf));
+      }
 #endif
 #ifdef GDK_WINDOWING_WIN32
 	{
