Index: gtk/gtkcellview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcellview.c,v
retrieving revision 1.47
diff -u -p -r1.47 gtkcellview.c
--- gtk/gtkcellview.c	24 May 2006 17:01:28 -0000	1.47
+++ gtk/gtkcellview.c	10 Aug 2006 21:23:10 -0000
@@ -359,37 +359,81 @@ gtk_cell_view_size_allocate (GtkWidget  
     }
 
   extra_space = widget->allocation.width - full_requested_width;
+
+#if 1
+  if (expand_cell_count > 0)
+    extra_space /= expand_cell_count;
+#else
   if (extra_space < 0)
     extra_space = 0;
   else if (extra_space > 0 && expand_cell_count > 0)
     extra_space /= expand_cell_count;
+#endif
 
-  /* iterate list for PACK_START cells */
-  for (i = cellview->priv->cell_list; i; i = i->next)
+  /* PACK_START cells */
+  if (extra_space >= 0)
     {
-      GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
-
-      if (info->pack == GTK_PACK_END)
-        continue;
-
-      if (!info->cell->visible)
-        continue;
-
-      info->real_width = info->requested_width + (info->expand?extra_space:0);
+      /* we have more space than requested */
+      for (i = cellview->priv->cell_list; i; i = i->next)
+        {
+          GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
+
+          if (info->pack == GTK_PACK_END || !info->cell->visible)
+            continue;
+
+          info->real_width = (info->requested_width +
+                              (info->expand ? extra_space : 0));
+        }
     }
-
-  /* iterate list for PACK_END cells */
-  for (i = cellview->priv->cell_list; i; i = i->next)
+  else
     {
-      GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
-
-      if (info->pack == GTK_PACK_START)
-        continue;
-
-      if (!info->cell->visible)
-        continue;
+      /* we have less space than requested iterate (and take space)
+       * from last cell in list so that first cells remain visible
+       */
+      for (i = g_list_last (cellview->priv->cell_list); i; i = i->prev)
+         {
+           GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
+
+           if (info->pack == GTK_PACK_END || !info->cell->visible)
+             continue;
+
+           info->real_width = (info->requested_width +
+                               (info->expand ? extra_space : 0));
+
+           if (info->real_width < 1)
+             info->real_width = 1;
+         }
+    }
 
-      info->real_width = info->requested_width + (info->expand?extra_space:0);
+  /* PACK_END cells */
+  if (extra_space >= 0)
+    {
+      for (i = cellview->priv->cell_list; i; i = i->next)
+        {
+          GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
+
+          if (info->pack == GTK_PACK_START || !info->cell->visible)
+            continue;
+
+          info->real_width = (info->requested_width +
+                              (info->expand ? extra_space : 0));
+        }
+    }
+  else
+    {
+      for (i = g_list_last (cellview->priv->cell_list); i; i = i->prev)
+        {
+          GtkCellViewCellInfo *info = (GtkCellViewCellInfo *)i->data;
+
+          if (info->pack == GTK_PACK_START || !info->cell->visible)
+            continue;
+
+          info->real_width = (info->requested_width +
+                              (info->expand ? extra_space : 0));
+
+          if (info->real_width < 1)
+            info->real_width = 1;
+        }
     }
 }
 
