diff options
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r-- | gtk/gtknotebook.c | 67 |
1 files changed, 29 insertions, 38 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index e94518d29c..e50dc6f40c 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -1047,7 +1047,8 @@ gtk_notebook_class_init (GtkNotebookClass *class) * necessary properties to the notebook (e.g. the * #GtkNotebook:group ). * - * Returns: a #GtkNotebook that @page should be added to, or %NULL. + * Returns: (transfer none): a #GtkNotebook that @page should be + * added to, or %NULL. * * Since: 2.12 */ @@ -1471,7 +1472,6 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook, { GtkNotebookPrivate *priv = notebook->priv; GtkDirectionType effective_direction = get_effective_direction (notebook, direction_type); - GtkNotebookPage *page; GList *last, *child; gint page_num; @@ -1509,8 +1509,6 @@ gtk_notebook_reorder_tab (GtkNotebook *notebook, if (!child || child->data == priv->cur_page) return FALSE; - page = child->data; - if (effective_direction == GTK_DIR_RIGHT) page_num = reorder_tab (notebook, child->next, priv->focus_tab); else @@ -2280,13 +2278,10 @@ gtk_notebook_size_allocate (GtkWidget *widget, { GtkNotebook *notebook = GTK_NOTEBOOK (widget); GtkNotebookPrivate *priv = notebook->priv; - GtkStyleContext *context; gint tab_pos = get_effective_tab_pos (notebook); gboolean is_rtl; gint focus_width; - context = gtk_widget_get_style_context (widget); - gtk_widget_style_get (widget, "focus-line-width", &focus_width, NULL); gtk_widget_set_allocation (widget, allocation); @@ -3205,12 +3200,10 @@ check_threshold (GtkNotebook *notebook, gint current_y) { GtkNotebookPrivate *priv = notebook->priv; - GtkWidget *widget; gint dnd_threshold; GdkRectangle rectangle = { 0, }; /* shut up gcc */ GtkSettings *settings; - widget = GTK_WIDGET (notebook); settings = gtk_widget_get_settings (GTK_WIDGET (notebook)); g_object_get (G_OBJECT (settings), "gtk-dnd-drag-threshold", &dnd_threshold, NULL); @@ -3519,10 +3512,8 @@ gtk_notebook_drag_failed (GtkWidget *widget, GtkNotebook *notebook = GTK_NOTEBOOK (widget); GtkNotebookPrivate *priv = notebook->priv; GtkNotebook *dest_notebook = NULL; - GdkDisplay *display; gint x, y; - display = gtk_widget_get_display (widget); gdk_device_get_position (gdk_drag_context_get_device (context), NULL, &x, &y); @@ -5402,26 +5393,23 @@ gtk_notebook_tab_space (GtkNotebook *notebook, } static void -gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook, - gboolean show_arrows, - gint min, - gint max, - gint tab_space, - GList **last_child, - gint *n, - gint *remaining_space) +gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook, + gboolean show_arrows, + gint min, + gint max, + gint tab_space, + GList **last_child, + gint *n, + gint *remaining_space) { GtkNotebookPrivate *priv = notebook->priv; GtkWidget *widget; - GtkContainer *container; GList *children; GtkNotebookPage *page; - gint tab_pos, tab_overlap; + gint tab_overlap; widget = GTK_WIDGET (notebook); - container = GTK_CONTAINER (notebook); gtk_widget_style_get (widget, "tab-overlap", &tab_overlap, NULL); - tab_pos = get_effective_tab_pos (notebook); if (show_arrows) /* first_tab <- focus_tab */ { @@ -5470,7 +5458,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook, priv->first_tab = priv->focus_tab; else priv->first_tab = gtk_notebook_search_page (notebook, priv->focus_tab, - STEP_NEXT, TRUE); + STEP_NEXT, TRUE); } else /* calculate shown tabs counting backwards from the focus tab */ @@ -5479,7 +5467,8 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook, priv->focus_tab, STEP_PREV, TRUE), - &(priv->first_tab), remaining_space, + &(priv->first_tab), + remaining_space, STEP_PREV); if (*remaining_space < 0) @@ -5497,16 +5486,18 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook, { if (!priv->first_tab) priv->first_tab = gtk_notebook_search_page (notebook, - NULL, - STEP_NEXT, - TRUE); + NULL, + STEP_NEXT, + TRUE); children = NULL; gtk_notebook_calc_tabs (notebook, gtk_notebook_search_page (notebook, priv->focus_tab, STEP_NEXT, TRUE), - &children, remaining_space, STEP_NEXT); + &children, + remaining_space, + STEP_NEXT); if (*remaining_space <= 0) *last_child = children; @@ -5520,15 +5511,17 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook, priv->first_tab, STEP_PREV, TRUE), - &children, remaining_space, STEP_PREV); + &children, + remaining_space, + STEP_PREV); if (*remaining_space == 0) priv->first_tab = children; else priv->first_tab = gtk_notebook_search_page(notebook, - children, - STEP_NEXT, - TRUE); + children, + STEP_NEXT, + TRUE); } } @@ -5586,7 +5579,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook, *remaining_space = max - min - tab_overlap - tab_space; children = priv->children; priv->first_tab = gtk_notebook_search_page (notebook, NULL, - STEP_NEXT, TRUE); + STEP_NEXT, TRUE); while (children) { page = children->data; @@ -6241,9 +6234,9 @@ gtk_notebook_update_tab_states (GtkNotebook *notebook) if (page->tab_label) { if (page == priv->cur_page) - gtk_widget_set_state_flags (page->tab_label, GTK_STATE_FLAG_ACTIVE, TRUE); + gtk_widget_set_state_flags (page->tab_label, GTK_STATE_FLAG_ACTIVE, FALSE); else - gtk_widget_set_state_flags (page->tab_label, 0, TRUE); + gtk_widget_unset_state_flags (page->tab_label, GTK_STATE_FLAG_ACTIVE); gtk_widget_reset_style (page->tab_label); } @@ -6371,13 +6364,11 @@ gtk_notebook_switch_focus_tab (GtkNotebook *notebook, GList *new_child) { GtkNotebookPrivate *priv = notebook->priv; - GList *old_child; GtkNotebookPage *page; if (priv->focus_tab == new_child) return; - old_child = priv->focus_tab; priv->focus_tab = new_child; if (priv->scrollable) |