]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtknotebook.c
Remove GtkObject completely
[~andy/gtk] / gtk / gtknotebook.c
index c6bb222a1d69506a8c0a99912feca66ce922fd24..c5b880c0f16cc7062d72d99f56c6918a5bbdadd1 100644 (file)
 
 #include "config.h"
 
+#include "gtknotebook.h"
+
 #include <stdio.h>
 #include <string.h>
 
 #include <gdk/gdkkeysyms.h>
 
-#include "gtknotebook.h"
 #include "gtkmain.h"
 #include "gtkmenu.h"
 #include "gtkmenuitem.h"
@@ -65,7 +66,7 @@ enum {
   N_ACTION_WIDGETS
 };
 
-struct _GtkNotebookPriv
+struct _GtkNotebookPrivate
 {
   GtkNotebookDragOperation   operation;
   GtkNotebookPage           *cur_page;
@@ -92,7 +93,7 @@ struct _GtkNotebookPriv
   gint           mouse_y;
   gint           pressed_button;
 
-  gpointer       group;
+  GQuark         group;
 
   guint          dnd_timer;
   guint          switch_tab_timer;
@@ -171,7 +172,7 @@ enum {
   PROP_SCROLLABLE,
   PROP_PAGE,
   PROP_ENABLE_POPUP,
-  PROP_GROUP,
+  PROP_GROUP_NAME
 };
 
 enum {
@@ -195,7 +196,7 @@ enum {
 #define PAGE_TOP_Y(_page_)    (((GtkNotebookPage *) (_page_))->allocation.y)
 #define PAGE_BOTTOM_Y(_page_) (((GtkNotebookPage *) (_page_))->allocation.y + ((GtkNotebookPage *) (_page_))->allocation.height)
 #define PAGE_MIDDLE_Y(_page_) (((GtkNotebookPage *) (_page_))->allocation.y + ((GtkNotebookPage *) (_page_))->allocation.height / 2)
-#define NOTEBOOK_IS_TAB_LABEL_PARENT(_notebook_,_page_) (((GtkNotebookPage *) (_page_))->tab_label->parent == ((GtkWidget *) (_notebook_)))
+#define NOTEBOOK_IS_TAB_LABEL_PARENT(_notebook_,_page_) (gtk_widget_get_parent (((GtkNotebookPage *) (_page_))->tab_label) == ((GtkWidget *) (_notebook_)))
 
 struct _GtkNotebookPage
 {
@@ -261,8 +262,7 @@ static void     gtk_notebook_query_tab_label_packing (GtkNotebook  *notebook,
                                                       gboolean     *fill,
                                                       GtkPackType  *pack_type);
 
-/*** GtkObject Methods ***/
-static void gtk_notebook_destroy             (GtkObject        *object);
+/*** GObject Methods ***/
 static void gtk_notebook_set_property       (GObject         *object,
                                              guint            prop_id,
                                              const GValue    *value,
@@ -273,6 +273,7 @@ static void gtk_notebook_get_property            (GObject         *object,
                                              GParamSpec      *pspec);
 
 /*** GtkWidget Methods ***/
+static void gtk_notebook_destroy             (GtkWidget        *widget);
 static void gtk_notebook_map                 (GtkWidget        *widget);
 static void gtk_notebook_unmap               (GtkWidget        *widget);
 static void gtk_notebook_realize             (GtkWidget        *widget);
@@ -281,10 +282,8 @@ static void gtk_notebook_size_request        (GtkWidget        *widget,
                                              GtkRequisition   *requisition);
 static void gtk_notebook_size_allocate       (GtkWidget        *widget,
                                              GtkAllocation    *allocation);
-static gint gtk_notebook_expose              (GtkWidget        *widget,
-                                             GdkEventExpose   *event);
-static gboolean gtk_notebook_scroll          (GtkWidget        *widget,
-                                              GdkEventScroll   *event);
+static gint gtk_notebook_draw                (GtkWidget        *widget,
+                                              cairo_t          *cr);
 static gint gtk_notebook_button_press        (GtkWidget        *widget,
                                              GdkEventButton   *event);
 static gint gtk_notebook_button_release      (GtkWidget        *widget,
@@ -302,8 +301,6 @@ static void gtk_notebook_grab_notify         (GtkWidget          *widget,
                                              gboolean            was_grabbed);
 static void gtk_notebook_state_changed       (GtkWidget          *widget,
                                              GtkStateType        previous_state);
-static void gtk_notebook_draw_focus          (GtkWidget        *widget,
-                                             GdkEventExpose   *event);
 static gint gtk_notebook_focus               (GtkWidget        *widget,
                                              GtkDirectionType  direction);
 static void gtk_notebook_style_set           (GtkWidget        *widget,
@@ -403,11 +400,12 @@ static void  gtk_notebook_child_reordered    (GtkNotebook      *notebook,
 
 /*** GtkNotebook Drawing Functions ***/
 static void gtk_notebook_paint               (GtkWidget        *widget,
-                                             GdkRectangle     *area);
+                                             cairo_t          *cr);
 static void gtk_notebook_draw_tab            (GtkNotebook      *notebook,
                                              GtkNotebookPage  *page,
-                                             GdkRectangle     *area);
+                                             cairo_t          *cr);
 static void gtk_notebook_draw_arrow          (GtkNotebook      *notebook,
+                                              cairo_t          *cr,
                                              GtkNotebookArrow  arrow);
 
 /*** GtkNotebook Size Allocate Functions ***/
@@ -467,10 +465,6 @@ static void gtk_notebook_buildable_add_child      (GtkBuildable *buildable,
                                                   GObject      *child,
                                                   const gchar  *type);
 
-static GtkNotebookWindowCreationFunc window_creation_hook = NULL;
-static gpointer window_creation_hook_data;
-static GDestroyNotify window_creation_hook_destroy = NULL;
-
 static guint notebook_signals[LAST_SIGNAL] = { 0 };
 
 G_DEFINE_TYPE_WITH_CODE (GtkNotebook, gtk_notebook, GTK_TYPE_CONTAINER,
@@ -482,10 +476,10 @@ add_tab_bindings (GtkBindingSet    *binding_set,
                  GdkModifierType   modifiers,
                  GtkDirectionType  direction)
 {
-  gtk_binding_entry_add_signal (binding_set, GDK_Tab, modifiers,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_Tab, modifiers,
                                 "move_focus_out", 1,
                                 GTK_TYPE_DIRECTION_TYPE, direction);
-  gtk_binding_entry_add_signal (binding_set, GDK_KP_Tab, modifiers,
+  gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Tab, modifiers,
                                 "move_focus_out", 1,
                                 GTK_TYPE_DIRECTION_TYPE, direction);
 }
@@ -495,7 +489,7 @@ add_arrow_bindings (GtkBindingSet    *binding_set,
                    guint             keysym,
                    GtkDirectionType  direction)
 {
-  guint keypad_keysym = keysym - GDK_Left + GDK_KP_Left;
+  guint keypad_keysym = keysym - GDK_KEY_Left + GDK_KEY_KP_Left;
   
   gtk_binding_entry_add_signal (binding_set, keysym, GDK_CONTROL_MASK,
                                 "move_focus_out", 1,
@@ -511,7 +505,7 @@ add_reorder_bindings (GtkBindingSet    *binding_set,
                      GtkDirectionType  direction,
                      gboolean          move_to_last)
 {
-  guint keypad_keysym = keysym - GDK_Left + GDK_KP_Left;
+  guint keypad_keysym = keysym - GDK_KEY_Left + GDK_KEY_KP_Left;
 
   gtk_binding_entry_add_signal (binding_set, keysym, GDK_MOD1_MASK,
                                "reorder_tab", 2,
@@ -543,23 +537,21 @@ static void
 gtk_notebook_class_init (GtkNotebookClass *class)
 {
   GObjectClass   *gobject_class = G_OBJECT_CLASS (class);
-  GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
   GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
   GtkBindingSet *binding_set;
   
   gobject_class->set_property = gtk_notebook_set_property;
   gobject_class->get_property = gtk_notebook_get_property;
-  object_class->destroy = gtk_notebook_destroy;
 
+  widget_class->destroy = gtk_notebook_destroy;
   widget_class->map = gtk_notebook_map;
   widget_class->unmap = gtk_notebook_unmap;
   widget_class->realize = gtk_notebook_realize;
   widget_class->unrealize = gtk_notebook_unrealize;
   widget_class->size_request = gtk_notebook_size_request;
   widget_class->size_allocate = gtk_notebook_size_allocate;
-  widget_class->expose_event = gtk_notebook_expose;
-  widget_class->scroll_event = gtk_notebook_scroll;
+  widget_class->draw = gtk_notebook_draw;
   widget_class->button_press_event = gtk_notebook_button_press;
   widget_class->button_release_event = gtk_notebook_button_release;
   widget_class->popup_menu = gtk_notebook_popup_menu;
@@ -618,14 +610,14 @@ gtk_notebook_class_init (GtkNotebookClass *class)
                                   PROP_SHOW_TABS,
                                   g_param_spec_boolean ("show-tabs",
                                                         P_("Show Tabs"),
-                                                        P_("Whether tabs should be shown or not"),
+                                                        P_("Whether tabs should be shown"),
                                                         TRUE,
                                                         GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
                                   PROP_SHOW_BORDER,
                                   g_param_spec_boolean ("show-border",
                                                         P_("Show Border"),
-                                                        P_("Whether the border should be shown or not"),
+                                                        P_("Whether the border should be shown"),
                                                         TRUE,
                                                         GTK_PARAM_READWRITE));
   g_object_class_install_property (gobject_class,
@@ -644,18 +636,19 @@ gtk_notebook_class_init (GtkNotebookClass *class)
                                                         GTK_PARAM_READWRITE));
 
   /**
-   * GtkNotebook:group:
-   *  
-   * Group for tabs drag and drop.
+   * GtkNotebook:group-name:
    *
-   * Since: 2.12
-   */    
+   * Group name for tab drag and drop.
+   *
+   * Since: 2.24
+   */
   g_object_class_install_property (gobject_class,
-                                  PROP_GROUP,
-                                  g_param_spec_pointer ("group",
-                                                        P_("Group"),
-                                                        P_("Group for tabs drag and drop"),
-                                                        GTK_PARAM_READWRITE));
+                                  PROP_GROUP_NAME,
+                                  g_param_spec_string ("group-name",
+                                                       P_("Group Name"),
+                                                       P_("Group name for tab drag and drop"),
+                                                        NULL,
+                                                       GTK_PARAM_READWRITE));
 
   gtk_container_class_install_child_property (container_class,
                                              CHILD_PROP_TAB_LABEL,
@@ -682,14 +675,14 @@ gtk_notebook_class_init (GtkNotebookClass *class)
                                              CHILD_PROP_TAB_EXPAND,
                                              g_param_spec_boolean ("tab-expand", 
                                                                    P_("Tab expand"), 
-                                                                   P_("Whether to expand the child's tab or not"),
+                                                                   P_("Whether to expand the child's tab"),
                                                                    FALSE,
                                                                    GTK_PARAM_READWRITE));
   gtk_container_class_install_child_property (container_class,
                                              CHILD_PROP_TAB_FILL,
                                              g_param_spec_boolean ("tab-fill", 
                                                                    P_("Tab fill"), 
-                                                                   P_("Whether the child's tab should fill the allocated area or not"),
+                                                                   P_("Whether the child's tab should fill the allocated area"),
                                                                    TRUE,
                                                                    GTK_PARAM_READWRITE));
   gtk_container_class_install_child_property (container_class,
@@ -703,7 +696,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
                                              CHILD_PROP_REORDERABLE,
                                              g_param_spec_boolean ("reorderable",
                                                                    P_("Tab reorderable"),
-                                                                   P_("Whether the tab is reorderable by user action or not"),
+                                                                   P_("Whether the tab is reorderable by user action"),
                                                                    FALSE,
                                                                    GTK_PARAM_READWRITE));
   gtk_container_class_install_child_property (container_class,
@@ -832,7 +825,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (GtkNotebookClass, switch_page),
                  NULL, NULL,
-                 _gtk_marshal_VOID__POINTER_UINT,
+                 _gtk_marshal_VOID__OBJECT_UINT,
                  G_TYPE_NONE, 2,
                  GTK_TYPE_WIDGET,
                  G_TYPE_UINT);
@@ -959,9 +952,6 @@ gtk_notebook_class_init (GtkNotebookClass *class)
    * necessary properties to the notebook (e.g. the 
    * #GtkNotebook:group ).
    *
-   * The default handler uses the global window creation hook,
-   * if one has been set with gtk_notebook_set_window_creation_hook().
-   *
    * Returns: a #GtkNotebook that @page should be added to, or %NULL.
    *
    * Since: 2.12
@@ -978,80 +968,80 @@ gtk_notebook_class_init (GtkNotebookClass *class)
  
   binding_set = gtk_binding_set_by_class (class);
   gtk_binding_entry_add_signal (binding_set,
-                                GDK_space, 0,
+                                GDK_KEY_space, 0,
                                 "select-page", 1, 
                                 G_TYPE_BOOLEAN, FALSE);
   gtk_binding_entry_add_signal (binding_set,
-                                GDK_KP_Space, 0,
+                                GDK_KEY_KP_Space, 0,
                                 "select-page", 1, 
                                 G_TYPE_BOOLEAN, FALSE);
   
   gtk_binding_entry_add_signal (binding_set,
-                                GDK_Home, 0,
+                                GDK_KEY_Home, 0,
                                 "focus-tab", 1, 
                                 GTK_TYPE_NOTEBOOK_TAB, GTK_NOTEBOOK_TAB_FIRST);
   gtk_binding_entry_add_signal (binding_set,
-                                GDK_KP_Home, 0,
+                                GDK_KEY_KP_Home, 0,
                                 "focus-tab", 1, 
                                 GTK_TYPE_NOTEBOOK_TAB, GTK_NOTEBOOK_TAB_FIRST);
   gtk_binding_entry_add_signal (binding_set,
-                                GDK_End, 0,
+                                GDK_KEY_End, 0,
                                 "focus-tab", 1, 
                                 GTK_TYPE_NOTEBOOK_TAB, GTK_NOTEBOOK_TAB_LAST);
   gtk_binding_entry_add_signal (binding_set,
-                                GDK_KP_End, 0,
+                                GDK_KEY_KP_End, 0,
                                 "focus-tab", 1, 
                                 GTK_TYPE_NOTEBOOK_TAB, GTK_NOTEBOOK_TAB_LAST);
 
   gtk_binding_entry_add_signal (binding_set,
-                                GDK_Page_Up, GDK_CONTROL_MASK,
+                                GDK_KEY_Page_Up, GDK_CONTROL_MASK,
                                 "change-current-page", 1,
                                 G_TYPE_INT, -1);
   gtk_binding_entry_add_signal (binding_set,
-                                GDK_Page_Down, GDK_CONTROL_MASK,
+                                GDK_KEY_Page_Down, GDK_CONTROL_MASK,
                                 "change-current-page", 1,
                                 G_TYPE_INT, 1);
 
   gtk_binding_entry_add_signal (binding_set,
-                                GDK_Page_Up, GDK_CONTROL_MASK | GDK_MOD1_MASK,
+                                GDK_KEY_Page_Up, GDK_CONTROL_MASK | GDK_MOD1_MASK,
                                 "change-current-page", 1,
                                 G_TYPE_INT, -1);
   gtk_binding_entry_add_signal (binding_set,
-                                GDK_Page_Down, GDK_CONTROL_MASK | GDK_MOD1_MASK,
+                                GDK_KEY_Page_Down, GDK_CONTROL_MASK | GDK_MOD1_MASK,
                                 "change-current-page", 1,
                                 G_TYPE_INT, 1);
 
-  add_arrow_bindings (binding_set, GDK_Up, GTK_DIR_UP);
-  add_arrow_bindings (binding_set, GDK_Down, GTK_DIR_DOWN);
-  add_arrow_bindings (binding_set, GDK_Left, GTK_DIR_LEFT);
-  add_arrow_bindings (binding_set, GDK_Right, GTK_DIR_RIGHT);
+  add_arrow_bindings (binding_set, GDK_KEY_Up, GTK_DIR_UP);
+  add_arrow_bindings (binding_set, GDK_KEY_Down, GTK_DIR_DOWN);
+  add_arrow_bindings (binding_set, GDK_KEY_Left, GTK_DIR_LEFT);
+  add_arrow_bindings (binding_set, GDK_KEY_Right, GTK_DIR_RIGHT);
 
-  add_reorder_bindings (binding_set, GDK_Up, GTK_DIR_UP, FALSE);
-  add_reorder_bindings (binding_set, GDK_Down, GTK_DIR_DOWN, FALSE);
-  add_reorder_bindings (binding_set, GDK_Left, GTK_DIR_LEFT, FALSE);
-  add_reorder_bindings (binding_set, GDK_Right, GTK_DIR_RIGHT, FALSE);
-  add_reorder_bindings (binding_set, GDK_Home, GTK_DIR_LEFT, TRUE);
-  add_reorder_bindings (binding_set, GDK_Home, GTK_DIR_UP, TRUE);
-  add_reorder_bindings (binding_set, GDK_End, GTK_DIR_RIGHT, TRUE);
-  add_reorder_bindings (binding_set, GDK_End, GTK_DIR_DOWN, TRUE);
+  add_reorder_bindings (binding_set, GDK_KEY_Up, GTK_DIR_UP, FALSE);
+  add_reorder_bindings (binding_set, GDK_KEY_Down, GTK_DIR_DOWN, FALSE);
+  add_reorder_bindings (binding_set, GDK_KEY_Left, GTK_DIR_LEFT, FALSE);
+  add_reorder_bindings (binding_set, GDK_KEY_Right, GTK_DIR_RIGHT, FALSE);
+  add_reorder_bindings (binding_set, GDK_KEY_Home, GTK_DIR_LEFT, TRUE);
+  add_reorder_bindings (binding_set, GDK_KEY_Home, GTK_DIR_UP, TRUE);
+  add_reorder_bindings (binding_set, GDK_KEY_End, GTK_DIR_RIGHT, TRUE);
+  add_reorder_bindings (binding_set, GDK_KEY_End, GTK_DIR_DOWN, TRUE);
 
   add_tab_bindings (binding_set, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
   add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
 
-  g_type_class_add_private (class, sizeof (GtkNotebookPriv));
+  g_type_class_add_private (class, sizeof (GtkNotebookPrivate));
 }
 
 static void
 gtk_notebook_init (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
 
   gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE);
   gtk_widget_set_has_window (GTK_WIDGET (notebook), FALSE);
 
   notebook->priv = G_TYPE_INSTANCE_GET_PRIVATE (notebook,
                                                 GTK_TYPE_NOTEBOOK,
-                                                GtkNotebookPriv);
+                                                GtkNotebookPrivate);
   priv = notebook->priv;
 
   priv->cur_page = NULL;
@@ -1081,7 +1071,7 @@ gtk_notebook_init (GtkNotebook *notebook)
   priv->has_after_previous  = 0;
   priv->has_after_next      = 1;
 
-  priv->group = NULL;
+  priv->group = 0;
   priv->pressed_button = -1;
   priv->dnd_timer = 0;
   priv->switch_tab_timer = 0;
@@ -1144,7 +1134,7 @@ static gboolean
 gtk_notebook_select_page (GtkNotebook *notebook,
                           gboolean     move_focus)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && priv->show_tabs)
     {
@@ -1159,7 +1149,7 @@ static gboolean
 gtk_notebook_focus_tab (GtkNotebook       *notebook,
                         GtkNotebookTab     type)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *list;
 
   if (gtk_widget_is_focus (GTK_WIDGET (notebook)) && priv->show_tabs)
@@ -1188,7 +1178,7 @@ static gboolean
 gtk_notebook_change_current_page (GtkNotebook *notebook,
                                  gint         offset)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *current = NULL;
 
   if (!priv->show_tabs)
@@ -1234,7 +1224,7 @@ static GtkDirectionType
 get_effective_direction (GtkNotebook      *notebook,
                         GtkDirectionType  direction)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   /* Remap the directions into the effective direction it would be for a
    * GTK_POS_TOP notebook
@@ -1263,7 +1253,7 @@ get_effective_direction (GtkNotebook      *notebook,
 static gint
 get_effective_tab_pos (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   if (gtk_widget_get_direction (GTK_WIDGET (notebook)) == GTK_TEXT_DIR_RTL)
     {
@@ -1309,7 +1299,7 @@ static void
 gtk_notebook_move_focus_out (GtkNotebook      *notebook,
                             GtkDirectionType  direction_type)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkDirectionType effective_direction = get_effective_direction (notebook, direction_type);
   GtkWidget *toplevel;
   
@@ -1339,7 +1329,7 @@ gtk_notebook_move_focus_out (GtkNotebook      *notebook,
 static gint
 reorder_tab (GtkNotebook *notebook, GList *position, GList *tab)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *elem;
 
   if (position == tab)
@@ -1386,7 +1376,7 @@ gtk_notebook_reorder_tab (GtkNotebook      *notebook,
                          GtkDirectionType  direction_type,
                          gboolean          move_to_last)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkDirectionType effective_direction = get_effective_direction (notebook, direction_type);
   GtkNotebookPage *page;
   GList *last, *child;
@@ -1462,36 +1452,11 @@ gtk_notebook_new (void)
   return g_object_new (GTK_TYPE_NOTEBOOK, NULL);
 }
 
-/* Private GtkObject Methods :
- * 
- * gtk_notebook_destroy
- * gtk_notebook_set_arg
- * gtk_notebook_get_arg
+/* Private GObject Methods :
+ *
+ * gtk_notebook_set_property
+ * gtk_notebook_get_property
  */
-static void
-gtk_notebook_destroy (GtkObject *object)
-{
-  GtkNotebook *notebook = GTK_NOTEBOOK (object);
-  GtkNotebookPriv *priv = notebook->priv;
-
-  if (priv->menu)
-    gtk_notebook_popup_disable (notebook);
-
-  if (priv->source_targets)
-    {
-      gtk_target_list_unref (priv->source_targets);
-      priv->source_targets = NULL;
-    }
-
-  if (priv->switch_tab_timer)
-    {
-      g_source_remove (priv->switch_tab_timer);
-      priv->switch_tab_timer = 0;
-    }
-
-  GTK_OBJECT_CLASS (gtk_notebook_parent_class)->destroy (object);
-}
-
 static void
 gtk_notebook_set_property (GObject         *object,
                           guint            prop_id,
@@ -1525,8 +1490,8 @@ gtk_notebook_set_property (GObject         *object,
     case PROP_TAB_POS:
       gtk_notebook_set_tab_pos (notebook, g_value_get_enum (value));
       break;
-    case PROP_GROUP:
-      gtk_notebook_set_group (notebook, g_value_get_pointer (value));
+    case PROP_GROUP_NAME:
+      gtk_notebook_set_group_name (notebook, g_value_get_string (value));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1541,7 +1506,7 @@ gtk_notebook_get_property (GObject         *object,
                           GParamSpec      *pspec)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (object);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   switch (prop_id)
     {
@@ -1563,8 +1528,8 @@ gtk_notebook_get_property (GObject         *object,
     case PROP_TAB_POS:
       g_value_set_enum (value, priv->tab_pos);
       break;
-    case PROP_GROUP:
-      g_value_set_pointer (value, priv->group);
+    case PROP_GROUP_NAME:
+      g_value_set_string (value, gtk_notebook_get_group_name (notebook));
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1573,13 +1538,14 @@ gtk_notebook_get_property (GObject         *object,
 }
 
 /* Private GtkWidget Methods :
- * 
+ *
+ * gtk_notebook_destroy
  * gtk_notebook_map
  * gtk_notebook_unmap
  * gtk_notebook_realize
  * gtk_notebook_size_request
  * gtk_notebook_size_allocate
- * gtk_notebook_expose
+ * gtk_notebook_draw
  * gtk_notebook_scroll
  * gtk_notebook_button_press
  * gtk_notebook_button_release
@@ -1588,7 +1554,6 @@ gtk_notebook_get_property (GObject         *object,
  * gtk_notebook_motion_notify
  * gtk_notebook_focus_in
  * gtk_notebook_focus_out
- * gtk_notebook_draw_focus
  * gtk_notebook_style_set
  * gtk_notebook_drag_begin
  * gtk_notebook_drag_end
@@ -1598,11 +1563,36 @@ gtk_notebook_get_property (GObject         *object,
  * gtk_notebook_drag_data_get
  * gtk_notebook_drag_data_received
  */
+static void
+gtk_notebook_destroy (GtkWidget *widget)
+{
+  GtkNotebook *notebook = GTK_NOTEBOOK (widget);
+  GtkNotebookPrivate *priv = notebook->priv;
+
+  if (priv->menu)
+    gtk_notebook_popup_disable (notebook);
+
+  if (priv->source_targets)
+    {
+      gtk_target_list_unref (priv->source_targets);
+      priv->source_targets = NULL;
+    }
+
+  if (priv->switch_tab_timer)
+    {
+      g_source_remove (priv->switch_tab_timer);
+      priv->switch_tab_timer = 0;
+    }
+
+  GTK_WIDGET_CLASS (gtk_notebook_parent_class)->destroy (widget);
+}
+
 static gboolean
 gtk_notebook_get_event_window_position (GtkNotebook  *notebook,
                                        GdkRectangle *rectangle)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
+  GtkAllocation allocation, action_allocation;
   GtkWidget *widget = GTK_WIDGET (notebook);
   guint border_width = gtk_container_get_border_width (GTK_CONTAINER (notebook));
   GtkNotebookPage *visible_page = NULL;
@@ -1625,47 +1615,53 @@ gtk_notebook_get_event_window_position (GtkNotebook  *notebook,
     {
       if (rectangle)
        {
+          gtk_widget_get_allocation (widget, &allocation);
+
          is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
-         rectangle->x = widget->allocation.x + border_width;
-         rectangle->y = widget->allocation.y + border_width;
+         rectangle->x = allocation.x + border_width;
+         rectangle->y = allocation.y + border_width;
 
          switch (tab_pos)
            {
            case GTK_POS_TOP:
            case GTK_POS_BOTTOM:
-             rectangle->width = widget->allocation.width - 2 * border_width;
+             rectangle->width = allocation.width - 2 * border_width;
              rectangle->height = visible_page->requisition.height;
              if (tab_pos == GTK_POS_BOTTOM)
-               rectangle->y += widget->allocation.height - 2 * border_width - rectangle->height;
+               rectangle->y += allocation.height - 2 * border_width - rectangle->height;
 
               for (i = 0; i < N_ACTION_WIDGETS; i++)
                 {
                   if (priv->action_widget[i] &&
                       gtk_widget_get_visible (priv->action_widget[i]))
                     {
-                      rectangle->width -= priv->action_widget[i]->allocation.width;
+                      gtk_widget_get_allocation (priv->action_widget[i], &action_allocation);
+
+                      rectangle->width -= action_allocation.width;
                       if ((!is_rtl && i == ACTION_WIDGET_START) ||
                           (is_rtl && i == ACTION_WIDGET_END))
-                        rectangle->x += priv->action_widget[i]->allocation.width;
+                        rectangle->x += action_allocation.width;
                     }
                 }
              break;
            case GTK_POS_LEFT:
            case GTK_POS_RIGHT:
              rectangle->width = visible_page->requisition.width;
-             rectangle->height = widget->allocation.height - 2 * border_width;
+             rectangle->height = allocation.height - 2 * border_width;
              if (tab_pos == GTK_POS_RIGHT)
-               rectangle->x += widget->allocation.width - 2 * border_width - rectangle->width;
+               rectangle->x += allocation.width - 2 * border_width - rectangle->width;
 
               for (i = 0; i < N_ACTION_WIDGETS; i++)
                 {
                   if (priv->action_widget[i] &&
                       gtk_widget_get_visible (priv->action_widget[i]))
                     {
-                      rectangle->height -= priv->action_widget[i]->allocation.height;
+                      gtk_widget_get_allocation (priv->action_widget[i], &action_allocation);
+
+                      rectangle->height -= action_allocation.height;
 
                       if (i == ACTION_WIDGET_START)
-                        rectangle->y += priv->action_widget[i]->allocation.height;
+                        rectangle->y += action_allocation.height;
                     }
                 }
               break;
@@ -1690,7 +1686,7 @@ static void
 gtk_notebook_map (GtkWidget *widget)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   GList *children;
   gint i;
@@ -1706,7 +1702,7 @@ gtk_notebook_map (GtkWidget *widget)
     {
       if (priv->action_widget[i] &&
           gtk_widget_get_visible (priv->action_widget[i]) &&
-          GTK_WIDGET_CHILD_VISIBLE (priv->action_widget[i]) &&
+          gtk_widget_get_child_visible (priv->action_widget[i]) &&
           !gtk_widget_get_mapped (priv->action_widget[i]))
         gtk_widget_map (priv->action_widget[i]);
     }
@@ -1737,7 +1733,7 @@ static void
 gtk_notebook_unmap (GtkWidget *widget)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   stop_scrolling (notebook);
 
@@ -1752,7 +1748,8 @@ static void
 gtk_notebook_realize (GtkWidget *widget)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
+  GdkWindow *window;
   GdkWindowAttr attributes;
   gint attributes_mask;
   GdkRectangle event_window_pos;
@@ -1760,10 +1757,11 @@ gtk_notebook_realize (GtkWidget *widget)
   gtk_widget_set_realized (widget, TRUE);
 
   gtk_notebook_get_event_window_position (notebook, &event_window_pos);
-  
-  widget->window = gtk_widget_get_parent_window (widget);
-  g_object_ref (widget->window);
-  
+
+  window = gtk_widget_get_parent_window (widget);
+  gtk_widget_set_window (widget, window);
+  g_object_ref (window);
+
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.x = event_window_pos.x;
   attributes.y = event_window_pos.y;
@@ -1773,22 +1771,21 @@ gtk_notebook_realize (GtkWidget *widget)
   attributes.event_mask = gtk_widget_get_events (widget);
   attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
                            GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK |
-                           GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK |
-                           GDK_SCROLL_MASK);
+                           GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
   attributes_mask = GDK_WA_X | GDK_WA_Y;
 
   priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
                                           &attributes, attributes_mask);
   gdk_window_set_user_data (priv->event_window, notebook);
 
-  widget->style = gtk_style_attach (widget->style, widget->window);
+  gtk_widget_style_attach (widget);
 }
 
 static void
 gtk_notebook_unrealize (GtkWidget *widget)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   gdk_window_set_user_data (priv->event_window, NULL);
   gdk_window_destroy (priv->event_window);
@@ -1809,7 +1806,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
                           GtkRequisition *requisition)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   GList *children;
   GtkRequisition child_requisition;
@@ -1833,42 +1830,55 @@ gtk_notebook_size_request (GtkWidget      *widget,
                         "scroll-arrow-vlength", &scroll_arrow_vlength,
                        NULL);
 
-  widget->requisition.width = 0;
-  widget->requisition.height = 0;
+  requisition->width = 0;
+  requisition->height = 0;
 
   for (children = priv->children, vis_pages = 0; children;
        children = children->next)
     {
+      GtkWidget *parent;
       page = children->data;
 
       if (gtk_widget_get_visible (page->child))
        {
          vis_pages++;
-         gtk_widget_size_request (page->child, &child_requisition);
-         
-         widget->requisition.width = MAX (widget->requisition.width,
+          gtk_widget_get_preferred_size (page->child,
+                                         &child_requisition, NULL);
+
+         requisition->width = MAX (requisition->width,
                                           child_requisition.width);
-         widget->requisition.height = MAX (widget->requisition.height,
+         requisition->height = MAX (requisition->height,
                                            child_requisition.height);
 
-         if (priv->menu && page->menu_label->parent &&
-             !gtk_widget_get_visible (page->menu_label->parent))
-           gtk_widget_show (page->menu_label->parent);
+         if (priv->menu && page->menu_label)
+            {
+              parent = gtk_widget_get_parent (page->menu_label);
+              if (parent && !gtk_widget_get_visible (parent))
+                gtk_widget_show (parent);
+            }
        }
       else
        {
          if (page == priv->cur_page)
            switch_page = TRUE;
-         if (priv->menu && page->menu_label->parent &&
-             gtk_widget_get_visible (page->menu_label->parent))
-           gtk_widget_hide (page->menu_label->parent);
+
+         if (priv->menu && page->menu_label)
+            {
+              parent = gtk_widget_get_parent (page->menu_label);
+              if (parent && gtk_widget_get_visible (parent))
+                gtk_widget_hide (parent);
+            }
        }
     }
 
   if (priv->show_border || priv->show_tabs)
     {
-      widget->requisition.width += widget->style->xthickness * 2;
-      widget->requisition.height += widget->style->ythickness * 2;
+      GtkStyle *style;
+
+      style = gtk_widget_get_style (widget);
+
+      requisition->width += style->xthickness * 2;
+      requisition->height += style->ythickness * 2;
 
       if (priv->show_tabs)
        {
@@ -1890,15 +1900,11 @@ gtk_notebook_size_request (GtkWidget      *widget,
                  if (!gtk_widget_get_visible (page->tab_label))
                    gtk_widget_show (page->tab_label);
 
-                 gtk_widget_size_request (page->tab_label,
-                                          &child_requisition);
+                  gtk_widget_get_preferred_size (page->tab_label,
+                                                 &child_requisition, NULL);
 
-                 page->requisition.width = 
-                   child_requisition.width +
-                   2 * widget->style->xthickness;
-                 page->requisition.height = 
-                   child_requisition.height +
-                   2 * widget->style->ythickness;
+                  page->requisition.width = child_requisition.width + 2 * style->xthickness;
+                 page->requisition.height = child_requisition.height + 2 * style->ythickness;
 
                  switch (priv->tab_pos)
                    {
@@ -1930,9 +1936,10 @@ gtk_notebook_size_request (GtkWidget      *widget,
                 {
                   if (priv->action_widget[i])
                     {
-                      gtk_widget_size_request (priv->action_widget[i], &action_widget_requisition[i]);
-                      action_widget_requisition[i].width += widget->style->xthickness;
-                      action_widget_requisition[i].height += widget->style->ythickness;
+                      gtk_widget_get_preferred_size (priv->action_widget[i],
+                                                     &action_widget_requisition[i], NULL);
+                      action_widget_requisition[i].width += style->xthickness;
+                      action_widget_requisition[i].height += style->ythickness;
                     }
                 }
 
@@ -1944,7 +1951,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
                    break;
 
                  if (priv->scrollable && vis_pages > 1 &&
-                     widget->requisition.width < tab_width)
+                     requisition->width < tab_width)
                    tab_height = MAX (tab_height, scroll_arrow_hlength);
 
                   tab_height = MAX (tab_height, action_widget_requisition[ACTION_WIDGET_START].height);
@@ -1971,20 +1978,20 @@ gtk_notebook_size_request (GtkWidget      *widget,
                    }
 
                  if (priv->scrollable && vis_pages > 1 &&
-                     widget->requisition.width < tab_width)
+                     requisition->width < tab_width)
                    tab_width = tab_max + 2 * (scroll_arrow_hlength + arrow_spacing);
 
                  action_width += action_widget_requisition[ACTION_WIDGET_START].width;
                  action_width += action_widget_requisition[ACTION_WIDGET_END].width;
                   if (priv->homogeneous && !priv->scrollable)
-                    widget->requisition.width = MAX (widget->requisition.width,
+                    requisition->width = MAX (requisition->width,
                                                      vis_pages * tab_max +
                                                      tab_overlap + action_width);
                   else
-                    widget->requisition.width = MAX (widget->requisition.width,
+                    requisition->width = MAX (requisition->width,
                                                      tab_width + tab_overlap + action_width);
 
-                 widget->requisition.height += tab_height;
+                 requisition->height += tab_height;
                  break;
                case GTK_POS_LEFT:
                case GTK_POS_RIGHT:
@@ -1992,7 +1999,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
                    break;
 
                  if (priv->scrollable && vis_pages > 1 &&
-                     widget->requisition.height < tab_height)
+                     requisition->height < tab_height)
                    tab_width = MAX (tab_width,
                                      arrow_spacing + 2 * scroll_arrow_vlength);
 
@@ -2022,27 +2029,27 @@ gtk_notebook_size_request (GtkWidget      *widget,
                    }
 
                  if (priv->scrollable && vis_pages > 1 &&
-                     widget->requisition.height < tab_height)
+                     requisition->height < tab_height)
                    tab_height = tab_max + (2 * scroll_arrow_vlength + arrow_spacing);
                  action_height += action_widget_requisition[ACTION_WIDGET_START].height;
                  action_height += action_widget_requisition[ACTION_WIDGET_END].height;
 
                   if (priv->homogeneous && !priv->scrollable)
-                    widget->requisition.height =
-                     MAX (widget->requisition.height,
+                    requisition->height =
+                     MAX (requisition->height,
                           vis_pages * tab_max + tab_overlap + action_height);
                   else
-                    widget->requisition.height =
-                     MAX (widget->requisition.height,
+                    requisition->height =
+                     MAX (requisition->height,
                           tab_height + tab_overlap + action_height);
 
                  if (!priv->homogeneous || priv->scrollable)
                    vis_pages = 1;
-                 widget->requisition.height = MAX (widget->requisition.height,
-                                                   vis_pages * tab_max +
-                                                   tab_overlap);
+                 requisition->height = MAX (requisition->height,
+                                            vis_pages * tab_max +
+                                            tab_overlap);
 
-                 widget->requisition.width += tab_width;
+                 requisition->width += tab_width;
                  break;
                }
            }
@@ -2062,8 +2069,8 @@ gtk_notebook_size_request (GtkWidget      *widget,
 
   border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
 
-  widget->requisition.width += border_width * 2;
-  widget->requisition.height += border_width * 2;
+  requisition->width += border_width * 2;
+  requisition->height += border_width * 2;
 
   if (switch_page)
     {
@@ -2082,8 +2089,8 @@ gtk_notebook_size_request (GtkWidget      *widget,
        }
       else if (gtk_widget_get_visible (widget))
        {
-         widget->requisition.width = border_width * 2;
-         widget->requisition.height= border_width * 2;
+         requisition->width  = border_width * 2;
+         requisition->height = border_width * 2;
        }
     }
   if (vis_pages && !priv->cur_page)
@@ -2102,14 +2109,18 @@ gtk_notebook_size_allocate (GtkWidget     *widget,
                            GtkAllocation *allocation)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
+  GtkStyle *style;
   gint tab_pos = get_effective_tab_pos (notebook);
   gboolean is_rtl;
   gint focus_width;
 
+  style = gtk_widget_get_style (widget);
+
   gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
-  
-  widget->allocation = *allocation;
+
+  gtk_widget_set_allocation (widget, allocation);
+
   if (gtk_widget_get_realized (widget))
     {
       GdkRectangle position;
@@ -2133,20 +2144,18 @@ gtk_notebook_size_allocate (GtkWidget     *widget,
       GtkAllocation child_allocation;
       GList *children;
       gint i;
-      
-      child_allocation.x = widget->allocation.x + border_width;
-      child_allocation.y = widget->allocation.y + border_width;
+
+      child_allocation.x = allocation->x + border_width;
+      child_allocation.y = allocation->y + border_width;
       child_allocation.width = MAX (1, allocation->width - border_width * 2);
       child_allocation.height = MAX (1, allocation->height - border_width * 2);
 
       if (priv->show_tabs || priv->show_border)
        {
-         child_allocation.x += widget->style->xthickness;
-         child_allocation.y += widget->style->ythickness;
-         child_allocation.width = MAX (1, child_allocation.width -
-                                       widget->style->xthickness * 2);
-         child_allocation.height = MAX (1, child_allocation.height -
-                                        widget->style->ythickness * 2);
+         child_allocation.x += style->xthickness;
+         child_allocation.y += style->ythickness;
+         child_allocation.width = MAX (1, child_allocation.width - style->xthickness * 2);
+         child_allocation.height = MAX (1, child_allocation.height - style->ythickness * 2);
 
          if (priv->show_tabs && priv->children && priv->cur_page)
            {
@@ -2171,44 +2180,42 @@ gtk_notebook_size_allocate (GtkWidget     *widget,
               for (i = 0; i < N_ACTION_WIDGETS; i++)
                 {
                   GtkAllocation widget_allocation;
-
+                 GtkRequisition requisition;
+                 
                   if (!priv->action_widget[i])
                     continue;
 
-                 widget_allocation.x = widget->allocation.x + border_width;
-                 widget_allocation.y = widget->allocation.y + border_width;
+                 widget_allocation.x = allocation->x + border_width;
+                 widget_allocation.y = allocation->y + border_width;
                  is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
 
+                  gtk_widget_get_preferred_size (priv->action_widget[i],
+                                                 &requisition, NULL);
+
                  switch (tab_pos)
                    {
                    case GTK_POS_BOTTOM:
-                     widget_allocation.y +=
-                       widget->allocation.height - 2 * border_width - priv->cur_page->requisition.height;
+                     widget_allocation.y += allocation->height - 2 * border_width - priv->cur_page->requisition.height;
                      /* fall through */
                    case GTK_POS_TOP:
-                     widget_allocation.width = priv->action_widget[i]->requisition.width;
-                     widget_allocation.height = priv->cur_page->requisition.height - widget->style->ythickness;
+                     widget_allocation.width = requisition.width;
+                     widget_allocation.height = priv->cur_page->requisition.height - style->ythickness;
 
                      if ((i == ACTION_WIDGET_START && is_rtl) ||
                           (i == ACTION_WIDGET_END && !is_rtl))
-                       widget_allocation.x +=
-                         widget->allocation.width - 2 * border_width -
-                         priv->action_widget[i]->requisition.width;
+                       widget_allocation.x += allocation->width - 2 * border_width - requisition.width;
                       if (tab_pos == GTK_POS_TOP) /* no fall through */
                           widget_allocation.y += 2 * focus_width;
                      break;
                    case GTK_POS_RIGHT:
-                     widget_allocation.x +=
-                       widget->allocation.width - 2 * border_width - priv->cur_page->requisition.width;
+                     widget_allocation.x += allocation->width - 2 * border_width - priv->cur_page->requisition.width;
                      /* fall through */
                    case GTK_POS_LEFT:
-                     widget_allocation.height = priv->action_widget[i]->requisition.height;
-                     widget_allocation.width = priv->cur_page->requisition.width - widget->style->xthickness;
+                     widget_allocation.height = requisition.height;
+                     widget_allocation.width = priv->cur_page->requisition.width - style->xthickness;
 
                       if (i == ACTION_WIDGET_END)
-                        widget_allocation.y +=
-                          widget->allocation.height - 2 * border_width -
-                          priv->action_widget[i]->requisition.height;
+                        widget_allocation.y += allocation->height - 2 * border_width - requisition.height;
                       if (tab_pos == GTK_POS_LEFT) /* no fall through */  
                         widget_allocation.x += 2 * focus_width;
                      break;
@@ -2234,85 +2241,90 @@ gtk_notebook_size_allocate (GtkWidget     *widget,
 }
 
 static gint
-gtk_notebook_expose (GtkWidget      *widget,
-                    GdkEventExpose *event)
+gtk_notebook_draw (GtkWidget *widget,
+                   cairo_t   *cr)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
+  GtkAllocation allocation;
+  GdkWindow *window;
   gint i;
 
-  if (event->window == priv->drag_window)
+  gtk_widget_get_allocation (widget, &allocation);
+
+  window = gtk_widget_get_window (widget);
+  if (gtk_cairo_should_draw_window (cr, window))
     {
-      GdkRectangle area = { 0, };
-      cairo_t *cr;
+      cairo_save (cr);
 
-      /* FIXME: This is a workaround to make tabs reordering work better
-       * with engines with rounded tabs. If the drag window background
-       * isn't set, the rounded corners would be black.
-       *
-       * Ideally, these corners should be made transparent, Either by using
-       * ARGB visuals or shape windows.
-       */
-      cr = gdk_cairo_create (priv->drag_window);
-      gdk_cairo_set_source_color (cr, &widget->style->bg [GTK_STATE_NORMAL]);
-      cairo_paint (cr);
-      cairo_destroy (cr);
+      cairo_translate (cr, -allocation.x, -allocation.y);
+      gtk_notebook_paint (widget, cr);
+
+      cairo_restore (cr);
 
-      gdk_drawable_get_size (priv->drag_window,
-                            &area.width, &area.height);
-      gtk_notebook_draw_tab (notebook,
-                            priv->cur_page,
-                            &area);
-      gtk_notebook_draw_focus (widget, event);
-      gtk_container_propagate_expose (GTK_CONTAINER (notebook),
-                                     priv->cur_page->tab_label, event);
-    }
-  else if (gtk_widget_is_drawable (widget))
-    {
-      gtk_notebook_paint (widget, &event->area);
       if (priv->show_tabs)
        {
          GtkNotebookPage *page;
          GList *pages;
 
-         gtk_notebook_draw_focus (widget, event);
-         pages = priv->children;
-
-         while (pages)
-           {
+         for (pages = priv->children; pages; pages = pages->next)
+            {
              page = GTK_NOTEBOOK_PAGE (pages);
-             pages = pages->next;
 
-             if (page->tab_label->window == event->window &&
-                 gtk_widget_is_drawable (page->tab_label))
-               gtk_container_propagate_expose (GTK_CONTAINER (notebook),
-                                               page->tab_label, event);
+              if (gtk_widget_get_parent (page->tab_label) == widget)
+                gtk_container_propagate_draw (GTK_CONTAINER (notebook),
+                                              page->tab_label, cr);
            }
        }
 
-      if (priv->cur_page)
-       gtk_container_propagate_expose (GTK_CONTAINER (notebook),
-                                       priv->cur_page->child,
-                                       event);
+      if (priv->cur_page && priv->operation != DRAG_OPERATION_REORDER)
+       gtk_container_propagate_draw (GTK_CONTAINER (notebook),
+                                      priv->cur_page->child,
+                                      cr);
       if (priv->show_tabs)
       {
         for (i = 0; i < N_ACTION_WIDGETS; i++)
         {
-          if (priv->action_widget[i] &&
-              gtk_widget_is_drawable (priv->action_widget[i]))
-            gtk_container_propagate_expose (GTK_CONTAINER (notebook),
-                                            priv->action_widget[i], event);
+          if (priv->action_widget[i])
+            gtk_container_propagate_draw (GTK_CONTAINER (notebook),
+                                          priv->action_widget[i], cr);
         }
       }
     }
 
+  if (priv->operation == DRAG_OPERATION_REORDER &&
+      gtk_cairo_should_draw_window (cr, priv->drag_window))
+    {
+      cairo_save (cr);
+      gtk_cairo_transform_to_window (cr, widget, priv->drag_window);
+
+      /* FIXME: This is a workaround to make tabs reordering work better
+       * with engines with rounded tabs. If the drag window background
+       * isn't set, the rounded corners would be black.
+       *
+       * Ideally, these corners should be made transparent, Either by using
+       * ARGB visuals or shape windows.
+       */
+      gdk_cairo_set_source_color (cr, &gtk_widget_get_style (widget)->bg [GTK_STATE_NORMAL]);
+      cairo_paint (cr);
+
+      gtk_notebook_draw_tab (notebook,
+                            priv->cur_page,
+                            cr);
+
+      cairo_restore (cr);
+
+      gtk_container_propagate_draw (GTK_CONTAINER (notebook),
+                                   priv->cur_page->tab_label, cr);
+    }
+  
   return FALSE;
 }
 
 static gboolean
 gtk_notebook_show_arrows (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   gboolean show_arrow = FALSE;
   GList *children;
 
@@ -2338,7 +2350,7 @@ gtk_notebook_get_arrow_rect (GtkNotebook     *notebook,
                             GdkRectangle    *rectangle,
                             GtkNotebookArrow arrow)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GdkRectangle event_window_pos;
   gboolean before = ARROW_IS_BEFORE (arrow);
   gboolean left = ARROW_IS_LEFT (arrow);
@@ -2402,7 +2414,7 @@ gtk_notebook_get_arrow (GtkNotebook *notebook,
                        gint         x,
                        gint         y)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GdkRectangle arrow_rect;
   GdkRectangle event_window_pos;
   gint i;
@@ -2440,7 +2452,7 @@ static void
 gtk_notebook_do_arrow (GtkNotebook     *notebook,
                       GtkNotebookArrow arrow)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkWidget *widget = GTK_WIDGET (notebook);
   gboolean is_rtl, left;
 
@@ -2463,7 +2475,7 @@ gtk_notebook_arrow_button_press (GtkNotebook      *notebook,
                                 GtkNotebookArrow  arrow,
                                 gint              button)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkWidget *widget = GTK_WIDGET (notebook);
   gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
   gboolean left = (ARROW_IS_LEFT (arrow) && !is_rtl) || 
@@ -2505,7 +2517,7 @@ get_widget_coordinates (GtkWidget *widget,
   if (!gdk_event_get_coords (event, &tx, &ty))
     return FALSE;
 
-  while (window && window != widget->window)
+  while (window && window != gtk_widget_get_window (widget))
     {
       gint window_x, window_y;
 
@@ -2527,52 +2539,10 @@ get_widget_coordinates (GtkWidget *widget,
     return FALSE;
 }
 
-static gboolean
-gtk_notebook_scroll (GtkWidget      *widget,
-                     GdkEventScroll *event)
-{
-  GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
-  GtkWidget *child, *event_widget;
-  gint i;
-
-  if (!priv->cur_page)
-    return FALSE;
-
-  child = priv->cur_page->child;
-  event_widget = gtk_get_event_widget ((GdkEvent *)event);
-
-  /* ignore scroll events from the content of the page */
-  if (!event_widget || gtk_widget_is_ancestor (event_widget, child) || event_widget == child)
-    return FALSE;
-
-  /* nor from the action area */
-  for (i = 0; i < 2; i++)
-    {
-      if (event_widget == priv->action_widget[i] ||
-          gtk_widget_is_ancestor (event_widget, priv->action_widget[i]))
-        return FALSE;
-    }
-
-  switch (event->direction)
-    {
-    case GDK_SCROLL_RIGHT:
-    case GDK_SCROLL_DOWN:
-      gtk_notebook_next_page (notebook);
-      break;
-    case GDK_SCROLL_LEFT:
-    case GDK_SCROLL_UP:
-      gtk_notebook_prev_page (notebook);
-      break;
-    }
-
-  return TRUE;
-}
-
 static GList*
 get_tab_at_pos (GtkNotebook *notebook, gint x, gint y)
 {
-   GtkNotebookPriv *priv = notebook->priv;
+   GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   GList *children;
 
@@ -2600,7 +2570,7 @@ gtk_notebook_button_press (GtkWidget      *widget,
                           GdkEventButton *event)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   GList *tab;
   GtkNotebookArrow arrow;
@@ -2671,7 +2641,8 @@ popup_position_func (GtkMenu  *menu,
                      gpointer  data)
 {
   GtkNotebook *notebook = data;
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
+  GtkAllocation allocation;
   GtkWidget *w;
   GtkRequisition requisition;
 
@@ -2687,15 +2658,18 @@ popup_position_func (GtkMenu  *menu,
      w = GTK_WIDGET (notebook);
    }
 
-  gdk_window_get_origin (w->window, x, y);
-  gtk_widget_size_request (GTK_WIDGET (menu), &requisition);
+  gdk_window_get_origin (gtk_widget_get_window (w), x, y);
+
+  gtk_widget_get_allocation (w, &allocation);
+  gtk_widget_get_preferred_size (GTK_WIDGET (menu),
+                                 &requisition, NULL);
 
   if (gtk_widget_get_direction (w) == GTK_TEXT_DIR_RTL)
-    *x += w->allocation.x + w->allocation.width - requisition.width;
+    *x += allocation.x + allocation.width - requisition.width;
   else
-    *x += w->allocation.x;
+    *x += allocation.x;
 
-  *y += w->allocation.y + w->allocation.height;
+  *y += allocation.y + allocation.height;
 
   *push_in = FALSE;
 }
@@ -2704,7 +2678,7 @@ static gboolean
 gtk_notebook_popup_menu (GtkWidget *widget)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   if (priv->menu)
     {
@@ -2721,7 +2695,7 @@ gtk_notebook_popup_menu (GtkWidget *widget)
 static void 
 stop_scrolling (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   if (priv->timer)
     {
@@ -2738,7 +2712,7 @@ static GList*
 get_drop_position (GtkNotebook *notebook,
                   guint        pack)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *children, *last_child;
   GtkNotebookPage *page;
   gboolean is_rtl;
@@ -2799,7 +2773,7 @@ get_drop_position (GtkNotebook *notebook,
 
 static void
 show_drag_window (GtkNotebook        *notebook,
-                 GtkNotebookPriv    *priv,
+                 GtkNotebookPrivate    *priv,
                  GtkNotebookPage    *page,
                   GdkDevice          *device)
 {
@@ -2817,9 +2791,8 @@ show_drag_window (GtkNotebook        *notebook,
       attributes.window_type = GDK_WINDOW_CHILD;
       attributes.wclass = GDK_INPUT_OUTPUT;
       attributes.visual = gtk_widget_get_visual (widget);
-      attributes.colormap = gtk_widget_get_colormap (widget);
       attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK;
-      attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+      attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
 
       priv->drag_window = gdk_window_new (gtk_widget_get_parent_window (widget),
                                          &attributes,
@@ -2847,13 +2820,13 @@ show_drag_window (GtkNotebook        *notebook,
  */
 static void
 hide_drag_window (GtkNotebook        *notebook,
-                 GtkNotebookPriv    *priv,
+                 GtkNotebookPrivate    *priv,
                  GtkNotebookPage    *page)
 {
   GtkWidget *widget = GTK_WIDGET (notebook);
-  GtkWidget *parent = page->tab_label->parent;
+  GtkWidget *parent = gtk_widget_get_parent (page->tab_label);
 
-  if (page->tab_label->window != widget->window ||
+  if (gtk_widget_get_window (page->tab_label) != gtk_widget_get_window (widget) ||
       !NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page))
     {
       g_object_ref (page->tab_label);
@@ -2878,7 +2851,7 @@ hide_drag_window (GtkNotebook        *notebook,
 static void
 gtk_notebook_stop_reorder (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
 
   if (priv->operation == DRAG_OPERATION_DETACH)
@@ -2930,7 +2903,7 @@ gtk_notebook_button_release (GtkWidget      *widget,
                             GdkEventButton *event)
 {
   GtkNotebook *notebook;
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
 
   if (event->type != GDK_BUTTON_RELEASE)
@@ -2960,7 +2933,7 @@ gtk_notebook_leave_notify (GtkWidget        *widget,
                           GdkEventCrossing *event)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   gint x, y;
 
   if (!get_widget_coordinates (widget, (GdkEvent *)event, &x, &y))
@@ -2978,7 +2951,7 @@ gtk_notebook_leave_notify (GtkWidget        *widget,
 static GtkNotebookPointerPosition
 get_pointer_position (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkWidget *widget = GTK_WIDGET (notebook);
   gint wx, wy, width, height;
   gboolean is_rtl;
@@ -2987,7 +2960,8 @@ get_pointer_position (GtkNotebook *notebook)
     return POINTER_BETWEEN;
 
   gdk_window_get_position (priv->event_window, &wx, &wy);
-  gdk_drawable_get_size (GDK_DRAWABLE (priv->event_window), &width, &height);
+  width = gdk_window_get_width (priv->event_window);
+  height = gdk_window_get_height (priv->event_window);
 
   if (priv->tab_pos == GTK_POS_TOP ||
       priv->tab_pos == GTK_POS_BOTTOM)
@@ -3022,7 +2996,7 @@ static gboolean
 scroll_notebook_timer (gpointer data)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (data);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPointerPosition pointer_position;
   GList *element, *first_tab;
 
@@ -3054,7 +3028,7 @@ check_threshold (GtkNotebook *notebook,
                 gint         current_x,
                 gint         current_y)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkWidget *widget;
   gint dnd_threshold;
   GdkRectangle rectangle = { 0, }; /* shut up gcc */
@@ -3068,7 +3042,8 @@ check_threshold (GtkNotebook *notebook,
   dnd_threshold *= DND_THRESHOLD_MULTIPLIER;
 
   gdk_window_get_position (priv->event_window, &rectangle.x, &rectangle.y);
-  gdk_drawable_get_size (GDK_DRAWABLE (priv->event_window), &rectangle.width, &rectangle.height);
+  rectangle.width = gdk_window_get_width (priv->event_window);
+  rectangle.height = gdk_window_get_height (priv->event_window);
 
   rectangle.x -= dnd_threshold;
   rectangle.width += 2 * dnd_threshold;
@@ -3086,7 +3061,7 @@ gtk_notebook_motion_notify (GtkWidget      *widget,
                            GdkEventMotion *event)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   GtkNotebookArrow arrow;
   GtkNotebookPointerPosition pointer_position;
@@ -3115,7 +3090,7 @@ gtk_notebook_motion_notify (GtkWidget      *widget,
    * (priv->drag_window has a pointer grab), but we need coordinates relative to
    * the notebook widget.
    */
-  gdk_window_get_origin (widget->window, &x_win, &y_win);
+  gdk_window_get_origin (gtk_widget_get_window (widget), &x_win, &y_win);
   priv->mouse_x = event->x_root - x_win;
   priv->mouse_y = event->y_root - y_win;
 
@@ -3233,46 +3208,12 @@ gtk_notebook_focus_out (GtkWidget     *widget,
   return FALSE;
 }
 
-static void
-gtk_notebook_draw_focus (GtkWidget      *widget,
-                        GdkEventExpose *event)
-{
-  GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
-
-  if (gtk_widget_has_focus (widget) && gtk_widget_is_drawable (widget) &&
-      priv->show_tabs && priv->cur_page &&
-      priv->cur_page->tab_label->window == event->window)
-    {
-      GtkNotebookPage *page;
-
-      page = priv->cur_page;
-
-      if (gtk_widget_intersect (page->tab_label, &event->area, NULL))
-        {
-          GdkRectangle area;
-          gint focus_width;
-
-          gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
-
-          area.x = page->tab_label->allocation.x - focus_width;
-          area.y = page->tab_label->allocation.y - focus_width;
-          area.width = page->tab_label->allocation.width + 2 * focus_width;
-          area.height = page->tab_label->allocation.height + 2 * focus_width;
-
-         gtk_paint_focus (widget->style, event->window, 
-                           gtk_widget_get_state (widget), NULL, widget, "tab",
-                          area.x, area.y, area.width, area.height);
-        }
-    }
-}
-
 static void
 gtk_notebook_style_set  (GtkWidget *widget,
                         GtkStyle  *previous)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   gboolean has_before_previous;
   gboolean has_before_next;
@@ -3295,28 +3236,30 @@ gtk_notebook_style_set  (GtkWidget *widget,
 }
 
 static gboolean
-on_drag_icon_expose (GtkWidget      *widget,
-                    GdkEventExpose *event,
-                    gpointer        data)
+on_drag_icon_draw (GtkWidget *widget,
+                  cairo_t   *cr,
+                  gpointer   data)
 {
-  GtkWidget *notebook, *child = GTK_WIDGET (data);
+  GtkWidget *notebook, *child;
   GtkRequisition requisition;
   gint gap_pos;
 
   notebook = GTK_WIDGET (data);
-  child = GTK_BIN (widget)->child;
-  gtk_widget_size_request (widget, &requisition);
+  child = gtk_bin_get_child (GTK_BIN (widget));
+
+  gtk_widget_get_preferred_size (widget,
+                                 &requisition, NULL);
   gap_pos = get_tab_gap_pos (GTK_NOTEBOOK (notebook));
 
   gtk_paint_extension (gtk_widget_get_style (notebook),
-                       gtk_widget_get_window (widget),
+                       cr,
                       GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                      NULL, widget, "tab",
+                      widget, "tab",
                       0, 0,
                       requisition.width, requisition.height,
                       gap_pos);
   if (child)
-    gtk_container_propagate_expose (GTK_CONTAINER (widget), child, event);
+    gtk_container_propagate_draw (GTK_CONTAINER (widget), child, cr);
 
   return TRUE;
 }
@@ -3326,7 +3269,7 @@ gtk_notebook_drag_begin (GtkWidget        *widget,
                         GdkDragContext   *context)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkWidget *tab_label;
 
   if (priv->dnd_timer)
@@ -3353,8 +3296,8 @@ gtk_notebook_drag_begin (GtkWidget        *widget,
                               priv->detached_tab->allocation.height);
   g_object_unref (tab_label);
 
-  g_signal_connect (G_OBJECT (priv->dnd_window), "expose-event",
-                   G_CALLBACK (on_drag_icon_expose), notebook);
+  g_signal_connect (G_OBJECT (priv->dnd_window), "draw",
+                   G_CALLBACK (on_drag_icon_draw), notebook);
 
   gtk_drag_set_icon_widget (context, priv->dnd_window, -2, -2);
 }
@@ -3364,14 +3307,14 @@ gtk_notebook_drag_end (GtkWidget      *widget,
                       GdkDragContext *context)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   gtk_notebook_stop_reorder (notebook);
 
   if (priv->detached_tab)
     gtk_notebook_switch_page (notebook, priv->detached_tab);
 
-  GTK_BIN (priv->dnd_window)->child = NULL;
+  _gtk_bin_set_child (GTK_BIN (priv->dnd_window), NULL);
   gtk_widget_destroy (priv->dnd_window);
   priv->dnd_window = NULL;
 
@@ -3384,9 +3327,6 @@ gtk_notebook_create_window (GtkNotebook *notebook,
                             gint         x,
                             gint         y)
 {
-  if (window_creation_hook)
-    return (* window_creation_hook) (notebook, page, x, y, window_creation_hook_data);
-
   return NULL;
 }
 
@@ -3399,7 +3339,7 @@ gtk_notebook_drag_failed (GtkWidget      *widget,
   if (result == GTK_DRAG_RESULT_NO_TARGET)
     {
       GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-      GtkNotebookPriv *priv = notebook->priv;
+      GtkNotebookPrivate *priv = notebook->priv;
       GtkNotebook *dest_notebook = NULL;
       GdkDisplay *display;
       gint x, y;
@@ -3423,7 +3363,7 @@ static gboolean
 gtk_notebook_switch_tab_timeout (gpointer data)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (data);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *tab;
   gint x, y;
 
@@ -3451,16 +3391,19 @@ gtk_notebook_drag_motion (GtkWidget      *widget,
                          guint           time)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
+  GtkAllocation allocation;
   GdkRectangle position;
   GtkSettings *settings;
   GtkNotebookArrow arrow;
   guint timeout;
   GdkAtom target, tab_target;
 
+  gtk_widget_get_allocation (widget, &allocation);
+
   arrow = gtk_notebook_get_arrow (notebook,
-                                 x + widget->allocation.x,
-                                 y + widget->allocation.y);
+                                  x + allocation.x,
+                                  y + allocation.y);
   if (arrow)
     {
       priv->click_child = arrow;
@@ -3475,19 +3418,19 @@ gtk_notebook_drag_motion (GtkWidget      *widget,
 
   if (target == tab_target)
     {
-      gpointer widget_group, source_widget_group;
-      GtkWidget *source_widget;
+      GQuark group, source_group;
+      GtkNotebook *source;
+      GtkWidget *source_child;
 
-      source_widget = gtk_drag_get_source_widget (context);
-      g_assert (source_widget);
+      source = GTK_NOTEBOOK (gtk_drag_get_source_widget (context));
+      source_child = source->priv->cur_page->child;
 
-      widget_group = gtk_notebook_get_group (notebook);
-      source_widget_group = gtk_notebook_get_group (GTK_NOTEBOOK (source_widget));
+      group = notebook->priv->group;
+      source_group = source->priv->group;
 
-      if (widget_group && source_widget_group &&
-         widget_group == source_widget_group &&
-         !(widget == GTK_NOTEBOOK (source_widget)->priv->cur_page->child ||
-           gtk_widget_is_ancestor (widget, GTK_NOTEBOOK (source_widget)->priv->cur_page->child)))
+      if (group != 0 && group == source_group &&
+         !(widget == source_child ||
+            gtk_widget_is_ancestor (widget, source_child)))
        {
          gdk_drag_status (context, GDK_ACTION_MOVE, time);
          return TRUE;
@@ -3500,8 +3443,8 @@ gtk_notebook_drag_motion (GtkWidget      *widget,
        }
     }
 
-  x += widget->allocation.x;
-  y += widget->allocation.y;
+  x += allocation.x;
+  y += allocation.y;
 
   if (gtk_notebook_get_event_window_position (notebook, &position) &&
       x >= position.x && x <= position.x + position.width &&
@@ -3538,7 +3481,7 @@ gtk_notebook_drag_leave (GtkWidget      *widget,
                         guint           time)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   if (priv->switch_tab_timer)
     {
@@ -3577,7 +3520,8 @@ do_detach_tab (GtkNotebook     *from,
               gint             x,
               gint             y)
 {
-  GtkNotebookPriv *to_priv = to->priv;
+  GtkNotebookPrivate *to_priv = to->priv;
+  GtkAllocation to_allocation;
   GtkWidget *tab_label, *menu_label;
   gboolean tab_expand, tab_fill, reorderable, detachable;
   GList *element;
@@ -3607,8 +3551,9 @@ do_detach_tab (GtkNotebook     *from,
 
   gtk_container_remove (GTK_CONTAINER (from), child);
 
-  to_priv->mouse_x = x + GTK_WIDGET (to)->allocation.x;
-  to_priv->mouse_y = y + GTK_WIDGET (to)->allocation.y;
+  gtk_widget_get_allocation (GTK_WIDGET (to), &to_allocation);
+  to_priv->mouse_x = x + to_allocation.x;
+  to_priv->mouse_y = y + to_allocation.y;
 
   element = get_drop_position (to, tab_pack);
   page_num = g_list_position (to_priv->children, element);
@@ -3643,7 +3588,7 @@ gtk_notebook_drag_data_get (GtkWidget        *widget,
   if (data->target == gdk_atom_intern_static_string ("GTK_NOTEBOOK_TAB"))
     {
       GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-      GtkNotebookPriv *priv = notebook->priv;
+      GtkNotebookPrivate *priv = notebook->priv;
 
       gtk_selection_data_set (data,
                              data->target,
@@ -3768,7 +3713,7 @@ gtk_notebook_get_child_property (GtkContainer    *container,
                                 GParamSpec      *pspec)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (container);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *list;
   GtkWidget *label;
   gboolean expand;
@@ -3847,7 +3792,7 @@ gtk_notebook_remove (GtkContainer *container,
                     GtkWidget    *widget)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (container);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   GList *children;
   gint page_num = 0;
@@ -3883,7 +3828,7 @@ gtk_notebook_remove (GtkContainer *container,
 static gboolean
 focus_tabs_in (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   if (priv->show_tabs && priv->cur_page)
     {
@@ -3904,7 +3849,7 @@ focus_tabs_move (GtkNotebook     *notebook,
                 GtkDirectionType direction,
                 gint             search_direction)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *new_page;
 
   new_page = gtk_notebook_search_page (notebook, priv->focus_tab,
@@ -3934,7 +3879,7 @@ static gboolean
 focus_child_in (GtkNotebook      *notebook,
                GtkDirectionType  direction)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   if (priv->cur_page)
     return gtk_widget_child_focus (priv->cur_page->child, direction);
@@ -3947,7 +3892,7 @@ focus_action_in (GtkNotebook      *notebook,
                  gint              action,
                  GtkDirectionType  direction)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   if (priv->action_widget[action] &&
       gtk_widget_get_visible (priv->action_widget[action]))
@@ -3964,7 +3909,7 @@ gtk_notebook_focus (GtkWidget        *widget,
                    GtkDirectionType  direction)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkWidget *old_focus_child;
   GtkDirectionType effective_direction;
   gint first_action;
@@ -4138,7 +4083,7 @@ gtk_notebook_set_focus_child (GtkContainer *container,
                              GtkWidget    *child)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (container);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkWidget *page_child;
   GtkWidget *toplevel;
 
@@ -4150,10 +4095,10 @@ gtk_notebook_set_focus_child (GtkContainer *container,
   toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
   if (toplevel && gtk_widget_is_toplevel (toplevel))
     {
-      page_child = GTK_WINDOW (toplevel)->focus_widget; 
+      page_child = gtk_window_get_focus (GTK_WINDOW (toplevel));
       while (page_child)
        {
-         if (page_child->parent == GTK_WIDGET (container))
+          if (gtk_widget_get_parent (page_child) == GTK_WIDGET (container))
            {
              GList *list = gtk_notebook_find_child (notebook, page_child, NULL);
              if (list != NULL) 
@@ -4162,15 +4107,15 @@ gtk_notebook_set_focus_child (GtkContainer *container,
              
                  if (page->last_focus_child)
                    g_object_remove_weak_pointer (G_OBJECT (page->last_focus_child), (gpointer *)&page->last_focus_child);
-                 
-                 page->last_focus_child = GTK_WINDOW (toplevel)->focus_widget;
+
+                 page->last_focus_child = gtk_window_get_focus (GTK_WINDOW (toplevel));
                  g_object_add_weak_pointer (G_OBJECT (page->last_focus_child), (gpointer *)&page->last_focus_child);
              
                  break;
                }
            }
 
-         page_child = page_child->parent;
+          page_child = gtk_widget_get_parent (page_child);
        }
     }
   
@@ -4207,7 +4152,7 @@ gtk_notebook_forall (GtkContainer *container,
                     gpointer      callback_data)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (container);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *children;
   gint i;
 
@@ -4252,7 +4197,7 @@ page_visible_cb (GtkWidget  *page,
                  gpointer    data)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (data);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *list;
   GList *next = NULL;
 
@@ -4280,7 +4225,7 @@ gtk_notebook_real_insert_page (GtkNotebook *notebook,
                               GtkWidget   *menu_label,
                               gint         position)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   gint nchildren;
 
@@ -4390,9 +4335,11 @@ gtk_notebook_real_insert_page (GtkNotebook *notebook,
 static void
 gtk_notebook_redraw_tabs (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
+  GtkAllocation allocation;
   GtkWidget *widget;
   GtkNotebookPage *page;
+  GtkStyle *style;
   GdkRectangle redraw_rect;
   gint border;
   gint tab_pos = get_effective_tab_pos (notebook);
@@ -4408,48 +4355,52 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
   redraw_rect.x = border;
   redraw_rect.y = border;
 
+  style = gtk_widget_get_style (widget);
+  gtk_widget_get_allocation (widget, &allocation);
+
   switch (tab_pos)
     {
     case GTK_POS_BOTTOM:
-      redraw_rect.y = widget->allocation.height - border -
-       page->allocation.height - widget->style->ythickness;
+      redraw_rect.y = allocation.height - border -
+       page->allocation.height - style->ythickness;
 
       if (page != priv->cur_page)
-       redraw_rect.y -= widget->style->ythickness;
+       redraw_rect.y -= style->ythickness;
       /* fall through */
     case GTK_POS_TOP:
-      redraw_rect.width = widget->allocation.width - 2 * border;
-      redraw_rect.height = page->allocation.height + widget->style->ythickness;
+      redraw_rect.width = allocation.width - 2 * border;
+      redraw_rect.height = page->allocation.height + style->ythickness;
 
       if (page != priv->cur_page)
-       redraw_rect.height += widget->style->ythickness;
+       redraw_rect.height += style->ythickness;
       break;
     case GTK_POS_RIGHT:
-      redraw_rect.x = widget->allocation.width - border -
-       page->allocation.width - widget->style->xthickness;
+      redraw_rect.x = allocation.width - border -
+       page->allocation.width - style->xthickness;
 
       if (page != priv->cur_page)
-       redraw_rect.x -= widget->style->xthickness;
+       redraw_rect.x -= style->xthickness;
       /* fall through */
     case GTK_POS_LEFT:
-      redraw_rect.width = page->allocation.width + widget->style->xthickness;
-      redraw_rect.height = widget->allocation.height - 2 * border;
+      redraw_rect.width = page->allocation.width + style->xthickness;
+      redraw_rect.height = allocation.height - 2 * border;
 
       if (page != priv->cur_page)
-       redraw_rect.width += widget->style->xthickness;
+       redraw_rect.width += style->xthickness;
       break;
     }
 
-  redraw_rect.x += widget->allocation.x;
-  redraw_rect.y += widget->allocation.y;
+  redraw_rect.x += allocation.x;
+  redraw_rect.y += allocation.y;
 
-  gdk_window_invalidate_rect (widget->window, &redraw_rect, TRUE);
+  gdk_window_invalidate_rect (gtk_widget_get_window (widget),
+                              &redraw_rect, TRUE);
 }
 
 static void
 gtk_notebook_redraw_arrows (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   if (gtk_widget_get_mapped (GTK_WIDGET (notebook)) &&
       gtk_notebook_show_arrows (notebook))
@@ -4469,7 +4420,7 @@ gtk_notebook_redraw_arrows (GtkNotebook *notebook)
            continue;
 
          gtk_notebook_get_arrow_rect (notebook, &rect, arrow[i]);
-         gdk_window_invalidate_rect (GTK_WIDGET (notebook)->window, 
+          gdk_window_invalidate_rect (gtk_widget_get_window (GTK_WIDGET (notebook)),
                                      &rect, FALSE);
        }
     }
@@ -4478,7 +4429,7 @@ gtk_notebook_redraw_arrows (GtkNotebook *notebook)
 static gboolean
 gtk_notebook_timer (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   gboolean retval = FALSE;
 
   if (priv->timer)
@@ -4508,7 +4459,7 @@ gtk_notebook_timer (GtkNotebook *notebook)
 static void
 gtk_notebook_set_scroll_timer (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkWidget *widget = GTK_WIDGET (notebook);
 
   if (!priv->timer)
@@ -4537,7 +4488,7 @@ gtk_notebook_find_child (GtkNotebook *notebook,
                         GtkWidget   *child,
                         const gchar *function)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *list = g_list_find_custom (priv->children, child,
                                    gtk_notebook_page_compare);
 
@@ -4571,15 +4522,14 @@ static void
 gtk_notebook_real_remove (GtkNotebook *notebook,
                          GList       *list)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   GList * next_list;
   gint need_resize = FALSE;
   GtkWidget *tab_label;
-
   gboolean destroying;
 
-  destroying = GTK_OBJECT_FLAGS (notebook) & GTK_IN_DESTRUCTION;
+  destroying = gtk_widget_in_destruction (notebook);
 
   next_list = gtk_notebook_search_page (notebook, list, STEP_NEXT, TRUE);
   if (!next_list)
@@ -4624,7 +4574,7 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
 
   if (priv->menu)
     {
-      GtkWidget *parent = page->menu_label->parent;
+      GtkWidget *parent = gtk_widget_get_parent (page->menu_label);
 
       gtk_notebook_menu_label_unparent (parent, NULL);
       gtk_container_remove (GTK_CONTAINER (priv->menu), parent);
@@ -4652,7 +4602,7 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
 static void
 gtk_notebook_update_labels (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   GList *list;
   gchar string[32];
@@ -4703,7 +4653,7 @@ static gint
 gtk_notebook_real_page_position (GtkNotebook *notebook,
                                 GList       *list)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *work;
   gint count_start;
 
@@ -4727,7 +4677,7 @@ gtk_notebook_search_page (GtkNotebook *notebook,
                          gint         direction,
                          gboolean     find_visible)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page = NULL;
   GList *old_list = NULL;
   gint flag = 0;
@@ -4796,11 +4746,12 @@ gtk_notebook_search_page (GtkNotebook *notebook,
  */
 static void
 gtk_notebook_paint (GtkWidget    *widget,
-                   GdkRectangle *area)
+                   cairo_t      *cr)
 {
   GtkNotebook *notebook;
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
+  GtkAllocation allocation;
   GList *children;
   gboolean showarrow;
   gint width, height;
@@ -4810,9 +4761,6 @@ gtk_notebook_paint (GtkWidget    *widget,
   gboolean is_rtl;
   gint tab_pos;
    
-  if (!gtk_widget_is_drawable (widget))
-    return;
-
   notebook = GTK_NOTEBOOK (widget);
   priv = notebook->priv;
   is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
@@ -4822,16 +4770,18 @@ gtk_notebook_paint (GtkWidget    *widget,
       !priv->cur_page || !gtk_widget_get_visible (priv->cur_page->child))
     return;
 
-  x = widget->allocation.x + border_width;
-  y = widget->allocation.y + border_width;
-  width = widget->allocation.width - border_width * 2;
-  height = widget->allocation.height - border_width * 2;
+  gtk_widget_get_allocation (widget, &allocation);
+
+  x = allocation.x + border_width;
+  y = allocation.y + border_width;
+  width = allocation.width - border_width * 2;
+  height = allocation.height - border_width * 2;
 
   if (priv->show_border && (!priv->show_tabs || !priv->children))
     {
-      gtk_paint_box (widget->style, widget->window,
+      gtk_paint_box (gtk_widget_get_style (widget), cr,
                     GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                    area, widget, "notebook",
+                    widget, "notebook",
                     x, y, width, height);
       return;
     }
@@ -4873,9 +4823,9 @@ gtk_notebook_paint (GtkWidget    *widget,
        case GTK_POS_TOP:
        case GTK_POS_BOTTOM:
          if (priv->operation == DRAG_OPERATION_REORDER)
-           gap_x = priv->drag_window_x - widget->allocation.x - border_width;
+           gap_x = priv->drag_window_x - allocation.x - border_width;
          else
-           gap_x = priv->cur_page->allocation.x - widget->allocation.x - border_width;
+           gap_x = priv->cur_page->allocation.x - allocation.x - border_width;
 
          gap_width = priv->cur_page->allocation.width;
          step = is_rtl ? STEP_NEXT : STEP_PREV;
@@ -4883,18 +4833,18 @@ gtk_notebook_paint (GtkWidget    *widget,
        case GTK_POS_LEFT:
        case GTK_POS_RIGHT:
          if (priv->operation == DRAG_OPERATION_REORDER)
-           gap_x = priv->drag_window_y - border_width - widget->allocation.y;
+           gap_x = priv->drag_window_y - border_width - allocation.y;
          else
-           gap_x = priv->cur_page->allocation.y - widget->allocation.y - border_width;
+           gap_x = priv->cur_page->allocation.y - allocation.y - border_width;
 
          gap_width = priv->cur_page->allocation.height;
          step = STEP_PREV;
          break;
        }
     }
-  gtk_paint_box_gap (widget->style, widget->window,
+  gtk_paint_box_gap (gtk_widget_get_style (widget), cr,
                     GTK_STATE_NORMAL, GTK_SHADOW_OUT,
-                    area, widget, "notebook",
+                    widget, "notebook",
                     x, y, width, height,
                     tab_pos, gap_x, gap_width);
 
@@ -4910,34 +4860,32 @@ gtk_notebook_paint (GtkWidget    *widget,
       if (!gtk_widget_get_mapped (page->tab_label))
        showarrow = TRUE;
       else if (page != priv->cur_page)
-       gtk_notebook_draw_tab (notebook, page, area);
+       gtk_notebook_draw_tab (notebook, page, cr);
     }
 
   if (showarrow && priv->scrollable)
     {
       if (priv->has_before_previous)
-       gtk_notebook_draw_arrow (notebook, ARROW_LEFT_BEFORE);
+       gtk_notebook_draw_arrow (notebook, cr, ARROW_LEFT_BEFORE);
       if (priv->has_before_next)
-       gtk_notebook_draw_arrow (notebook, ARROW_RIGHT_BEFORE);
+       gtk_notebook_draw_arrow (notebook, cr, ARROW_RIGHT_BEFORE);
       if (priv->has_after_previous)
-       gtk_notebook_draw_arrow (notebook, ARROW_LEFT_AFTER);
+       gtk_notebook_draw_arrow (notebook, cr, ARROW_LEFT_AFTER);
       if (priv->has_after_next)
-       gtk_notebook_draw_arrow (notebook, ARROW_RIGHT_AFTER);
+       gtk_notebook_draw_arrow (notebook, cr, ARROW_RIGHT_AFTER);
     }
-  gtk_notebook_draw_tab (notebook, priv->cur_page, area);
+
+  if (priv->operation != DRAG_OPERATION_REORDER)
+    gtk_notebook_draw_tab (notebook, priv->cur_page, cr);
 }
 
 static void
 gtk_notebook_draw_tab (GtkNotebook     *notebook,
                       GtkNotebookPage *page,
-                      GdkRectangle    *area)
+                      cairo_t         *cr)
 {
-  GtkNotebookPriv *priv;
-  GdkRectangle child_area;
-  GdkRectangle page_area;
+  GtkNotebookPrivate *priv;
   GtkStateType state_type;
-  GtkPositionType gap_side;
-  GdkWindow *window;
   GtkWidget *widget;
   
   if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) ||
@@ -4948,105 +4896,107 @@ gtk_notebook_draw_tab (GtkNotebook     *notebook,
   widget = GTK_WIDGET (notebook);
   priv = notebook->priv;
 
-  if (priv->operation == DRAG_OPERATION_REORDER && page == priv->cur_page)
-    window = priv->drag_window;
-  else
-    window = widget->window;
+  if (priv->cur_page == page)
+    state_type = GTK_STATE_NORMAL;
+  else 
+    state_type = GTK_STATE_ACTIVE;
 
-  page_area.x = page->allocation.x;
-  page_area.y = page->allocation.y;
-  page_area.width = page->allocation.width;
-  page_area.height = page->allocation.height;
+  gtk_paint_extension (gtk_widget_get_style (widget), cr,
+                       state_type, GTK_SHADOW_OUT,
+                       widget, "tab",
+                       page->allocation.x,
+                       page->allocation.y,
+                       page->allocation.width,
+                       page->allocation.height,
+                       get_tab_gap_pos (notebook));
 
-  if (gdk_rectangle_intersect (&page_area, area, &child_area))
+  if (gtk_widget_has_focus (widget) &&
+      priv->cur_page == page)
     {
-      gap_side = get_tab_gap_pos (notebook);
+      gint focus_width;
+      GtkAllocation allocation;
 
-      if (priv->cur_page == page)
-       state_type = GTK_STATE_NORMAL;
-      else 
-       state_type = GTK_STATE_ACTIVE;
+      gtk_widget_get_allocation (page->tab_label, &allocation);
+      gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL);
 
-      gtk_paint_extension (widget->style, window,
-                          state_type, GTK_SHADOW_OUT,
-                          area, widget, "tab",
-                          page_area.x, page_area.y,
-                          page_area.width, page_area.height,
-                          gap_side);
+      gtk_paint_focus (gtk_widget_get_style (widget), cr,
+                       gtk_widget_get_state (widget), widget, "tab",
+                       allocation.x - focus_width,
+                       allocation.y - focus_width,
+                       allocation.width + 2 * focus_width,
+                       allocation.height + 2 * focus_width);
     }
 }
 
 static void
 gtk_notebook_draw_arrow (GtkNotebook      *notebook,
+                         cairo_t          *cr,
                         GtkNotebookArrow  nbarrow)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkStateType state_type;
   GtkShadowType shadow_type;
   GtkWidget *widget;
   GdkRectangle arrow_rect;
   GtkArrowType arrow;
   gboolean is_rtl, left;
+  gint scroll_arrow_hlength;
+  gint scroll_arrow_vlength;
+  gint arrow_size;
 
   widget = GTK_WIDGET (notebook);
 
-  if (gtk_widget_is_drawable (widget))
-    {
-      gint scroll_arrow_hlength;
-      gint scroll_arrow_vlength;
-      gint arrow_size;
+  gtk_notebook_get_arrow_rect (notebook, &arrow_rect, nbarrow);
 
-      gtk_notebook_get_arrow_rect (notebook, &arrow_rect, nbarrow);
-
-      is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
-      left = (ARROW_IS_LEFT (nbarrow) && !is_rtl) ||
-             (!ARROW_IS_LEFT (nbarrow) && is_rtl); 
-
-      gtk_widget_style_get (widget,
-                            "scroll-arrow-hlength", &scroll_arrow_hlength,
-                            "scroll-arrow-vlength", &scroll_arrow_vlength,
-                            NULL);
+  is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
+  left = (ARROW_IS_LEFT (nbarrow) && !is_rtl) ||
+         (!ARROW_IS_LEFT (nbarrow) && is_rtl); 
 
-      if (priv->in_child == nbarrow)
-        {
-          if (priv->click_child == nbarrow)
-            state_type = GTK_STATE_ACTIVE;
-          else
-            state_type = GTK_STATE_PRELIGHT;
-        }
-      else
-        state_type = gtk_widget_get_state (widget);
+  gtk_widget_style_get (widget,
+                        "scroll-arrow-hlength", &scroll_arrow_hlength,
+                        "scroll-arrow-vlength", &scroll_arrow_vlength,
+                        NULL);
 
+  if (priv->in_child == nbarrow)
+    {
       if (priv->click_child == nbarrow)
-        shadow_type = GTK_SHADOW_IN;
+        state_type = GTK_STATE_ACTIVE;
       else
-        shadow_type = GTK_SHADOW_OUT;
+        state_type = GTK_STATE_PRELIGHT;
+    }
+  else
+    state_type = gtk_widget_get_state (widget);
 
-      if (priv->focus_tab &&
-         !gtk_notebook_search_page (notebook, priv->focus_tab,
-                                    left ? STEP_PREV : STEP_NEXT, TRUE))
-       {
-         shadow_type = GTK_SHADOW_ETCHED_IN;
-         state_type = GTK_STATE_INSENSITIVE;
-       }
-      
-      if (priv->tab_pos == GTK_POS_LEFT ||
-         priv->tab_pos == GTK_POS_RIGHT)
-        {
-          arrow = (ARROW_IS_LEFT (nbarrow) ? GTK_ARROW_UP : GTK_ARROW_DOWN);
-          arrow_size = scroll_arrow_vlength;
-        }
-      else
-        {
-          arrow = (ARROW_IS_LEFT (nbarrow) ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT);
-          arrow_size = scroll_arrow_hlength;
-        }
-     
-      gtk_paint_arrow (widget->style, widget->window, state_type, 
-                      shadow_type, NULL, widget, "notebook",
-                      arrow, TRUE, arrow_rect.x, arrow_rect.y, 
-                      arrow_size, arrow_size);
+  if (priv->click_child == nbarrow)
+    shadow_type = GTK_SHADOW_IN;
+  else
+    shadow_type = GTK_SHADOW_OUT;
+
+  if (priv->focus_tab &&
+      !gtk_notebook_search_page (notebook, priv->focus_tab,
+                                 left ? STEP_PREV : STEP_NEXT, TRUE))
+    {
+      shadow_type = GTK_SHADOW_ETCHED_IN;
+      state_type = GTK_STATE_INSENSITIVE;
+    }
+  
+  if (priv->tab_pos == GTK_POS_LEFT ||
+      priv->tab_pos == GTK_POS_RIGHT)
+    {
+      arrow = (ARROW_IS_LEFT (nbarrow) ? GTK_ARROW_UP : GTK_ARROW_DOWN);
+      arrow_size = scroll_arrow_vlength;
+    }
+  else
+    {
+      arrow = (ARROW_IS_LEFT (nbarrow) ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT);
+      arrow_size = scroll_arrow_hlength;
     }
+  gtk_paint_arrow (gtk_widget_get_style (widget),
+                   cr, state_type, 
+                   shadow_type, widget, "notebook",
+                   arrow, TRUE, arrow_rect.x, arrow_rect.y, 
+                   arrow_size, arrow_size);
 }
 
 /* Private GtkNotebook Size Allocate Functions:
@@ -5065,8 +5015,10 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
                        gint        *max,
                        gint        *tab_space)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
+  GtkAllocation allocation, action_allocation;
   GtkWidget *widget;
+  GtkStyle *style;
   GList *children;
   gint tab_pos = get_effective_tab_pos (notebook);
   gint tab_overlap;
@@ -5081,6 +5033,8 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
   children = priv->children;
   is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
 
+  style = gtk_widget_get_style (widget);
+
   gtk_widget_style_get (GTK_WIDGET (notebook),
                         "arrow-spacing", &arrow_spacing,
                         "scroll-arrow-hlength", &scroll_arrow_hlength,
@@ -5089,22 +5043,26 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
 
   border_width = gtk_container_get_border_width (GTK_CONTAINER (notebook));
 
+  gtk_widget_get_allocation (widget, &allocation);
+
   switch (tab_pos)
     {
     case GTK_POS_TOP:
     case GTK_POS_BOTTOM:
-      *min = widget->allocation.x + border_width;
-      *max = widget->allocation.x + widget->allocation.width - border_width;
+      *min = allocation.x + border_width;
+      *max = allocation.x + allocation.width - border_width;
 
       for (i = 0; i < N_ACTION_WIDGETS; i++)
         {
           if (priv->action_widget[i])
             {
+              gtk_widget_get_allocation (priv->action_widget[i], &action_allocation);
+
               if ((i == ACTION_WIDGET_START && !is_rtl) ||
                   (i == ACTION_WIDGET_END && is_rtl))
-                *min += priv->action_widget[i]->allocation.width + widget->style->xthickness;
+                *min += action_allocation.width + style->xthickness;
               else
-                *max -= priv->action_widget[i]->allocation.width + widget->style->xthickness;
+                *max -= action_allocation.width + style->xthickness;
             }
         }
 
@@ -5122,17 +5080,19 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
       break;
     case GTK_POS_RIGHT:
     case GTK_POS_LEFT:
-      *min = widget->allocation.y + border_width;
-      *max = widget->allocation.y + widget->allocation.height - border_width;
+      *min = allocation.y + border_width;
+      *max = allocation.y + allocation.height - border_width;
 
       for (i = 0; i < N_ACTION_WIDGETS; i++)
         {
           if (priv->action_widget[i])
             {
+              gtk_widget_get_allocation (priv->action_widget[i], &action_allocation);
+
               if (i == ACTION_WIDGET_START)
-                *min += priv->action_widget[i]->allocation.height + widget->style->ythickness;
+                *min += action_allocation.height + style->ythickness;
               else
-                *max -= priv->action_widget[i]->allocation.height + widget->style->ythickness;
+                *max -= action_allocation.height + style->ythickness;
             }
         }
 
@@ -5228,7 +5188,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
                                   gint        *n,
                                   gint        *remaining_space)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkWidget *widget;
   GtkContainer *container;
   GList *children;
@@ -5457,10 +5417,12 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
                                        gint          min,
                                        gint          max)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
+  GtkAllocation allocation;
   GtkWidget *widget;
   GtkContainer *container;
   GtkNotebookPage *page;
+  GtkStyle *style;
   gboolean allocate_at_bottom;
   gint tab_overlap, tab_pos, tab_extra_space;
   gint left_x, right_x, top_y, bottom_y, anchor;
@@ -5476,17 +5438,20 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
   allocate_at_bottom = get_allocate_at_bottom (widget, direction);
   anchor = 0;
 
+  gtk_widget_get_allocation (widget, &allocation);
+
   border_width = gtk_container_get_border_width (container);
-  child_allocation.x = widget->allocation.x + border_width;
-  child_allocation.y = widget->allocation.y + border_width;
+  child_allocation.x = allocation.x + border_width;
+  child_allocation.y = allocation.y + border_width;
 
-  xthickness = widget->style->xthickness;
-  ythickness = widget->style->ythickness;
+  style = gtk_widget_get_style (widget);
+  xthickness = style->xthickness;
+  ythickness = style->ythickness;
 
   switch (tab_pos)
     {
     case GTK_POS_BOTTOM:
-      child_allocation.y = widget->allocation.y + widget->allocation.height -
+      child_allocation.y = allocation.y + allocation.height -
        priv->cur_page->requisition.height - border_width;
       /* fall through */
     case GTK_POS_TOP:
@@ -5496,7 +5461,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
       break;
       
     case GTK_POS_RIGHT:
-      child_allocation.x = widget->allocation.x + widget->allocation.width -
+      child_allocation.x = allocation.x + allocation.width -
        priv->cur_page->requisition.width - border_width;
       /* fall through */
     case GTK_POS_LEFT:
@@ -5778,7 +5743,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
 static void
 gtk_notebook_pages_allocate (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *children = NULL;
   GList *last_child = NULL;
   gboolean showarrow = FALSE;
@@ -5832,9 +5797,10 @@ gtk_notebook_page_allocate (GtkNotebook     *notebook,
                            GtkNotebookPage *page)
 {
   GtkWidget *widget = GTK_WIDGET (notebook);
-  GtkNotebookPriv *priv = notebook->priv;
-  GtkAllocation child_allocation;
+  GtkNotebookPrivate *priv = notebook->priv;
+  GtkAllocation child_allocation, label_allocation;
   GtkRequisition tab_requisition;
+  GtkStyle *style;
   gint xthickness;
   gint ythickness;
   gint padding;
@@ -5852,10 +5818,11 @@ gtk_notebook_page_allocate (GtkNotebook     *notebook,
       return was_visible;
     }
 
-  xthickness = widget->style->xthickness;
-  ythickness = widget->style->ythickness;
+  style = gtk_widget_get_style (widget);
+  xthickness = style->xthickness;
+  ythickness = style->ythickness;
 
-  gtk_widget_get_child_requisition (page->tab_label, &tab_requisition);
+  gtk_widget_get_preferred_size (page->tab_label, &tab_requisition, NULL);
   gtk_widget_style_get (widget,
                        "focus-line-width", &focus_width,
                        "tab-curvature", &tab_curvature,
@@ -5915,10 +5882,11 @@ gtk_notebook_page_allocate (GtkNotebook     *notebook,
       break;
     }
 
-  tab_allocation_changed = (child_allocation.x != page->tab_label->allocation.x ||
-                           child_allocation.y != page->tab_label->allocation.y ||
-                           child_allocation.width != page->tab_label->allocation.width ||
-                           child_allocation.height != page->tab_label->allocation.height);
+  gtk_widget_get_allocation (page->tab_label, &label_allocation);
+  tab_allocation_changed = (child_allocation.x != label_allocation.x ||
+                           child_allocation.y != label_allocation.y ||
+                           child_allocation.width != label_allocation.width ||
+                           child_allocation.height != label_allocation.height);
 
   gtk_widget_size_allocate (page->tab_label, &child_allocation);
 
@@ -6044,7 +6012,7 @@ gtk_notebook_calc_tabs (GtkNotebook  *notebook,
 static void
 gtk_notebook_update_tab_states (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *list;
 
   for (list = priv->children; list != NULL; list = list->next)
@@ -6070,7 +6038,7 @@ gtk_notebook_real_switch_page (GtkNotebook     *notebook,
                               GtkWidget*       child,
                               guint            page_num)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *list = gtk_notebook_find_child (notebook, GTK_WIDGET (child), NULL);
   GtkNotebookPage *page = GTK_NOTEBOOK_PAGE (list);
   gboolean child_has_focus;
@@ -6123,7 +6091,7 @@ static void
 gtk_notebook_switch_page (GtkNotebook     *notebook,
                          GtkNotebookPage *page)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   guint page_num;
 
   if (priv->cur_page == page)
@@ -6142,7 +6110,7 @@ static gint
 gtk_notebook_page_select (GtkNotebook *notebook,
                          gboolean     move_focus)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   GtkDirectionType dir = GTK_DIR_DOWN; /* Quiet GCC */
   gint tab_pos = get_effective_tab_pos (notebook);
@@ -6181,7 +6149,7 @@ static void
 gtk_notebook_switch_focus_tab (GtkNotebook *notebook, 
                               GList       *new_child)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *old_child;
   GtkNotebookPage *page;
 
@@ -6210,13 +6178,14 @@ static void
 gtk_notebook_menu_switch_page (GtkWidget       *widget,
                               GtkNotebookPage *page)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GtkNotebook *notebook;
+  GtkWidget *parent;
   GList *children;
   guint page_num;
 
-  notebook = GTK_NOTEBOOK (gtk_menu_get_attach_widget
-                          (GTK_MENU (widget->parent)));
+  parent = gtk_widget_get_parent (widget);
+  notebook = GTK_NOTEBOOK (gtk_menu_get_attach_widget (GTK_MENU (parent)));
   priv = notebook->priv;
 
   if (priv->cur_page == page)
@@ -6233,7 +6202,7 @@ gtk_notebook_menu_switch_page (GtkWidget       *widget,
   g_signal_emit (notebook,
                 notebook_signals[SWITCH_PAGE],
                 0,
-                page,
+                page->child,
                 page_num);
 }
 
@@ -6247,7 +6216,7 @@ static void
 gtk_notebook_menu_item_create (GtkNotebook *notebook, 
                               GList       *list)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GtkNotebookPage *page;
   GtkWidget *menu_item;
 
@@ -6276,8 +6245,8 @@ static void
 gtk_notebook_menu_label_unparent (GtkWidget *widget, 
                                  gpointer  data)
 {
-  gtk_widget_unparent (GTK_BIN (widget)->child);
-  GTK_BIN (widget)->child = NULL;
+  gtk_widget_unparent (gtk_bin_get_child (GTK_BIN (widget)));
+  _gtk_bin_set_child (GTK_BIN (widget), NULL);
 }
 
 static void
@@ -6285,7 +6254,7 @@ gtk_notebook_menu_detacher (GtkWidget *widget,
                            GtkMenu   *menu)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   g_return_if_fail (priv->menu == (GtkWidget*) menu);
 
@@ -6457,7 +6426,7 @@ gtk_notebook_mnemonic_activate_switch_page (GtkWidget *child,
                                            gpointer data)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (data);
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
   GList *list;
 
   list = g_list_find_custom (priv->children, child,
@@ -6528,7 +6497,7 @@ void
 gtk_notebook_remove_page (GtkNotebook *notebook,
                          gint         page_num)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GList *list = NULL;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
@@ -6565,7 +6534,7 @@ gtk_notebook_remove_page (GtkNotebook *notebook,
 gint
 gtk_notebook_get_current_page (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
 
   g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), -1);
 
@@ -6592,7 +6561,7 @@ GtkWidget*
 gtk_notebook_get_nth_page (GtkNotebook *notebook,
                           gint         page_num)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
   GList *list;
 
@@ -6627,7 +6596,7 @@ gtk_notebook_get_nth_page (GtkNotebook *notebook,
 gint
 gtk_notebook_get_n_pages (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
 
   g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), 0);
 
@@ -6651,7 +6620,7 @@ gint
 gtk_notebook_page_num (GtkNotebook      *notebook,
                       GtkWidget        *child)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GList *children;
   gint num;
 
@@ -6694,7 +6663,7 @@ void
 gtk_notebook_set_current_page (GtkNotebook *notebook,
                               gint         page_num)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GList *list;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
@@ -6719,7 +6688,7 @@ gtk_notebook_set_current_page (GtkNotebook *notebook,
 void
 gtk_notebook_next_page (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GList *list;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
@@ -6747,7 +6716,7 @@ gtk_notebook_next_page (GtkNotebook *notebook)
 void
 gtk_notebook_prev_page (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GList *list;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
@@ -6768,13 +6737,15 @@ gtk_notebook_prev_page (GtkNotebook *notebook)
 /* Public GtkNotebook/Tab Style Functions
  *
  * gtk_notebook_set_show_border
+ * gtk_notebook_get_show_border
  * gtk_notebook_set_show_tabs
+ * gtk_notebook_get_show_tabs
  * gtk_notebook_set_tab_pos
- * gtk_notebook_set_homogeneous_tabs
- * gtk_notebook_set_tab_border
- * gtk_notebook_set_tab_hborder
- * gtk_notebook_set_tab_vborder
+ * gtk_notebook_get_tab_pos
  * gtk_notebook_set_scrollable
+ * gtk_notebook_get_scrollable
+ * gtk_notebook_get_tab_hborder
+ * gtk_notebook_get_tab_vborder
  */
 /**
  * gtk_notebook_set_show_border:
@@ -6789,7 +6760,7 @@ void
 gtk_notebook_set_show_border (GtkNotebook *notebook,
                              gboolean     show_border)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
@@ -6834,7 +6805,7 @@ void
 gtk_notebook_set_show_tabs (GtkNotebook *notebook,
                            gboolean     show_tabs)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
   GList *children;
   gint i;
@@ -6914,7 +6885,7 @@ void
 gtk_notebook_set_tab_pos (GtkNotebook     *notebook,
                          GtkPositionType  pos)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
@@ -6959,7 +6930,7 @@ void
 gtk_notebook_set_scrollable (GtkNotebook *notebook,
                             gboolean     scrollable)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
@@ -6995,6 +6966,43 @@ gtk_notebook_get_scrollable (GtkNotebook *notebook)
   return notebook->priv->scrollable;
 }
 
+/**
+ * gtk_notebook_get_tab_hborder:
+ * @notebook: a #GtkNotebook
+ *
+ * Returns the horizontal width of a tab border.
+ *
+ * Return value: horizontal width of a tab border
+ *
+ * Since: 2.22
+ */
+guint16
+gtk_notebook_get_tab_hborder (GtkNotebook *notebook)
+{
+  g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE);
+
+  return notebook->priv->tab_hborder;
+}
+
+/**
+ * gtk_notebook_get_tab_vborder:
+ * @notebook: a #GtkNotebook
+ *
+ * Returns the vertical width of a tab border.
+ *
+ * Return value: vertical width of a tab border
+ *
+ * Since: 2.22
+ */
+guint16
+gtk_notebook_get_tab_vborder (GtkNotebook *notebook)
+{
+  g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), FALSE);
+
+  return notebook->priv->tab_vborder;
+}
+
+
 /* Public GtkNotebook Popup Menu Methods:
  *
  * gtk_notebook_popup_enable
@@ -7012,7 +7020,7 @@ gtk_notebook_get_scrollable (GtkNotebook *notebook)
 void
 gtk_notebook_popup_enable (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GList *list;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
@@ -7045,7 +7053,7 @@ gtk_notebook_popup_enable (GtkNotebook *notebook)
 void       
 gtk_notebook_popup_disable  (GtkNotebook *notebook)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
@@ -7069,8 +7077,6 @@ gtk_notebook_popup_disable  (GtkNotebook *notebook)
  * gtk_notebook_get_menu_label
  * gtk_notebook_set_menu_label
  * gtk_notebook_set_menu_label_text
- * gtk_notebook_set_tab_label_packing
- * gtk_notebook_query_tab_label_packing
  * gtk_notebook_get_tab_reorderable
  * gtk_notebook_set_tab_reorderable
  * gtk_notebook_get_tab_detachable
@@ -7122,7 +7128,7 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
                            GtkWidget   *child,
                            GtkWidget   *tab_label)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
   GList *list;
 
@@ -7243,12 +7249,12 @@ gtk_notebook_get_tab_label_text (GtkNotebook *notebook,
  * gtk_notebook_get_menu_label:
  * @notebook: a #GtkNotebook
  * @child: a widget contained in a page of @notebook
- * 
+ *
  * Retrieves the menu label widget of the page containing @child.
- * 
- * Return value: the menu label, or %NULL if the
- *               notebook page does not have a menu label other
- *               than the default (the tab label).
+ *
+ * Return value: (transfer none): the menu label, or %NULL if the
+ *     notebook page does not have a menu label other than the
+ *     default (the tab label).
  **/
 GtkWidget*
 gtk_notebook_get_menu_label (GtkNotebook *notebook,
@@ -7260,14 +7266,14 @@ gtk_notebook_get_menu_label (GtkNotebook *notebook,
   g_return_val_if_fail (GTK_IS_WIDGET (child), NULL);
 
   list = CHECK_FIND_CHILD (notebook, child);
-  if (!list)  
+  if (!list)
     return NULL;
 
   if (GTK_NOTEBOOK_PAGE (list)->default_menu)
     return NULL;
 
   return GTK_NOTEBOOK_PAGE (list)->menu_label;
-}  
+}
 
 /**
  * gtk_notebook_set_menu_label:
@@ -7282,7 +7288,7 @@ gtk_notebook_set_menu_label (GtkNotebook *notebook,
                             GtkWidget   *child,
                             GtkWidget   *menu_label)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
   GList *list;
 
@@ -7300,7 +7306,7 @@ gtk_notebook_set_menu_label (GtkNotebook *notebook,
     {
       if (priv->menu)
        gtk_container_remove (GTK_CONTAINER (priv->menu),
-                             page->menu_label->parent);
+                              gtk_widget_get_parent (page->menu_label));
 
       if (!page->default_menu)
        g_object_unref (page->menu_label);
@@ -7383,13 +7389,13 @@ static void
 gtk_notebook_child_reordered (GtkNotebook     *notebook,
                              GtkNotebookPage *page)
 {
-  GtkNotebookPriv *priv = notebook->priv;
+  GtkNotebookPrivate *priv = notebook->priv;
 
   if (priv->menu)
     {
       GtkWidget *menu_item;
-      
-      menu_item = page->menu_label->parent;
+
+      menu_item = gtk_widget_get_parent (page->menu_label);
       gtk_container_remove (GTK_CONTAINER (menu_item), page->menu_label);
       gtk_container_remove (GTK_CONTAINER (priv->menu), menu_item);
       gtk_notebook_menu_item_create (notebook, g_list_find (priv->children, page));
@@ -7406,7 +7412,7 @@ gtk_notebook_set_tab_label_packing (GtkNotebook *notebook,
                                     gboolean     fill,
                                     GtkPackType  pack_type)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
   GList *list;
 
@@ -7482,7 +7488,7 @@ gtk_notebook_reorder_child (GtkNotebook *notebook,
                            GtkWidget   *child,
                            gint         position)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
   GList *list, *new_list;
   GtkNotebookPage *page;
   gint old_pos;
@@ -7538,74 +7544,55 @@ gtk_notebook_reorder_child (GtkNotebook *notebook,
 }
 
 /**
- * gtk_notebook_set_window_creation_hook:
- * @func: (allow-none): the #GtkNotebookWindowCreationFunc, or %NULL
- * @data: user data for @func
- * @destroy: (allow-none): Destroy notifier for @data, or %NULL
- *
- * Installs a global function used to create a window
- * when a detached tab is dropped in an empty area.
- * 
- * Since: 2.10
- **/
-void
-gtk_notebook_set_window_creation_hook (GtkNotebookWindowCreationFunc  func,
-                                      gpointer                       data,
-                                       GDestroyNotify                 destroy)
-{
-  if (window_creation_hook_destroy)
-    window_creation_hook_destroy (window_creation_hook_data);
-
-  window_creation_hook = func;
-  window_creation_hook_data = data;
-  window_creation_hook_destroy = destroy;
-}
-
-/**
- * gtk_notebook_set_group:
+ * gtk_notebook_set_group_name:
  * @notebook: a #GtkNotebook
- * @group: (allow-none): a pointer to identify the notebook group, or %NULL to unset it
+ * @name: (allow-none): the name of the notebook group, or %NULL to unset it
  *
- * Sets a group identificator pointer for @notebook, notebooks sharing
- * the same group identificator pointer will be able to exchange tabs
- * via drag and drop. A notebook with a %NULL group identificator will
+ * Sets a group name for @notebook.
+ *
+ * Notebooks with the same name will be able to exchange tabs
+ * via drag and drop. A notebook with a %NULL group name will
  * not be able to exchange tabs with any other notebook.
- * 
- * Since: 2.12
+ *
+ * Since: 2.24
  */
 void
-gtk_notebook_set_group (GtkNotebook *notebook,
-                       gpointer     group)
+gtk_notebook_set_group_name (GtkNotebook *notebook,
+                             const gchar *group_name)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
+  GQuark group;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
   priv = notebook->priv;
 
+  group = g_quark_from_string (group_name);
+
   if (priv->group != group)
     {
       priv->group = group;
-      g_object_notify (G_OBJECT (notebook), "group");
+      g_object_notify (G_OBJECT (notebook), "group-name");
     }
 }
 
 /**
- * gtk_notebook_get_group:
+ * gtk_notebook_get_group_name:
  * @notebook: a #GtkNotebook
- * 
- * Gets the current group identificator pointer for @notebook.
- * 
- * Return Value: the group identificator, or %NULL if none is set.
  *
- * Since: 2.12
+ * Gets the current group name for @notebook.
+ *
+ * Return Value: (transfer none): the group name,
+ *     or %NULL if none is set.
+ *
+ * Since: 2.24
  **/
-gpointer
-gtk_notebook_get_group (GtkNotebook *notebook)
+const gchar *
+gtk_notebook_get_group_name (GtkNotebook *notebook)
 {
   g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), NULL);
 
-  return notebook->priv->group;
+  return g_quark_to_string (notebook->priv->group);
 }
 
 /**
@@ -7704,7 +7691,7 @@ gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
  * notebook or widget.
  *
  * Note that 2 notebooks must share a common group identificator
- * (see gtk_notebook_set_group_id ()) to allow automatic tabs
+ * (see gtk_notebook_set_group()) to allow automatic tabs
  * interchange between them.
  *
  * If you want a widget to interact with a notebook through DnD
@@ -7767,8 +7754,8 @@ gtk_notebook_set_tab_detachable (GtkNotebook *notebook,
  *
  * Gets one of the action widgets. See gtk_notebook_set_action_widget().
  *
- * Returns: The action widget with the given @pack_type or
- *     %NULL when this action widget has not been set
+ * Returns: (transfer none): The action widget with the given @pack_type
+ *     or %NULL when this action widget has not been set
  *
  * Since: 2.20
  */
@@ -7801,11 +7788,11 @@ gtk_notebook_set_action_widget (GtkNotebook *notebook,
                                GtkWidget   *widget,
                                 GtkPackType  pack_type)
 {
-  GtkNotebookPriv *priv;
+  GtkNotebookPrivate *priv;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
   g_return_if_fail (!widget || GTK_IS_WIDGET (widget));
-  g_return_if_fail (!widget || widget->parent == NULL);
+  g_return_if_fail (!widget || gtk_widget_get_parent (widget) == NULL);
 
   priv = notebook->priv;