diff -uNrp gnome-panel-2.22.2.orig/applets/notification_area/main.c gnome-panel-2.22.2.new/applets/notification_area/main.c
--- gnome-panel-2.22.2.orig/applets/notification_area/main.c	2008-08-09 20:21:23.000000000 +0930
+++ gnome-panel-2.22.2.new/applets/notification_area/main.c	2008-08-11 19:26:56.000000000 +0930
@@ -33,7 +33,6 @@
 #include "na-tray-manager.h"
 #include "na-tray.h"
 #include "fixedtip.h"
-#include "obox.h"
 
 #define NOTIFICATION_AREA_ICON "gnome-panel-notification-area"
 
diff -uNrp gnome-panel-2.22.2.orig/applets/notification_area/Makefile.am gnome-panel-2.22.2.new/applets/notification_area/Makefile.am
--- gnome-panel-2.22.2.orig/applets/notification_area/Makefile.am	2008-08-09 20:21:23.000000000 +0930
+++ gnome-panel-2.22.2.new/applets/notification_area/Makefile.am	2008-08-11 19:40:13.000000000 +0930
@@ -18,8 +18,6 @@ NOTIFICATION_AREA_SOURCES =		\
 	fixedtip.h				\
 	fixedtip.c				\
 	main.c					\
-	obox.c					\
-	obox.h					\
 	na-tray.c				\
 	na-tray.h				\
 	na-tray-manager.c			\
@@ -96,8 +94,6 @@ testtray_SOURCES = \
 	na-tray.h		\
 	na-tray-manager.c	\
 	na-tray-manager.h	\
-	obox.c			\
-	obox.h			\
 	testtray.c
 
 testtray_LDADD = \
diff -uNrp gnome-panel-2.22.2.orig/applets/notification_area/na-tray.c gnome-panel-2.22.2.new/applets/notification_area/na-tray.c
--- gnome-panel-2.22.2.orig/applets/notification_area/na-tray.c	2008-08-09 20:21:23.000000000 +0930
+++ gnome-panel-2.22.2.new/applets/notification_area/na-tray.c	2008-08-11 19:32:26.000000000 +0930
@@ -26,17 +26,16 @@
 #include <panel-applet-gconf.h>
 
 #include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkhbox.h>
 #include <libgnomeui/gnome-help.h>
 
 #include "na-tray-manager.h"
 #include "fixedtip.h"
-#include "obox.h"
 
 #include "na-tray.h"
 
 #define ICON_SPACING 1
-#define MIN_BOX_SIZE 3
+#define MIN_TABLE_SIZE 3
+#define MIN_ICON_SIZE 22
 
 typedef struct
 {
@@ -51,7 +50,7 @@ struct _NaTrayPrivate
   GdkScreen   *screen;
   TraysScreen *trays_screen;
 
-  GtkWidget *box;
+  GtkWidget *table;
   GtkWidget *frame;
 
   guint idle_redraw_id;
@@ -99,6 +98,92 @@ get_tray (TraysScreen *trays_screen)
   return trays_screen->all_trays->data;
 }
 
+typedef struct _PackData {
+  GtkOrientation orient;
+  guint n_rows;
+  guint n_cols;
+  guint index;
+} PackData;
+
+static void repack_icon_with_data(GtkWidget *icon,
+                                  NaTray *tray,
+                                  PackData *data)
+{
+  NaTrayPrivate *priv;
+  priv = tray->priv;
+  guint row, col;
+  guint left, right, top, bottom;
+
+  /* row / col number depends on whether we are horizontal or vertical */
+  if (data->orient == GTK_ORIENTATION_HORIZONTAL) {
+    col = data->index / data->n_rows;
+    row = data->index %  data->n_rows;
+  } else {
+    row = data->index / data->n_cols;
+    col = data->index %  data->n_cols;
+  }
+  /* only update icon position if has changed from current */
+  gtk_container_child_get (GTK_CONTAINER (priv->table),
+                           icon,
+                           "left-attach", &left, 
+                           "right-attach", &right,
+                           "top-attach", &top, 
+                           "bottom-attach", &bottom,
+                           NULL);
+  if (left != col || right != col + 1 ||
+      top != row || bottom != row + 1)
+  {
+    gtk_container_child_set (GTK_CONTAINER (priv->table),
+                             icon,
+                             "left-attach", col, 
+                             "right-attach", col + 1,
+                             "top-attach", row, 
+                             "bottom-attach", row + 1,
+                             NULL);
+  }
+  /* increment to index of next icon */
+  data->index++;
+}
+
+static void
+repack_icon_table(TraysScreen *trays_screen)
+{
+  NaTray *tray;
+  NaTrayPrivate *priv;
+  guint rows, cols;
+  PackData pack_data;
+
+  tray = get_tray (trays_screen);
+  if (tray == NULL)
+    return;
+
+  priv = tray->priv;
+
+  if (trays_screen->icon_table)
+  {
+    if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) {
+      rows = MAX (1, GTK_WIDGET (tray)->allocation.height / MIN_ICON_SIZE);
+      cols = MAX (1, g_hash_table_size (trays_screen->icon_table) / rows);
+      if (g_hash_table_size (trays_screen->icon_table) % rows)
+        cols++;
+    } else {
+      cols = MAX (1, GTK_WIDGET (tray)->allocation.width / MIN_ICON_SIZE);
+      rows = MAX (1, g_hash_table_size (trays_screen->icon_table) / cols);
+      if (g_hash_table_size (trays_screen->icon_table) % cols)
+        rows++;
+    }
+    gtk_table_resize (GTK_TABLE (priv->table), rows, cols);
+    pack_data.n_rows = rows;
+    pack_data.n_cols = cols;
+    pack_data.orient = priv->orientation;
+    pack_data.index = 0;
+
+    g_hash_table_foreach (trays_screen->icon_table,
+                         (GHFunc)repack_icon_with_data,
+                         &pack_data);
+  }
+}
+
 static void
 tray_added (NaTrayManager *manager,
             GtkWidget     *icon,
@@ -106,6 +191,7 @@ tray_added (NaTrayManager *manager,
 {
   NaTray *tray;
   NaTrayPrivate *priv;
+  guint rows, cols;
 
   tray = get_tray (trays_screen);
   if (tray == NULL)
@@ -117,8 +203,23 @@ tray_added (NaTrayManager *manager,
   
   g_hash_table_insert (trays_screen->icon_table, icon, tray);
 
-  gtk_box_pack_end (GTK_BOX (priv->box), icon, FALSE, FALSE, 0);
-
+  /* append to table */
+  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) {
+    rows = MAX (1, GTK_WIDGET (tray)->allocation.height / MIN_ICON_SIZE);
+    cols = MAX (1, g_hash_table_size (trays_screen->icon_table) / rows);
+    if (g_hash_table_size (trays_screen->icon_table) % rows)
+      cols++;
+  } else {
+    cols = MAX (1, GTK_WIDGET (tray)->allocation.width / MIN_ICON_SIZE);
+    rows = MAX (1, g_hash_table_size (trays_screen->icon_table) / cols);
+    if (g_hash_table_size (trays_screen->icon_table) % cols)
+      rows++;
+  }
+  gtk_table_resize (GTK_TABLE (priv->table), rows, cols);
+  gtk_table_attach_defaults (GTK_TABLE (priv->table),
+                             icon,
+                             cols - 1, cols,
+                             rows - 1, rows);
   gtk_widget_show (icon);
   na_tray_force_redraw (tray);
 }
@@ -129,16 +230,20 @@ tray_removed (NaTrayManager *manager,
               TraysScreen   *trays_screen)
 {
   NaTray *tray;
+  NaTrayPrivate *priv;
 
   tray = g_hash_table_lookup (trays_screen->icon_table, icon);
   if (tray == NULL)
     return;
 
+  priv = tray->priv;
   g_assert (tray->priv->trays_screen == trays_screen);
 
+  g_hash_table_remove (trays_screen->icon_table, icon);
+  repack_icon_table (trays_screen);
+  gtk_container_remove (GTK_CONTAINER (priv->table), icon);
   na_tray_force_redraw (tray);
 
-  g_hash_table_remove (trays_screen->icon_table, icon);
   /* this will also destroy the tip associated to this icon */
   g_hash_table_remove (trays_screen->tip_table, icon);
 }
@@ -380,8 +485,6 @@ update_size_and_orientation (NaTray *tra
 {
   NaTrayPrivate *priv = tray->priv;
 
-  na_obox_set_orientation (NA_OBOX (priv->box), priv->orientation);
-
   /* This only happens when setting the property during object construction */
   if (!priv->trays_screen)
     return;
@@ -397,14 +500,15 @@ update_size_and_orientation (NaTray *tra
   switch (priv->orientation)
     {
     case GTK_ORIENTATION_VERTICAL:
-      /* Give box a min size so the frame doesn't look dumb */
-      gtk_widget_set_size_request (priv->box, MIN_BOX_SIZE, -1);
+      /* Give table a min size so the frame doesn't look dumb */
+      gtk_widget_set_size_request (priv->table, MIN_TABLE_SIZE, -1);
       break;
     case GTK_ORIENTATION_HORIZONTAL:
-      gtk_widget_set_size_request (priv->box, -1, MIN_BOX_SIZE);
+      gtk_widget_set_size_request (priv->table, -1, MIN_TABLE_SIZE);
       break;
     }
 
+  repack_icon_table (priv->trays_screen);
   na_tray_force_redraw (tray);
 }
 
@@ -422,10 +526,11 @@ na_tray_init (NaTray *tray)
   gtk_container_add (GTK_CONTAINER (tray), priv->frame);
   gtk_widget_show (priv->frame);
 
-  priv->box = na_obox_new ();
-  gtk_box_set_spacing (GTK_BOX (priv->box), ICON_SPACING);
-  gtk_container_add (GTK_CONTAINER (priv->frame), priv->box);
-  gtk_widget_show (priv->box);
+  priv->table = gtk_table_new (0, 0, TRUE);
+  gtk_table_set_row_spacings (GTK_TABLE (priv->table), ICON_SPACING);
+  gtk_table_set_col_spacings (GTK_TABLE (priv->table), ICON_SPACING);
+  gtk_container_add (GTK_CONTAINER (priv->frame), priv->table);
+  gtk_widget_show (priv->table);
 }
 
 static GObject *
@@ -586,7 +691,11 @@ static void
 na_tray_size_allocate (GtkWidget        *widget,
                        GtkAllocation    *allocation)
 {
+  NaTray *tray = NA_TRAY (widget);
+  
+  widget->allocation = *allocation;
   gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)), allocation);
+  repack_icon_table (tray->priv->trays_screen);
 }
 
 static void
@@ -664,8 +773,8 @@ idle_redraw_cb (NaTray *tray)
   NaTrayPrivate *priv = tray->priv;
 
   priv->idle_redraw_id = 0;
-  gtk_widget_hide (priv->box);
-  gtk_widget_show (priv->box);
+  gtk_widget_hide (priv->table);
+  gtk_widget_show (priv->table);
 
   return FALSE;
 }
diff -uNrp gnome-panel-2.22.2.orig/applets/notification_area/obox.c gnome-panel-2.22.2.new/applets/notification_area/obox.c
--- gnome-panel-2.22.2.orig/applets/notification_area/obox.c	2008-08-09 20:21:23.000000000 +0930
+++ gnome-panel-2.22.2.new/applets/notification_area/obox.c	1970-01-01 09:30:00.000000000 +0930
@@ -1,130 +0,0 @@
-/* OBox Copyright (C) 2002 Red Hat Inc. based on GtkHBox */
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
- * file for a list of people on the GTK+ Team.  See the ChangeLog
- * files for a list of changes.  These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
- */
-
-#include "obox.h"
-
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-
-static void na_obox_size_request  (GtkWidget       *widget,
-				   GtkRequisition  *requisition);
-static void na_obox_size_allocate (GtkWidget       *widget,
-				   GtkAllocation   *allocation);
-
-
-G_DEFINE_TYPE (NaOBox, na_obox, GTK_TYPE_BOX)
-
-static void
-na_obox_class_init (NaOBoxClass *class)
-{
-  GtkWidgetClass *widget_class;
-
-  widget_class = (GtkWidgetClass*) class;
-
-  widget_class->size_request = na_obox_size_request;
-  widget_class->size_allocate = na_obox_size_allocate;
-}
-
-static void
-na_obox_init (NaOBox *obox)
-{
-  obox->orientation = GTK_ORIENTATION_HORIZONTAL;
-}
-
-GtkWidget*
-na_obox_new (void)
-{
-  NaOBox *obox;
-
-  obox = g_object_new (NA_TYPE_OBOX, NULL);
-
-  return GTK_WIDGET (obox);
-}
-
-static GtkWidgetClass*
-get_class (NaOBox *obox)     
-{
-  GtkWidgetClass *klass;
-
-  switch (obox->orientation)
-    {
-    case GTK_ORIENTATION_HORIZONTAL:
-      klass = GTK_WIDGET_CLASS (gtk_type_class (GTK_TYPE_HBOX));
-      break;
-    case GTK_ORIENTATION_VERTICAL:
-      klass = GTK_WIDGET_CLASS (gtk_type_class (GTK_TYPE_VBOX));
-      break;
-    default:
-      g_assert_not_reached ();
-      klass = NULL;
-      break;
-    }
-
-  return klass;
-}
-
-static void
-na_obox_size_request (GtkWidget      *widget,
-		      GtkRequisition *requisition)
-{
-  GtkWidgetClass *klass;
-  NaOBox *obox;
-
-  obox = NA_OBOX (widget);
-
-  klass = get_class (obox);
-
-  klass->size_request (widget, requisition);
-}
-
-static void
-na_obox_size_allocate (GtkWidget     *widget,
-		       GtkAllocation *allocation)
-{
-  GtkWidgetClass *klass;
-  NaOBox *obox;
-
-  obox = NA_OBOX (widget);
-
-  klass = get_class (obox);
-
-  klass->size_allocate (widget, allocation);
-}
-
-void
-na_obox_set_orientation (NaOBox         *obox,
-                         GtkOrientation  orientation)
-{
-  g_return_if_fail (NA_IS_OBOX (obox));
-
-  if (obox->orientation == orientation)
-    return;
-  
-  obox->orientation = orientation;
-
-  gtk_widget_queue_resize (GTK_WIDGET (obox));
-}
diff -uNrp gnome-panel-2.22.2.orig/applets/notification_area/obox.h gnome-panel-2.22.2.new/applets/notification_area/obox.h
--- gnome-panel-2.22.2.orig/applets/notification_area/obox.h	2008-08-09 20:21:23.000000000 +0930
+++ gnome-panel-2.22.2.new/applets/notification_area/obox.h	1970-01-01 09:30:00.000000000 +0930
@@ -1,73 +0,0 @@
-/* OBox Copyright (C) 2002 Red Hat Inc. based on GtkHBox */
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
- * file for a list of people on the GTK+ Team.  See the ChangeLog
- * files for a list of changes.  These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
- */
-
-#ifndef __NA_OBOX_H__
-#define __NA_OBOX_H__
-
-#include <gtk/gtkbox.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define NA_TYPE_OBOX            (na_obox_get_type ())
-#define NA_OBOX(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NA_TYPE_OBOX, NaOBox))
-#define NA_OBOX_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NA_TYPE_OBOX, NaOBoxClass))
-#define NA_IS_OBOX(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NA_TYPE_OBOX))
-#define NA_IS_OBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NA_TYPE_OBOX))
-#define NA_OBOX_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NA_TYPE_OBOX, NaOBoxClass))
-
-
-typedef struct _NaOBox       NaOBox;
-typedef struct _NaOBoxClass  NaOBoxClass;
-
-struct _NaOBox
-{
-  GtkBox box;
-
-  GtkOrientation orientation;
-};
-
-struct _NaOBoxClass
-{
-  GtkBoxClass parent_class;
-};
-
-
-GType	   na_obox_get_type (void) G_GNUC_CONST;
-GtkWidget* na_obox_new      (void);
-
-void na_obox_set_orientation (NaOBox         *obox,
-                              GtkOrientation  orientation);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __NA_OBOX_H__ */
