Index: gtk/gtknotebook.c
===================================================================
--- gtk/gtknotebook.c	(Revision 21146)
+++ gtk/gtknotebook.c	(Arbeitskopie)
@@ -838,6 +838,21 @@ gtk_notebook_class_init (GtkNotebookClas
                                                              0,
                                                              GTK_PARAM_READABLE));
 
+  /**
+   * GtkNotebook:tab-position-details:
+   *
+   * When %TRUE, the notebook gap is drawn with a
+   * detail indicating the position of visible tabs.
+   *
+   * Since: 2.16
+   */
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_boolean ("tab-position-details",
+                                                                 P_("Tab Position Details"),
+                                                                 P_("When %TRUE, the notebook gap is drawn with a detail indicating the position of visible tabs"),
+                                                                 FALSE,
+                                                                 GTK_PARAM_READABLE));
+
   notebook_signals[SWITCH_PAGE] =
     g_signal_new (I_("switch-page"),
 		  G_TYPE_FROM_CLASS (gobject_class),
@@ -4555,7 +4570,9 @@ gtk_notebook_paint (GtkWidget    *widget
   GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
   GList *children;
-  gboolean showarrow;
+  gboolean tab_position_details;
+  gboolean tab_front, tab_rear, tab_overflow;
+  GString *detail;
   gint width, height;
   gint x, y;
   gint border_width = GTK_CONTAINER (widget)->border_width;
@@ -4645,13 +4662,79 @@ gtk_notebook_paint (GtkWidget    *widget
 	  break;
 	}
     }
+
+  /* Determine the expected layout of tabs:
+  tab_front: TRUE if at least one visible tab is at the front
+  tab_rear: TRUE if at least one visible tab is at the rear
+  tab_overflow: TRUE if we have more tabs than we can display
+  */
+  tab_front = FALSE;
+  tab_rear = FALSE;
+  tab_overflow = FALSE;
+  children = gtk_notebook_search_page (notebook, NULL, step, TRUE);
+  while (children)
+    {
+      page = children->data;
+      children = gtk_notebook_search_page (notebook, children,
+                                           step, TRUE);
+      if (!GTK_WIDGET_VISIBLE (page->child))
+        continue;
+      if (!GTK_WIDGET_MAPPED (page->tab_label))
+        {
+          /* If a tab is not visible because of scrolling, all the other
+           * tabs will be expanded. */
+          tab_overflow = TRUE;
+          tab_front = TRUE;
+          tab_rear = TRUE;
+        }
+      else if (page->expand == TRUE)
+        {
+          tab_front = TRUE;
+          tab_rear = TRUE;
+        }
+      else if (page->pack == GTK_PACK_START)
+        {
+          tab_front = TRUE;
+        }
+      else
+        {
+          tab_rear = TRUE;
+        }
+    }
+
+  /* The following logic applys if "tab-position-details" is TRUE */
+  gtk_widget_style_get (widget, "tab-position-details", &tab_position_details, NULL);
+
+  /* The following schema describes the expected detail:
+     no arrows:
+       n children front                  => notebook_front
+       n children rear                   => notebook_rear
+       n children left + m children rear => notebook_front_rear
+       n children, m expanded            => notebook_front_rear
+
+     with arrows (all tabs are expanded in this case):
+       arrows on both sides              => notebook
+       arrows at the front               => notebook_rear
+       arrows at the rear                => notebook_front
+       arrows invisible because of theme => notebook_front_rear
+  */
+  detail = g_string_new ("notebook");
+  if (tab_position_details && (tab_front || tab_rear || tab_overflow))
+    {
+      if (tab_front && !(tab_overflow && notebook->scrollable
+       && (notebook->has_before_previous || notebook->has_before_next)))
+        g_string_append (detail, "_front");
+      if (tab_rear && !(tab_overflow && notebook->scrollable
+       && (notebook->has_after_previous || notebook->has_after_next)))
+        g_string_append (detail, "_rear");
+    }
   gtk_paint_box_gap (widget->style, widget->window,
 		     GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-		     area, widget, "notebook",
+		     area, widget, detail->str,
 		     x, y, width, height,
 		     tab_pos, gap_x, gap_width);
+  g_string_free (detail, TRUE);
 
-  showarrow = FALSE;
   children = gtk_notebook_search_page (notebook, NULL, step, TRUE);
   while (children)
     {
@@ -4660,13 +4743,11 @@ gtk_notebook_paint (GtkWidget    *widget
 					   step, TRUE);
       if (!GTK_WIDGET_VISIBLE (page->child))
 	continue;
-      if (!GTK_WIDGET_MAPPED (page->tab_label))
-	showarrow = TRUE;
       else if (page != notebook->cur_page)
 	gtk_notebook_draw_tab (notebook, page, area);
     }
 
-  if (showarrow && notebook->scrollable) 
+  if (tab_overflow && notebook->scrollable) 
     {
       if (notebook->has_before_previous)
 	gtk_notebook_draw_arrow (notebook, ARROW_LEFT_BEFORE);
