]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtknotebook.c
Deprecate widget flag: GTK_WIDGET_MAPPED
[~andy/gtk] / gtk / gtknotebook.c
index 8a9b699eb5edb56fcd059c9c144782ffbea64831..f6e3b9de9018c0014869211a6daa5ff69996fe26 100644 (file)
@@ -1071,7 +1071,7 @@ gtk_notebook_init (GtkNotebook *notebook)
 {
   GtkNotebookPrivate *priv;
 
-  GTK_WIDGET_SET_FLAGS (notebook, GTK_CAN_FOCUS);
+  gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE);
   GTK_WIDGET_SET_FLAGS (notebook, GTK_NO_WINDOW);
 
   priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
@@ -1655,7 +1655,7 @@ gtk_notebook_get_event_window_position (GtkNotebook  *notebook,
   for (tmp_list = notebook->children; tmp_list; tmp_list = tmp_list->next)
     {
       GtkNotebookPage *page = tmp_list->data;
-      if (GTK_WIDGET_VISIBLE (page->child))
+      if (gtk_widget_get_visible (page->child))
        {
          visible_page = page;
          break;
@@ -1682,7 +1682,7 @@ gtk_notebook_get_event_window_position (GtkNotebook  *notebook,
               for (i = 0; i < N_ACTION_WIDGETS; i++)
                 {
                   if (priv->action_widget[i] &&
-                      GTK_WIDGET_VISIBLE (priv->action_widget[i]))
+                      gtk_widget_get_visible (priv->action_widget[i]))
                     {
                       rectangle->width -= priv->action_widget[i]->allocation.width;
                       if ((!is_rtl && i == ACTION_WIDGET_START) ||
@@ -1701,7 +1701,7 @@ gtk_notebook_get_event_window_position (GtkNotebook  *notebook,
               for (i = 0; i < N_ACTION_WIDGETS; i++)
                 {
                   if (priv->action_widget[i] &&
-                      GTK_WIDGET_VISIBLE (priv->action_widget[i]))
+                      gtk_widget_get_visible (priv->action_widget[i]))
                     {
                       rectangle->height -= priv->action_widget[i]->allocation.height;
 
@@ -1741,22 +1741,20 @@ gtk_notebook_map (GtkWidget *widget)
   notebook = GTK_NOTEBOOK (widget);
   priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
 
-  if (notebook->cur_page && 
-      GTK_WIDGET_VISIBLE (notebook->cur_page->child) &&
-      !GTK_WIDGET_MAPPED (notebook->cur_page->child))
+  if (notebook->cur_page &&
+      gtk_widget_get_visible (notebook->cur_page->child) &&
+      !gtk_widget_get_mapped (notebook->cur_page->child))
     gtk_widget_map (notebook->cur_page->child);
 
-  if (notebook->show_tabs)
-  {
-    for (i = 0; i < 2; i++)
+  for (i = 0; i < N_ACTION_WIDGETS; i++)
     {
       if (priv->action_widget[i] &&
-          GTK_WIDGET_VISIBLE (priv->action_widget[i]) &&
-          !GTK_WIDGET_MAPPED (priv->action_widget[i]))
+          gtk_widget_get_visible (priv->action_widget[i]) &&
+          GTK_WIDGET_CHILD_VISIBLE (priv->action_widget[i]) &&
+          !gtk_widget_get_mapped (priv->action_widget[i]))
         gtk_widget_map (priv->action_widget[i]);
     }
-  }
-    
+
   if (notebook->scrollable)
     gtk_notebook_pages_allocate (notebook);
   else
@@ -1769,8 +1767,8 @@ gtk_notebook_map (GtkWidget *widget)
          children = children->next;
 
          if (page->tab_label &&
-             GTK_WIDGET_VISIBLE (page->tab_label) &&
-             !GTK_WIDGET_MAPPED (page->tab_label))
+             gtk_widget_get_visible (page->tab_label) &&
+             !gtk_widget_get_mapped (page->tab_label))
            gtk_widget_map (page->tab_label);
        }
     }
@@ -1886,7 +1884,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
     {
       page = children->data;
 
-      if (GTK_WIDGET_VISIBLE (page->child))
+      if (gtk_widget_get_visible (page->child))
        {
          vis_pages++;
          gtk_widget_size_request (page->child, &child_requisition);
@@ -1897,7 +1895,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
                                            child_requisition.height);
 
          if (notebook->menu && page->menu_label->parent &&
-             !GTK_WIDGET_VISIBLE (page->menu_label->parent))
+             !gtk_widget_get_visible (page->menu_label->parent))
            gtk_widget_show (page->menu_label->parent);
        }
       else
@@ -1905,7 +1903,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
          if (page == notebook->cur_page)
            switch_page = TRUE;
          if (notebook->menu && page->menu_label->parent &&
-             GTK_WIDGET_VISIBLE (page->menu_label->parent))
+             gtk_widget_get_visible (page->menu_label->parent))
            gtk_widget_hide (page->menu_label->parent);
        }
     }
@@ -1922,15 +1920,17 @@ gtk_notebook_size_request (GtkWidget      *widget,
          gint tab_max = 0;
          gint padding;
           gint i;
+          gint action_width = 0;
+          gint action_height = 0;
          
          for (children = notebook->children; children;
               children = children->next)
            {
              page = children->data;
              
-             if (GTK_WIDGET_VISIBLE (page->child))
+             if (gtk_widget_get_visible (page->child))
                {
-                 if (!GTK_WIDGET_VISIBLE (page->tab_label))
+                 if (!gtk_widget_get_visible (page->tab_label))
                    gtk_widget_show (page->tab_label);
 
                  gtk_widget_size_request (page->tab_label,
@@ -1961,7 +1961,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
                      break;
                    }
                }
-             else if (GTK_WIDGET_VISIBLE (page->tab_label))
+             else if (gtk_widget_get_visible (page->tab_label))
                gtk_widget_hide (page->tab_label);
            }
 
@@ -2001,7 +2001,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
                      page = children->data;
                      children = children->next;
                  
-                     if (!GTK_WIDGET_VISIBLE (page->child))
+                     if (!gtk_widget_get_visible (page->child))
                        continue;
 
                      if (notebook->homogeneous)
@@ -2017,16 +2017,16 @@ gtk_notebook_size_request (GtkWidget      *widget,
                      widget->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 (notebook->homogeneous && !notebook->scrollable)
                     widget->requisition.width = MAX (widget->requisition.width,
                                                      vis_pages * tab_max +
-                                                     tab_overlap);
+                                                     tab_overlap + action_width);
                   else
                     widget->requisition.width = MAX (widget->requisition.width,
-                                                     tab_width + tab_overlap);
+                                                     tab_width + tab_overlap + action_width);
 
-                 widget->requisition.width += action_widget_requisition[ACTION_WIDGET_START].width;
-                 widget->requisition.width += action_widget_requisition[ACTION_WIDGET_END].width;
                  widget->requisition.height += tab_height;
                  break;
                case GTK_POS_LEFT:
@@ -2051,7 +2051,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
                      page = children->data;
                      children = children->next;
 
-                     if (!GTK_WIDGET_VISIBLE (page->child))
+                     if (!gtk_widget_get_visible (page->child))
                        continue;
 
                      page->requisition.width = tab_width;
@@ -2067,15 +2067,17 @@ gtk_notebook_size_request (GtkWidget      *widget,
                  if (notebook->scrollable && vis_pages > 1 && 
                      widget->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 (notebook->homogeneous && !notebook->scrollable)
                     widget->requisition.height =
                      MAX (widget->requisition.height,
-                          vis_pages * tab_max + tab_overlap);
+                          vis_pages * tab_max + tab_overlap + action_height);
                   else
                     widget->requisition.height =
                      MAX (widget->requisition.height,
-                          tab_height + tab_overlap);
+                          tab_height + tab_overlap + action_height);
 
                  if (!notebook->homogeneous || notebook->scrollable)
                    vis_pages = 1;
@@ -2083,8 +2085,6 @@ gtk_notebook_size_request (GtkWidget      *widget,
                                                    vis_pages * tab_max +
                                                    tab_overlap);
 
-                 widget->requisition.height += action_widget_requisition[ACTION_WIDGET_START].height;
-                 widget->requisition.height += action_widget_requisition[ACTION_WIDGET_END].height;
                  widget->requisition.width += tab_width;
                  break;
                }
@@ -2097,7 +2097,7 @@ gtk_notebook_size_request (GtkWidget      *widget,
            {
              page = children->data;
              
-             if (page->tab_label && GTK_WIDGET_VISIBLE (page->tab_label))
+             if (page->tab_label && gtk_widget_get_visible (page->tab_label))
                gtk_widget_hide (page->tab_label);
            }
        }
@@ -2114,14 +2114,14 @@ gtk_notebook_size_request (GtkWidget      *widget,
               children = children->next)
            {
              page = children->data;
-             if (GTK_WIDGET_VISIBLE (page->child))
+             if (gtk_widget_get_visible (page->child))
                {
                  gtk_notebook_switch_page (notebook, page);
                  break;
                }
            }
        }
-      else if (GTK_WIDGET_VISIBLE (widget))
+      else if (gtk_widget_get_visible (widget))
        {
          widget->requisition.width = GTK_CONTAINER (widget)->border_width * 2;
          widget->requisition.height= GTK_CONTAINER (widget)->border_width * 2;
@@ -2160,7 +2160,7 @@ gtk_notebook_size_allocate (GtkWidget     *widget,
          gdk_window_move_resize (notebook->event_window,
                                  position.x, position.y,
                                  position.width, position.height);
-         if (GTK_WIDGET_MAPPED (notebook))
+         if (gtk_widget_get_mapped (GTK_WIDGET (notebook)))
            gdk_window_show_unraised (notebook->event_window);
        }
       else
@@ -2266,7 +2266,7 @@ gtk_notebook_size_allocate (GtkWidget     *widget,
          page = children->data;
          children = children->next;
          
-         if (GTK_WIDGET_VISIBLE (page->child))
+         if (gtk_widget_get_visible (page->child))
            gtk_widget_size_allocate (page->child, &child_allocation);
        }
 
@@ -2311,7 +2311,7 @@ gtk_notebook_expose (GtkWidget      *widget,
       gtk_container_propagate_expose (GTK_CONTAINER (notebook),
                                      notebook->cur_page->tab_label, event);
     }
-  else if (GTK_WIDGET_DRAWABLE (widget))
+  else if (gtk_widget_is_drawable (widget))
     {
       gtk_notebook_paint (widget, &event->area);
       if (notebook->show_tabs)
@@ -2328,7 +2328,7 @@ gtk_notebook_expose (GtkWidget      *widget,
              pages = pages->next;
 
              if (page->tab_label->window == event->window &&
-                 GTK_WIDGET_DRAWABLE (page->tab_label))
+                 gtk_widget_is_drawable (page->tab_label))
                gtk_container_propagate_expose (GTK_CONTAINER (notebook),
                                                page->tab_label, event);
            }
@@ -2343,7 +2343,7 @@ gtk_notebook_expose (GtkWidget      *widget,
         for (i = 0; i < N_ACTION_WIDGETS; i++)
         {
           if (priv->action_widget[i] &&
-              GTK_WIDGET_DRAWABLE (priv->action_widget[i]))
+              gtk_widget_is_drawable (priv->action_widget[i]))
             gtk_container_propagate_expose (GTK_CONTAINER (notebook),
                                             priv->action_widget[i], event);
         }
@@ -2508,7 +2508,7 @@ gtk_notebook_arrow_button_press (GtkNotebook      *notebook,
   gboolean left = (ARROW_IS_LEFT (arrow) && !is_rtl) || 
                   (!ARROW_IS_LEFT (arrow) && is_rtl);
 
-  if (!GTK_WIDGET_HAS_FOCUS (widget))
+  if (!gtk_widget_has_focus (widget))
     gtk_widget_grab_focus (widget);
   
   notebook->button = button;
@@ -2618,8 +2618,8 @@ get_tab_at_pos (GtkNotebook *notebook, gint x, gint y)
     {
       page = children->data;
       
-      if (GTK_WIDGET_VISIBLE (page->child) &&
-         page->tab_label && GTK_WIDGET_MAPPED (page->tab_label) &&
+      if (gtk_widget_get_visible (page->child) &&
+         page->tab_label && gtk_widget_get_mapped (page->tab_label) &&
          (x >= page->allocation.x) &&
          (y >= page->allocation.y) &&
          (x <= (page->allocation.x + page->allocation.width)) &&
@@ -2790,9 +2790,9 @@ get_drop_position (GtkNotebook *notebook,
       page = children->data;
 
       if ((priv->operation != DRAG_OPERATION_REORDER || page != notebook->cur_page) &&
-         GTK_WIDGET_VISIBLE (page->child) &&
+         gtk_widget_get_visible (page->child) &&
          page->tab_label &&
-         GTK_WIDGET_MAPPED (page->tab_label) &&
+         gtk_widget_get_mapped (page->tab_label) &&
          page->pack == pack)
        {
          switch (notebook->tab_pos)
@@ -3244,7 +3244,7 @@ static void
 gtk_notebook_state_changed (GtkWidget    *widget,
                            GtkStateType  previous_state)
 {
-  if (!GTK_WIDGET_IS_SENSITIVE (widget)) 
+  if (!gtk_widget_is_sensitive (widget))
     stop_scrolling (GTK_NOTEBOOK (widget));
 }
 
@@ -3272,7 +3272,7 @@ gtk_notebook_draw_focus (GtkWidget      *widget,
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
 
-  if (GTK_WIDGET_HAS_FOCUS (widget) && GTK_WIDGET_DRAWABLE (widget) &&
+  if (gtk_widget_has_focus (widget) && gtk_widget_is_drawable (widget) &&
       notebook->show_tabs && notebook->cur_page &&
       notebook->cur_page->tab_label->window == event->window)
     {
@@ -3988,7 +3988,7 @@ focus_action_in (GtkNotebook      *notebook,
   GtkNotebookPrivate *priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
 
   if (priv->action_widget[action] &&
-      GTK_WIDGET_VISIBLE (priv->action_widget[action]))
+      gtk_widget_get_visible (priv->action_widget[action]))
     return gtk_widget_child_focus (priv->action_widget[action], direction);
   else
     return FALSE;
@@ -4299,7 +4299,7 @@ page_visible_cb (GtkWidget  *page,
 
   if (notebook->cur_page &&
       notebook->cur_page->child == page &&
-      !GTK_WIDGET_VISIBLE (page))
+      !gtk_widget_get_visible (page))
     {
       list = g_list_find (notebook->children, notebook->cur_page);
       if (list)
@@ -4371,7 +4371,7 @@ gtk_notebook_real_insert_page (GtkNotebook *notebook,
 
   if (tab_label)
     {
-      if (notebook->show_tabs && GTK_WIDGET_VISIBLE (child))
+      if (notebook->show_tabs && gtk_widget_get_visible (child))
        gtk_widget_show (tab_label);
       else
        gtk_widget_hide (tab_label);
@@ -4439,7 +4439,7 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
   widget = GTK_WIDGET (notebook);
   border = GTK_CONTAINER (notebook)->border_width;
 
-  if (!GTK_WIDGET_MAPPED (notebook) || !notebook->first_tab)
+  if (!gtk_widget_get_mapped (widget) || !notebook->first_tab)
     return;
 
   page = notebook->first_tab->data;
@@ -4488,7 +4488,8 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
 static void
 gtk_notebook_redraw_arrows (GtkNotebook *notebook)
 {
-  if (GTK_WIDGET_MAPPED (notebook) && gtk_notebook_show_arrows (notebook))
+  if (gtk_widget_get_mapped (GTK_WIDGET (notebook)) &&
+      gtk_notebook_show_arrows (notebook))
     {
       GdkRectangle rect;
       gint i;
@@ -4640,7 +4641,8 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
   
   g_signal_handler_disconnect (page->child, page->notify_visible_handler); 
 
-  if (GTK_WIDGET_VISIBLE (page->child) && GTK_WIDGET_VISIBLE (notebook))
+  if (gtk_widget_get_visible (page->child) &&
+      gtk_widget_get_visible (GTK_WIDGET (notebook)))
     need_resize = TRUE;
 
   gtk_widget_unparent (page->child);
@@ -4710,11 +4712,11 @@ gtk_notebook_update_labels (GtkNotebook *notebook)
                gtk_label_set_text (GTK_LABEL (page->tab_label), string);
            }
 
-         if (GTK_WIDGET_VISIBLE (page->child) &&
-             !GTK_WIDGET_VISIBLE (page->tab_label))
+         if (gtk_widget_get_visible (page->child) &&
+             !gtk_widget_get_visible (page->tab_label))
            gtk_widget_show (page->tab_label);
-         else if (!GTK_WIDGET_VISIBLE (page->child) &&
-                  GTK_WIDGET_VISIBLE (page->tab_label))
+         else if (!gtk_widget_get_visible (page->child) &&
+                  gtk_widget_get_visible (page->tab_label))
            gtk_widget_hide (page->tab_label);
        }
       if (notebook->menu && page->default_menu)
@@ -4788,7 +4790,7 @@ gtk_notebook_search_page (GtkNotebook *notebook,
          page = list->data;
          if (page->pack == flag &&
              (!find_visible ||
-              (GTK_WIDGET_VISIBLE (page->child) &&
+              (gtk_widget_get_visible (page->child) &&
                (!page->tab_label || NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page)))))
            return list;
          old_list = list;
@@ -4806,7 +4808,7 @@ gtk_notebook_search_page (GtkNotebook *notebook,
       page = list->data;
       if (page->pack != flag &&
          (!find_visible ||
-          (GTK_WIDGET_VISIBLE (page->child) &&
+          (gtk_widget_get_visible (page->child) &&
            (!page->tab_label || NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page)))))
        return list;
       old_list = list;
@@ -4837,7 +4839,7 @@ gtk_notebook_paint (GtkWidget    *widget,
   gboolean is_rtl;
   gint tab_pos;
    
-  if (!GTK_WIDGET_DRAWABLE (widget))
+  if (!gtk_widget_is_drawable (widget))
     return;
 
   notebook = GTK_NOTEBOOK (widget);
@@ -4846,7 +4848,7 @@ gtk_notebook_paint (GtkWidget    *widget,
   tab_pos = get_effective_tab_pos (notebook);
 
   if ((!notebook->show_tabs && !notebook->show_border) ||
-      !notebook->cur_page || !GTK_WIDGET_VISIBLE (notebook->cur_page->child))
+      !notebook->cur_page || !gtk_widget_get_visible (notebook->cur_page->child))
     return;
 
   x = widget->allocation.x + border_width;
@@ -4866,7 +4868,7 @@ gtk_notebook_paint (GtkWidget    *widget,
   if (!notebook->first_tab)
     notebook->first_tab = notebook->children;
 
-  if (!GTK_WIDGET_MAPPED (notebook->cur_page->tab_label))
+  if (!gtk_widget_get_mapped (notebook->cur_page->tab_label))
     page = GTK_NOTEBOOK_PAGE (notebook->first_tab);
   else
     page = notebook->cur_page;
@@ -4888,7 +4890,7 @@ gtk_notebook_paint (GtkWidget    *widget,
     }
 
   if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, notebook->cur_page) ||
-      !GTK_WIDGET_MAPPED (notebook->cur_page->tab_label))
+      !gtk_widget_get_mapped (notebook->cur_page->tab_label))
     {
       gap_x = 0;
       gap_width = 0;
@@ -4932,9 +4934,9 @@ gtk_notebook_paint (GtkWidget    *widget,
       page = children->data;
       children = gtk_notebook_search_page (notebook, children,
                                           step, TRUE);
-      if (!GTK_WIDGET_VISIBLE (page->child))
+      if (!gtk_widget_get_visible (page->child))
        continue;
-      if (!GTK_WIDGET_MAPPED (page->tab_label))
+      if (!gtk_widget_get_mapped (page->tab_label))
        showarrow = TRUE;
       else if (page != notebook->cur_page)
        gtk_notebook_draw_tab (notebook, page, area);
@@ -4968,7 +4970,7 @@ gtk_notebook_draw_tab (GtkNotebook     *notebook,
   GtkWidget *widget;
   
   if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) ||
-      !GTK_WIDGET_MAPPED (page->tab_label) ||
+      !gtk_widget_get_mapped (page->tab_label) ||
       (page->allocation.width == 0) || (page->allocation.height == 0))
     return;
 
@@ -5014,7 +5016,9 @@ gtk_notebook_draw_arrow (GtkNotebook      *notebook,
   GtkArrowType arrow;
   gboolean is_rtl, left;
 
-  if (GTK_WIDGET_DRAWABLE (notebook))
+  widget = GTK_WIDGET (notebook);
+
+  if (gtk_widget_is_drawable (widget))
     {
       gint scroll_arrow_hlength;
       gint scroll_arrow_vlength;
@@ -5022,8 +5026,6 @@ gtk_notebook_draw_arrow (GtkNotebook      *notebook,
 
       gtk_notebook_get_arrow_rect (notebook, &arrow_rect, nbarrow);
 
-      widget = GTK_WIDGET (notebook);
-
       is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
       left = (ARROW_IS_LEFT (nbarrow) && !is_rtl) ||
              (!ARROW_IS_LEFT (nbarrow) && is_rtl); 
@@ -5140,7 +5142,7 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
          children = children->next;
 
          if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) &&
-             GTK_WIDGET_VISIBLE (page->child))
+             gtk_widget_get_visible (page->child))
            *tab_space += page->requisition.width;
        }
       break;
@@ -5168,7 +5170,7 @@ gtk_notebook_tab_space (GtkNotebook *notebook,
          children = children->next;
 
          if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) &&
-             GTK_WIDGET_VISIBLE (page->child))
+             gtk_widget_get_visible (page->child))
            *tab_space += page->requisition.height;
        }
       break;
@@ -5268,7 +5270,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
       *remaining_space = tab_space;
 
       if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, notebook->cur_page) &&
-         GTK_WIDGET_VISIBLE (notebook->cur_page->child))
+         gtk_widget_get_visible (notebook->cur_page->child))
        {
          gtk_notebook_calc_tabs (notebook,
                                  notebook->focus_tab,
@@ -5276,7 +5278,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
                                  remaining_space, STEP_NEXT);
        }
 
-      if (tab_space <= 0 || *remaining_space < 0)
+      if (tab_space <= 0 || *remaining_space <= 0)
        {
          /* show 1 tab */
          notebook->first_tab = notebook->focus_tab;
@@ -5295,7 +5297,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
              /* Is first_tab really predecessor of focus_tab? */
              page = notebook->first_tab->data;
              if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) &&
-                 GTK_WIDGET_VISIBLE (page->child))
+                 gtk_widget_get_visible (page->child))
                for (children = notebook->focus_tab;
                     children && children != notebook->first_tab;
                     children = gtk_notebook_search_page (notebook,
@@ -5428,7 +5430,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook,
          children = children->next;
 
          if (!NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) ||
-             !GTK_WIDGET_VISIBLE (page->child))
+             !gtk_widget_get_visible (page->child))
            continue;
 
          c++;
@@ -5554,7 +5556,7 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
        {
          *children = (*children)->next;
 
-          if (page->pack != GTK_PACK_END || !GTK_WIDGET_VISIBLE (page->child))
+          if (page->pack != GTK_PACK_END || !gtk_widget_get_visible (page->child))
            continue;
        }
 
@@ -5867,7 +5869,7 @@ gtk_notebook_page_allocate (GtkNotebook     *notebook,
   gboolean was_visible = page->tab_allocated_visible;
 
   if (!page->tab_label ||
-      !GTK_WIDGET_VISIBLE (page->tab_label) ||
+      !gtk_widget_get_visible (page->tab_label) ||
       !gtk_widget_get_child_visible (page->tab_label))
     {
       page->tab_allocated_visible = FALSE;
@@ -5988,7 +5990,7 @@ gtk_notebook_calc_tabs (GtkNotebook  *notebook,
            {
              page = children->data;
              if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) &&
-                 GTK_WIDGET_VISIBLE (page->child))
+                 gtk_widget_get_visible (page->child))
                {
                  if (page->pack == pack)
                    {
@@ -6024,7 +6026,7 @@ gtk_notebook_calc_tabs (GtkNotebook  *notebook,
            {
              page = children->data;
              if (NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page) &&
-                 GTK_WIDGET_VISIBLE (page->child))
+                 gtk_widget_get_visible (page->child))
                {
                  if (page->pack == pack)
                    {
@@ -6093,7 +6095,7 @@ gtk_notebook_real_switch_page (GtkNotebook     *notebook,
 {
   gboolean child_has_focus;
 
-  if (notebook->cur_page == page || !GTK_WIDGET_VISIBLE (page->child))
+  if (notebook->cur_page == page || !gtk_widget_get_visible (page->child))
     return;
 
   /* save the value here, changing visibility changes focus */
@@ -6213,7 +6215,7 @@ gtk_notebook_switch_focus_tab (GtkNotebook *notebook,
     return;
 
   page = notebook->focus_tab->data;
-  if (GTK_WIDGET_MAPPED (page->tab_label))
+  if (gtk_widget_get_mapped (page->tab_label))
     gtk_notebook_redraw_tabs (notebook);
   else
     gtk_notebook_pages_allocate (notebook);
@@ -6280,7 +6282,7 @@ gtk_notebook_menu_item_create (GtkNotebook *notebook,
                         gtk_notebook_real_page_position (notebook, list));
   g_signal_connect (menu_item, "activate",
                    G_CALLBACK (gtk_notebook_menu_switch_page), page);
-  if (GTK_WIDGET_VISIBLE (page->child))
+  if (gtk_widget_get_visible (page->child))
     gtk_widget_show (menu_item);
 }
 
@@ -6331,7 +6333,8 @@ gtk_notebook_set_tab_border_internal (GtkNotebook *notebook,
   notebook->tab_hborder = border_width;
   notebook->tab_vborder = border_width;
 
-  if (GTK_WIDGET_VISIBLE (notebook) && notebook->show_tabs)
+  if (notebook->show_tabs &&
+      gtk_widget_get_visible (GTK_WIDGET (notebook)))
     gtk_widget_queue_resize (GTK_WIDGET (notebook));
 
   g_object_freeze_notify (G_OBJECT (notebook));
@@ -6349,7 +6352,8 @@ gtk_notebook_set_tab_hborder_internal (GtkNotebook *notebook,
 
   notebook->tab_hborder = tab_hborder;
 
-  if (GTK_WIDGET_VISIBLE (notebook) && notebook->show_tabs)
+  if (notebook->show_tabs &&
+      gtk_widget_get_visible (GTK_WIDGET (notebook)))
     gtk_widget_queue_resize (GTK_WIDGET (notebook));
 
   g_object_notify (G_OBJECT (notebook), "tab-hborder");
@@ -6364,7 +6368,8 @@ gtk_notebook_set_tab_vborder_internal (GtkNotebook *notebook,
 
   notebook->tab_vborder = tab_vborder;
 
-  if (GTK_WIDGET_VISIBLE (notebook) && notebook->show_tabs)
+  if (notebook->show_tabs &&
+      gtk_widget_get_visible (GTK_WIDGET (notebook)))
     gtk_widget_queue_resize (GTK_WIDGET (notebook));
 
   g_object_notify (G_OBJECT (notebook), "tab-vborder");
@@ -6846,7 +6851,7 @@ gtk_notebook_set_show_border (GtkNotebook *notebook,
     {
       notebook->show_border = show_border;
 
-      if (GTK_WIDGET_VISIBLE (notebook))
+      if (gtk_widget_get_visible (GTK_WIDGET (notebook)))
        gtk_widget_queue_resize (GTK_WIDGET (notebook));
       
       g_object_notify (G_OBJECT (notebook), "show-border");
@@ -6881,11 +6886,15 @@ void
 gtk_notebook_set_show_tabs (GtkNotebook *notebook,
                            gboolean     show_tabs)
 {
+  GtkNotebookPrivate *priv;
   GtkNotebookPage *page;
   GList *children;
+  gint i;
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
+  priv = GTK_NOTEBOOK_GET_PRIVATE (notebook);
+
   show_tabs = show_tabs != FALSE;
 
   if (notebook->show_tabs == show_tabs)
@@ -6896,8 +6905,8 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook,
 
   if (!show_tabs)
     {
-      GTK_WIDGET_UNSET_FLAGS (notebook, GTK_CAN_FOCUS);
-      
+      gtk_widget_set_can_focus (GTK_WIDGET (notebook), FALSE);
+
       while (children)
        {
          page = children->data;
@@ -6913,9 +6922,16 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook,
     }
   else
     {
-      GTK_WIDGET_SET_FLAGS (notebook, GTK_CAN_FOCUS);
+      gtk_widget_set_can_focus (GTK_WIDGET (notebook), TRUE);
       gtk_notebook_update_labels (notebook);
     }
+
+  for (i = 0; i < N_ACTION_WIDGETS; i++)
+    {
+      if (priv->action_widget[i])
+        gtk_widget_set_child_visible (priv->action_widget[i], show_tabs);
+    }
+
   gtk_widget_queue_resize (GTK_WIDGET (notebook));
 
   g_object_notify (G_OBJECT (notebook), "show-tabs");
@@ -6955,7 +6971,7 @@ gtk_notebook_set_tab_pos (GtkNotebook     *notebook,
   if (notebook->tab_pos != pos)
     {
       notebook->tab_pos = pos;
-      if (GTK_WIDGET_VISIBLE (notebook))
+      if (gtk_widget_get_visible (GTK_WIDGET (notebook)))
        gtk_widget_queue_resize (GTK_WIDGET (notebook));
     }
 
@@ -7066,7 +7082,7 @@ gtk_notebook_set_scrollable (GtkNotebook *notebook,
     {
       notebook->scrollable = scrollable;
 
-      if (GTK_WIDGET_VISIBLE (notebook))
+      if (gtk_widget_get_visible (GTK_WIDGET (notebook)))
        gtk_widget_queue_resize (GTK_WIDGET (notebook));
 
       g_object_notify (G_OBJECT (notebook), "scrollable");
@@ -7260,7 +7276,7 @@ gtk_notebook_set_tab_label (GtkNotebook *notebook,
                        G_CALLBACK (gtk_notebook_mnemonic_activate_switch_page),
                        notebook);
 
-  if (notebook->show_tabs && GTK_WIDGET_VISIBLE (child))
+  if (notebook->show_tabs && gtk_widget_get_visible (child))
     {
       gtk_widget_show (page->tab_label);
       gtk_widget_queue_resize (GTK_WIDGET (notebook));
@@ -7491,8 +7507,8 @@ gtk_notebook_child_reordered (GtkNotebook     *notebook,
  * containing @child. See gtk_box_pack_start() for the exact meaning
  * of the parameters.
  *
- * Deprecated: 2.20: Modify the "tab-expand" and "tab-fill" child
- *   properties instead.
+ * Deprecated: 2.20: Modify the #GtkNotebook:tab-expand and
+ *   #GtkNotebook:tab-fill child properties instead.
  **/
 void
 gtk_notebook_set_tab_label_packing (GtkNotebook *notebook,
@@ -7545,8 +7561,8 @@ gtk_notebook_set_tab_label_packing (GtkNotebook *notebook,
  * Query the packing attributes for the tab label of the page
  * containing @child.
  *
- * Deprecated: 2.20: Modify the "tab-expand" and "tab-fill" child
- *   properties instead.
+ * Deprecated: 2.20: Modify the #GtkNotebook:tab-expand and
+ *   #GtkNotebook:tab-fill child properties instead.
  **/
 void
 gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
@@ -7642,9 +7658,9 @@ gtk_notebook_reorder_child (GtkNotebook *notebook,
 
 /**
  * gtk_notebook_set_window_creation_hook:
- * @func: the #GtkNotebookWindowCreationFunc, or %NULL
+ * @func: (allow-none): the #GtkNotebookWindowCreationFunc, or %NULL
  * @data: user data for @func
- * @destroy: Destroy notifier for @data, or %NULL
+ * @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.
@@ -7693,7 +7709,7 @@ gtk_notebook_set_group_id (GtkNotebook *notebook,
 /**
  * gtk_notebook_set_group:
  * @notebook: a #GtkNotebook
- * @group: a pointer to identify the notebook group, or %NULL to unset it
+ * @group: (allow-none): a pointer to identify 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
@@ -7976,10 +7992,8 @@ gtk_notebook_set_action_widget (GtkNotebook *notebook,
 
   if (widget)
     {
+      gtk_widget_set_child_visible (widget, notebook->show_tabs);
       gtk_widget_set_parent (widget, GTK_WIDGET (notebook));
-
-      if (GTK_WIDGET_REALIZED (GTK_WIDGET (notebook)))
-       gtk_widget_realize (widget);
     }
 
   gtk_widget_queue_resize (GTK_WIDGET (notebook));