Index: applets/notification_area/main.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/notification_area/main.c,v
retrieving revision 1.29
diff -u -p -w -r1.29 main.c
--- applets/notification_area/main.c	26 Feb 2005 14:42:49 -0000	1.29
+++ applets/notification_area/main.c	28 Oct 2005 23:55:56 -0000
@@ -47,6 +47,7 @@
 static EggTrayManager *tray_manager = NULL;
 static GSList *all_trays = NULL;
 
+
 typedef struct
 {
   PanelApplet *applet;
@@ -59,6 +60,14 @@ typedef struct
 } SystemTray;
 
 static void
+applet_change_background (PanelApplet               *applet,
+			  PanelAppletBackgroundType  type,
+			  GdkColor                  *color,
+			  GdkPixmap                 *pixmap,
+			  SystemTray                *tray);
+
+
+static void
 help_cb (BonoboUIComponent *uic,
 	 SystemTray        *tray,	  
 	 const gchar       *verbname)   
@@ -148,6 +157,27 @@ static const BonoboUIVerb menu_verbs [] 
   BONOBO_UI_VERB_END
 };
 
+gboolean update_icon_background (gpointer data)
+{
+  gint width=0, height=0;
+  PanelAppletBackgroundType  type;
+  GdkPixmap *pixmap=NULL;
+  GdkColor color;
+  
+  SystemTray *tray = (SystemTray *) data;
+  
+  type = panel_applet_get_background (tray->applet, &color, &pixmap);
+  
+  if (type == PANEL_PIXMAP_BACKGROUND ) {
+    gdk_drawable_get_size (pixmap, &width, &height);
+    if (width <=2 || height <=2)
+      return TRUE;
+  }
+
+  applet_change_background (tray->applet, type,  &color, pixmap, tray);
+  return FALSE;
+}
+
 static void
 tray_added (EggTrayManager *manager, GtkWidget *icon, void *data)
 {
@@ -158,9 +188,12 @@ tray_added (EggTrayManager *manager, Gtk
   
   tray = all_trays->data;
 
+  gtk_widget_set_size_request (icon, 24, -1); //....
   gtk_box_pack_end (GTK_BOX (tray->box), icon, FALSE, FALSE, 0);
   
   gtk_widget_show (icon);
+  
+  g_timeout_add (50, update_icon_background, tray);
 }
 
 static void
@@ -237,6 +270,38 @@ applet_change_orientation (PanelApplet  
   update_size_and_orientation (tray);
 }
 
+static void paint_the_sockets (gpointer key, gpointer value, gpointer user_data)
+{
+
+  GdkPixmap *pixmap = (GdkPixmap*) user_data;
+  GtkWidget *socket = (GtkWidget*) value;
+  GdkWindow *plug=GTK_SOCKET(socket)->plug_window;
+  gint socket_width, socket_height, socket_x, socket_y;
+  GdkPixmap *small_pix=NULL;
+  GdkGC *gc;
+  GtkStyle *style;
+
+  gdk_drawable_get_size (socket->window, &socket_width, &socket_height);
+  small_pix= gdk_pixmap_new (pixmap, socket_width, socket_height, -1);
+  gc=gdk_gc_new (pixmap);
+  gdk_window_get_position (socket->window, &socket_x, &socket_y);
+  gdk_draw_drawable (small_pix, gc, pixmap, socket_x, socket_y, 0, 0, 
+      socket_width, socket_height);
+
+  style = gtk_style_copy (socket->style);
+  if (style->bg_pixmap[0])
+    g_object_unref (style->bg_pixmap[0]);
+  style->bg_pixmap[0] = g_object_ref (small_pix);
+  gtk_widget_set_style (socket, style);
+  
+  g_object_unref (style);
+  g_object_unref (gc);
+  g_object_unref (small_pix);
+  
+  XClearArea (GDK_DISPLAY(), GDK_WINDOW_XID (plug), 0, 0, 0, 0, True);
+  
+}
+
 static void
 applet_change_background (PanelApplet               *applet,
 			  PanelAppletBackgroundType  type,
@@ -246,6 +311,9 @@ applet_change_background (PanelApplet   
 {
   GtkRcStyle *rc_style;
   GtkStyle   *style;
+  gint box_width, box_height, pix_height, pix_width;
+  GdkPixmap *color_pixmap;
+  GdkGC *color_gc;
 
   /* reset style */
   gtk_widget_set_style (GTK_WIDGET (tray->applet), NULL);
@@ -258,8 +326,27 @@ applet_change_background (PanelApplet   
     case PANEL_NO_BACKGROUND:
       break;
     case PANEL_COLOR_BACKGROUND:
+    
+      if (!GDK_IS_DRAWABLE (tray->box->window))
+        break;
+      
       gtk_widget_modify_bg (GTK_WIDGET (tray->applet),
                             GTK_STATE_NORMAL, color);
+      
+      gdk_drawable_get_size (tray->box->window, &box_width, &box_height);
+      if (box_width <=2 || box_height <=2)
+        break;
+    
+      color_pixmap= gdk_pixmap_new (tray->box->window, box_width, box_height, -1);
+      color_gc = gdk_gc_new (color_pixmap);
+      gdk_gc_set_rgb_fg_color (color_gc, color);
+      gdk_draw_rectangle (color_pixmap, color_gc, TRUE, -1, -1, -1, -1);
+      g_object_unref (color_gc);
+  
+      g_hash_table_foreach  (tray_manager->socket_table, paint_the_sockets,
+          (gpointer) color_pixmap);
+      g_object_unref (color_pixmap);
+
       break;
     case PANEL_PIXMAP_BACKGROUND:
       style = gtk_style_copy (GTK_WIDGET (tray->applet)->style);
@@ -269,6 +356,14 @@ applet_change_background (PanelApplet   
       style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap);
       gtk_widget_set_style (GTK_WIDGET (tray->applet), style);
       g_object_unref (style);
+      
+      gdk_drawable_get_size (pixmap, &pix_width, &pix_height);
+      if (pix_width <=2 || pix_height <=2)
+        break;
+
+      g_hash_table_foreach  (tray_manager->socket_table, paint_the_sockets,
+        (gpointer) pixmap);
+
       break;
     }
 }
