HdyTabView: Handy Reference Manual

## HdyTabView HdyTabView — A dynamic tabbed container |

## Functions

GtkWidget * | hdy_tab_page_get_child ()
HdyTabPage * | hdy_tab_page_get_parent ()
gboolean | hdy_tab_page_get_selected ()
gboolean | hdy_tab_page_get_pinned ()
const gchar * | hdy_tab_page_get_title ()
void | hdy_tab_page_set_title ()
const gchar * | hdy_tab_page_get_tooltip ()
void | hdy_tab_page_set_tooltip ()
GIcon * | hdy_tab_page_get_icon ()
void | hdy_tab_page_set_icon ()
gboolean | hdy_tab_page_get_loading ()
void | hdy_tab_page_set_loading ()
GIcon * | hdy_tab_page_get_indicator_icon ()
void | hdy_tab_page_set_indicator_icon ()
gboolean | hdy_tab_page_get_indicator_activatable ()
void | hdy_tab_page_set_indicator_activatable ()
gboolean | hdy_tab_page_get_needs_attention ()
void | hdy_tab_page_set_needs_attention ()
HdyTabView * | hdy_tab_view_new ()
gint | hdy_tab_view_get_n_pages ()
gint | hdy_tab_view_get_n_pinned_pages ()
gboolean | hdy_tab_view_get_is_transferring_page ()
HdyTabPage * | hdy_tab_view_get_selected_page ()
void | hdy_tab_view_set_selected_page ()
gboolean | hdy_tab_view_select_previous_page ()
gboolean | hdy_tab_view_select_next_page ()
GIcon * | hdy_tab_view_get_default_icon ()
void | hdy_tab_view_set_default_icon ()
GMenuModel * | hdy_tab_view_get_menu_model ()
void | hdy_tab_view_set_menu_model ()
GtkWidget * | hdy_tab_view_get_shortcut_widget ()
void | hdy_tab_view_set_shortcut_widget ()
void | hdy_tab_view_set_page_pinned ()
HdyTabPage * | hdy_tab_view_get_page ()
HdyTabPage * | hdy_tab_view_get_nth_page ()
gint | hdy_tab_view_get_page_position ()
HdyTabPage * | hdy_tab_view_add_page ()
HdyTabPage * | hdy_tab_view_insert ()
HdyTabPage * | hdy_tab_view_prepend ()
HdyTabPage * | hdy_tab_view_append ()
HdyTabPage * | hdy_tab_view_insert_pinned ()
HdyTabPage * | hdy_tab_view_prepend_pinned ()
HdyTabPage * | hdy_tab_view_append_pinned ()
void | hdy_tab_view_close_page ()
void | hdy_tab_view_close_page_finish ()
void | hdy_tab_view_close_other_pages ()
void | hdy_tab_view_close_pages_before ()
void | hdy_tab_view_close_pages_after ()
gboolean | hdy_tab_view_reorder_page ()
gboolean | hdy_tab_view_reorder_backward ()
gboolean | hdy_tab_view_reorder_forward ()
gboolean | hdy_tab_view_reorder_first ()
gboolean | hdy_tab_view_reorder_last ()
void | hdy_tab_view_transfer_page ()
GListModel * | hdy_tab_view_get_pages ()

## Properties

GtkWidget * | child | Read / Write / Construct Only
GIcon * | icon | Read / Write
gboolean | indicator-activatable | Read / Write
GIcon * | indicator-icon | Read / Write
gboolean | loading | Read / Write
gboolean | needs-attention | Read / Write
HdyTabPage * | parent | Read / Write / Construct Only
gboolean | pinned | Read
gboolean | selected | Read
char * | title | Read / Write
char * | tooltip | Read / Write
GIcon * | default-icon | Read / Write
gboolean | is-transferring-page | Read
GMenuModel * | menu-model | Read / Write
int | n-pages | Read
int | n-pinned-pages | Read
HdyTabPage * | selected-page | Read / Write
GtkWidget * | shortcut-widget | Read / Write

## Signals

gboolean | close-page | Run Last
HdyTabView* | create-window | Run Last
void | indicator-activated | Run Last
void | page-attached | Run Last
void | page-detached | Run Last
void | page-reordered | Run Last
void | setup-menu | Run Last

## Types and Values

#define | HDY_TYPE_TAB_PAGE
#define | HDY_TYPE_TAB_VIEW
| HdyTabPage
| HdyTabView

## Object Hierarchy

        GObject
        ├── GInitiallyUnowned
        │   ╰── GtkWidget
        │       ╰── GtkContainer
        │           ╰── GtkBin
        │               ╰── HdyTabView
        ╰── HdyTabPage

## Implemented Interfaces

HdyTabView implements AtkImplementorIface and GtkBuildable.

## Description

HdyTabView is a container which shows one child at a time. While it provides keyboard shortcuts for switching between pages, it does not provide a visible tab bar and relies on external widgets for that, such as HdyTabBar.

HdyTabView maintains a HdyTabPage object for each page,which holds additional per-page properties. You can obtain the HdyTabPage for a page with `hdy_tab_view_get_page()`, and as return value for `hdy_tab_view_append()` and other functions for adding children.

HdyTabView only aims to be useful for dynamic tabs in multi-window document-based applications, such as web browsers, file managers, text editors or terminals. It does not aim to replace GtkNotebook for use cases such as tabbed dialogs.

As such, it does not support disabling page reordering or detaching, or adding children via GtkBuilder.

### CSS nodes

HdyTabView has a main CSS node with the name tabview.

It contains the subnode overlay, which contains subnodes stack and widget. The stack subnode contains the added pages.

    tabview
    ╰── overlay
        ├── stack
        │   ╰── [ Children ]
        ╰── widget

## Functions

### hdy_tab_page_get_child ()

    GtkWidget *
    hdy_tab_page_get_child (HdyTabPage *self);

Gets the child of `self` .

#### Parameters

self | a HdyTabPage |

#### Returns

the child of `self` .

[transfer none]

Since: 1.2

### hdy_tab_page_get_parent ()

    HdyTabPage *
    hdy_tab_page_get_parent (HdyTabPage *self);

Gets the parent page of `self` , or `NULL` if the `self` does not have a parent.

See `hdy_tab_view_add_page()` and `hdy_tab_view_close_page()`.

#### Parameters

self | a HdyTabPage |

#### Returns

the parent page of `self` , or `NULL`.

[transfer none][nullable]

Since: 1.2

### hdy_tab_page_get_selected ()

    gboolean
    hdy_tab_page_get_selected (HdyTabPage *self);

Gets whether `self` is selected. See `hdy_tab_view_set_selected_page()`.

#### Parameters

self | a HdyTabPage |

#### Returns

whether `self` is selected

Since: 1.2

### hdy_tab_page_get_pinned ()

    gboolean
    hdy_tab_page_get_pinned (HdyTabPage *self);

Gets whether `self` is pinned. See `hdy_tab_view_set_page_pinned()`.

#### Parameters

self | a HdyTabPage |

#### Returns

whether `self` is pinned

Since: 1.2

### hdy_tab_page_get_title ()

    const gchar *
    hdy_tab_page_get_title (HdyTabPage *self);

Gets the title of `self` , see `hdy_tab_page_set_title()`.

#### Parameters

self | a HdyTabPage |

#### Returns

the title of `self` .

[nullable]

Since: 1.2

### hdy_tab_page_set_title ()

    void
    hdy_tab_page_set_title (HdyTabPage *self,
                            const gchar *title);

Sets the title of `self` .

HdyTabBar will display it in the center of the tab representing `self` unless it's pinned, and will use it as a tooltip unless “tooltip” is set.

#### Parameters

self | a HdyTabPage |
title | the title of `self` . | [nullable]

Since: 1.2

### hdy_tab_page_get_tooltip ()

    const gchar *
    hdy_tab_page_get_tooltip (HdyTabPage *self);

Gets the tooltip of `self` , see `hdy_tab_page_set_tooltip()`.

#### Parameters

self | a HdyTabPage |

#### Returns

the tooltip of `self` .

[nullable]

Since: 1.2

### hdy_tab_page_set_tooltip ()

    void
    hdy_tab_page_set_tooltip (HdyTabPage *self,
                              const gchar *tooltip);

Sets the tooltip of `self` , marked up with the Pango text markup language.

If not set, HdyTabBar will use “title” as a tooltip instead.

#### Parameters

self | a HdyTabPage |
tooltip | the tooltip of `self` . | [nullable]

Since: 1.2

### hdy_tab_page_get_icon ()

    GIcon *
    hdy_tab_page_get_icon (HdyTabPage *self);

Gets the icon of `self` , see `hdy_tab_page_set_icon()`.

#### Parameters

self | a HdyTabPage |

#### Returns

the icon of `self` .

[transfer none][nullable]

Since: 1.2

### hdy_tab_page_set_icon ()

    void
    hdy_tab_page_set_icon (HdyTabPage *self,
                           GIcon *icon);

Sets the icon of `self` , displayed next to the title.

HdyTabBar will not show the icon if “loading” is set to `TRUE`, or if `self` is pinned and “indicator-icon” is set.

#### Parameters

self | a HdyTabPage |
icon | the icon of `self` . | [nullable]

Since: 1.2

### hdy_tab_page_get_loading ()

    gboolean
    hdy_tab_page_get_loading (HdyTabPage *self);

Gets whether `self` is loading, see `hdy_tab_page_set_loading()`.

#### Parameters

self | a HdyTabPage |

#### Returns

whether `self` is loading

Since: 1.2

### hdy_tab_page_set_loading ()

    void
    hdy_tab_page_set_loading (HdyTabPage *self,
                              gboolean loading);

Sets wether `self` is loading.

If set to `TRUE`, HdyTabBar will display a spinner in place of icon.

If `self` is pinned and “indicator-icon” is set, the loading status will not be visible.

#### Parameters

self | a HdyTabPage |
loading | whether `self` is loading |

Since: 1.2

### hdy_tab_page_get_indicator_icon ()

    GIcon *
    hdy_tab_page_get_indicator_icon (HdyTabPage *self);

Gets the indicator icon of `self` , see `hdy_tab_page_set_indicator_icon()`.

#### Parameters

self | a HdyTabPage |

#### Returns

the indicator icon of `self` .

[transfer none][nullable]

Since: 1.2

### hdy_tab_page_set_indicator_icon ()

    void
    hdy_tab_page_set_indicator_icon (HdyTabPage *self,
                                     GIcon *indicator_icon);

Sets the indicator icon of `self` .

A common use case is an audio or camera indicator in a web browser.

HdyTabPage will show it at the beginning of the tab, alongside icon representing “icon” or loading spinner.

If the page is pinned, the indicator will be shown instead of icon or spinner.

If “indicator-activatable” is set to `TRUE`, indicator icon can act as a button.

#### Parameters

self | a HdyTabPage |
indicator_icon | the indicator icon of `self` . | [nullable]

Since: 1.2

### hdy_tab_page_get_indicator_activatable ()

    gboolean
    hdy_tab_page_get_indicator_activatable
                                   (HdyTabPage *self);

Gets whether the indicator of `self` is activatable, see `hdy_tab_page_set_indicator_activatable()`.

#### Parameters

self | a HdyTabPage |

#### Returns

whether the indicator is activatable

Since: 1.2

### hdy_tab_page_set_indicator_activatable ()

    void
    hdy_tab_page_set_indicator_activatable
                                   (HdyTabPage *self,
                                    gboolean activatable);

sets whether the indicator of `self` is activatable.

If set to `TRUE`, “indicator-activated” will be emitted when the indicator is clicked.

If “indicator-icon” is not set, does nothing.

#### Parameters

self | a HdyTabPage |
activatable | whether the indicator is activatable |

Since: 1.2

### hdy_tab_page_get_needs_attention ()

    gboolean
    hdy_tab_page_get_needs_attention (HdyTabPage *self);

Gets whether `self` needs attention, see `hdy_tab_page_set_needs_attention()`.

#### Parameters

self | a HdyTabPage |

#### Returns

whether `self` needs attention

Since: 1.2

### hdy_tab_page_set_needs_attention ()

    void
    hdy_tab_page_set_needs_attention (HdyTabPage *self,
                                      gboolean needs_attention);

Sets whether `self` needs attention.

HdyTabBar will display a glow under the tab representing `self` if set to `TRUE`. If the tab is not visible, the corresponding edge of the tab bar will be highlighted.

#### Parameters

self | a HdyTabPage |
needs_attention | whether `self` needs attention |

Since: 1.2

### hdy_tab_view_new ()

    HdyTabView *
    hdy_tab_view_new (void);

Creates a new HdyTabView widget.

#### Returns

a new HdyTabView

Since: 1.2

### hdy_tab_view_get_n_pages ()

    gint
    hdy_tab_view_get_n_pages (HdyTabView *self);

Gets the number of pages in `self` .

#### Parameters

self | a HdyTabView |

#### Returns

the number of pages in `self`

Since: 1.2

### hdy_tab_view_get_n_pinned_pages ()

    gint
    hdy_tab_view_get_n_pinned_pages (HdyTabView *self);

Gets the number of pinned pages in `self` .

See `hdy_tab_view_set_page_pinned()`.

#### Parameters

self | a HdyTabView |

#### Returns

the number of pinned pages in `self`

Since: 1.2

### hdy_tab_view_get_is_transferring_page ()

    gboolean
    hdy_tab_view_get_is_transferring_page (HdyTabView *self);

Whether a page is being transferred.

Gets the value of “is-transferring-page” property.

#### Parameters

self | a HdyTabView |

#### Returns

whether a page is being transferred

Since: 1.2

### hdy_tab_view_get_selected_page ()

    HdyTabPage *
    hdy_tab_view_get_selected_page (HdyTabView *self);

Gets the currently selected page in `self` .

#### Parameters

self | a HdyTabView |

#### Returns

the selected page in `self` .

[transfer none][nullable]

Since: 1.2

### hdy_tab_view_set_selected_page ()

    void
    hdy_tab_view_set_selected_page (HdyTabView *self,
                                    HdyTabPage *selected_page);

Sets the currently selected page in `self` .

#### Parameters

self | a HdyTabView |
selected_page | a page in `self` |

Since: 1.2

### hdy_tab_view_select_previous_page ()

    gboolean
    hdy_tab_view_select_previous_page (HdyTabView *self);

Selects the page before the currently selected page.

If the first page was already selected, this function does nothing.

#### Parameters

self | a HdyTabView |

#### Returns

`TRUE` if the selected page was changed, `FALSE` otherwise

Since: 1.2

### hdy_tab_view_select_next_page ()

    gboolean
    hdy_tab_view_select_next_page (HdyTabView *self);

Selects the page after the currently selected page.

If the last page was already selected, this function does nothing.

#### Parameters

self | a HdyTabView |

#### Returns

`TRUE` if the selected page was changed, `FALSE` otherwise

Since: 1.2

### hdy_tab_view_get_default_icon ()

    GIcon *
    hdy_tab_view_get_default_icon (HdyTabView *self);

Gets default icon of `self` , see `hdy_tab_view_set_default_icon()`.

#### Parameters

self | a HdyTabView |

#### Returns

the default icon of `self` .

[transfer none]

Since: 1.2

### hdy_tab_view_set_default_icon ()

    void
    hdy_tab_view_set_default_icon (HdyTabView *self,
                                   GIcon *default_icon);

Sets default page icon for `self` .

If a page doesn't provide its own icon via “icon”, default icon may be used instead for contexts where having an icon is necessary.

HdyTabBar will use default icon for pinned tabs in case the page is not loading, doesn't have an icon and an indicator. Default icon is never used for tabs that aren't pinned.

By default, 'hdy-tab-icon-missing-symbolic' icon is used.

#### Parameters

self | a HdyTabView |
default_icon | the default icon |

Since: 1.2

### hdy_tab_view_get_menu_model ()

    GMenuModel *
    hdy_tab_view_get_menu_model (HdyTabView *self);

Gets the tab context menu model for `self` , see `hdy_tab_view_set_menu_model()`.

#### Parameters

self | a HdyTabView |

#### Returns

the tab context menu model for `self` .

[transfer none][nullable]

Since: 1.2

### hdy_tab_view_set_menu_model ()

    void
    hdy_tab_view_set_menu_model (HdyTabView *self,
                                 GMenuModel *menu_model);

Sets the tab context menu model for `self` .

When a context menu is shown for a tab, it will be constructed from the provided menu model. Use “setup-menu” signal to set up the menu actions for the particular tab.

#### Parameters

self | a HdyTabView |
menu_model | a menu model. | [nullable]

Since: 1.2

### hdy_tab_view_get_shortcut_widget ()

    GtkWidget *
    hdy_tab_view_get_shortcut_widget (HdyTabView *self);

Gets the shortcut widget for `self` , see `hdy_tab_view_set_shortcut_widget()`.

#### Parameters

self | a HdyTabView |

#### Returns

the shortcut widget for `self` .

[transfer none][nullable]

Since: 1.2

### hdy_tab_view_set_shortcut_widget ()

    void
    hdy_tab_view_set_shortcut_widget (HdyTabView *self,
                                      GtkWidget *widget);

Sets the shortcut widget for `self` .

Registers the following shortcuts on `widget` :

- Ctrl+Page Up - switch to the previous page

- Ctrl+Page Down - switch to the next page

- Ctrl+Home - switch to the first page

- Ctrl+End - switch to the last page

- Ctrl+Shift+Page Up - move the current page backward

- Ctrl+Shift+Page Down - move the current page forward

- Ctrl+Shift+Home - move the current page at the start

- Ctrl+Shift+End - move the current page at the end

- Ctrl+Tab - switch to the next page, with looping

- Ctrl+Shift+Tab - switch to the previous page, with looping

- Alt+1-9 - switch to pages 1-9

- Alt+0 - switch to page 10

These shortcuts are always available on `self` , this function is useful if they should be available globally.

#### Parameters

self | a HdyTabView |
widget | a shortcut widget. | [nullable]

Since: 1.2

### hdy_tab_view_set_page_pinned ()

    void
    hdy_tab_view_set_page_pinned (HdyTabView *self,
                                  HdyTabPage *page,
                                  gboolean pinned);

Pins or unpins `page` .

Pinned pages are guaranteed to be placed before all non-pinned pages; at any given moment the first “n-pinned-pages” pages in `self` are guaranteed to be pinned.

When a page is pinned or unpinned, it's automatically reordered: pinning a page moves it after other pinned pages; unpinning a page moves it before other non-pinned pages.

Pinned pages can still be reordered between each other.

HdyTabBar will display pinned pages in a compact form, never showing the title or close button, and only showing a single icon, selected in the following order:

1. “indicator-icon”

2. A spinner if “loading” is `TRUE`

3. “icon”

4. “default-icon”

Pinned pages cannot be closed by default, see “close-page” for how to override that behavior.

#### Parameters

self | a HdyTabView |
page | a page of `self` |
pinned | whether `page` should be pinned |

Since: 1.2

### hdy_tab_view_get_page ()

    HdyTabPage *
    hdy_tab_view_get_page (HdyTabView *self,
                           GtkWidget *child);

Gets the HdyTabPage object representing `child` .

#### Parameters

self | a HdyTabView |
child | a child in `self` |

#### Returns

the HdyTabPage representing `child` .

[transfer none]

Since: 1.2

### hdy_tab_view_get_nth_page ()

    HdyTabPage *
    hdy_tab_view_get_nth_page (HdyTabView *self,
                               gint position);

Gets the HdyTabPage representing the child at `position` .

#### Parameters

self | a HdyTabView |
position | the index of the page in `self` , starting from 0 |

#### Returns

the page object at `position` .

[transfer none]

Since: 1.2

### hdy_tab_view_get_page_position ()

    gint
    hdy_tab_view_get_page_position (HdyTabView *self,
                                    HdyTabPage *page);

Finds the position of `page` in `self` , starting from 0.

#### Parameters

self | a HdyTabView |
page | a page of `self` |

#### Returns

the position of `page` in `self`

Since: 1.2

### hdy_tab_view_add_page ()

    HdyTabPage *
    hdy_tab_view_add_page (HdyTabView *self,
                           GtkWidget *child,
                           HdyTabPage *parent);

Adds `child` to `self` with `parent` as the parent.

This function can be used to automatically position new pages, and to select the correct page when this page is closed while being selected (see `hdy_tab_view_close_page()`).

If `parent` is `NULL`, this function is equivalent to `hdy_tab_view_append()`.

#### Parameters

self | a HdyTabView |
child | a widget to add |
parent | a parent page for `child` , or `NULL`. | [nullable]

#### Returns

the page object representing `child` .

[transfer none]

Since: 1.2

### hdy_tab_view_insert ()

    HdyTabPage *
    hdy_tab_view_insert (HdyTabView *self,
                         GtkWidget *child,
                         gint position);

Inserts a non-pinned page at `position` .

It's an error to try to insert a page before a pinned page, in that case `hdy_tab_view_insert_pinned()` should be used instead.

#### Parameters

self | a HdyTabView |
child | a widget to add |
position | the position to add `child` at, starting from 0 |

#### Returns

the page object representing `child` .

[transfer none]

Since: 1.2

### hdy_tab_view_prepend ()

    HdyTabPage *
    hdy_tab_view_prepend (HdyTabView *self,
                          GtkWidget *child);

Inserts `child` as the first non-pinned page.

#### Parameters

self | a HdyTabView |
child | a widget to add |

#### Returns

the page object representing `child` .

[transfer none]

Since: 1.2

### hdy_tab_view_append ()

    HdyTabPage *
    hdy_tab_view_append (HdyTabView *self,
                         GtkWidget *child);

Inserts `child` as the last non-pinned page.

#### Parameters

self | a HdyTabView |
child | a widget to add |

#### Returns

the page object representing `child` .

[transfer none]

Since: 1.2

### hdy_tab_view_insert_pinned ()

    HdyTabPage *
    hdy_tab_view_insert_pinned (HdyTabView *self,
                                GtkWidget *child,
                                gint position);

Inserts a pinned page at `position` .

It's an error to try to insert a pinned page after a non-pinned page, in that case `hdy_tab_view_insert()` should be used instead.

#### Parameters

self | a HdyTabView |
child | a widget to add |
position | the position to add `child` at, starting from 0 |

#### Returns

the page object representing `child` .

[transfer none]

Since: 1.2

### hdy_tab_view_prepend_pinned ()

    HdyTabPage *
    hdy_tab_view_prepend_pinned (HdyTabView *self,
                                 GtkWidget *child);

Inserts `child` as the first pinned page.

#### Parameters

self | a HdyTabView |
child | a widget to add |

#### Returns

the page object representing `child` .

[transfer none]

Since: 1.2

### hdy_tab_view_append_pinned ()

    HdyTabPage *
    hdy_tab_view_append_pinned (HdyTabView *self,
                                GtkWidget *child);

Inserts `child` as the last pinned page.

#### Parameters

self | a HdyTabView |
child | a widget to add |

#### Returns

the page object representing `child` .

[transfer none]

Since: 1.2

### hdy_tab_view_close_page ()

    void
    hdy_tab_view_close_page (HdyTabView *self,
                             HdyTabPage *page);

Requests to close `page` .

Calling this function will result in “close-page” signal being emitted for `page` . Closing the page can then be confirmed or denied via `hdy_tab_view_close_page_finish()`.

If the page is waiting for a `hdy_tab_view_close_page_finish()` call, this function will do nothing.

The default handler for “close-page” will immediately confirm closing the page if it's non-pinned, or reject it if it's pinned. This behavior can be changed by registering your own handler for that signal.

If `page` was selected, another page will be selected instead:

If the “parent” value is `NULL`, the next page will be selected when possible, or if the page was already last, the previous page will be selected instead.

If it's not `NULL`, the previous page will be selected if it's a descendant (possibly indirect) of the parent. If both the previous page and the parent are pinned, the parent will be selected instead.

#### Parameters

self | a HdyTabView |
page | a page of `self` |

Since: 1.2

### hdy_tab_view_close_page_finish ()

    void
    hdy_tab_view_close_page_finish (HdyTabView *self,
                                    HdyTabPage *page,
                                    gboolean confirm);

Completes a `hdy_tab_view_close_page()` call for `page` .

If `confirm` is `TRUE`, `page` will be closed. If it's `FALSE`, ite will be reverted to its previous state and `hdy_tab_view_close_page()` can be called for it again.

This function should not be called unless a custom handler for “close-page” is used.

#### Parameters

self | a HdyTabView |
page | a page of `self` |
confirm | whether to confirm or deny closing `page` |

Since: 1.2

### hdy_tab_view_close_other_pages ()

    void
    hdy_tab_view_close_other_pages (HdyTabView *self,
                                    HdyTabPage *page);

Requests to close all pages other than `page` .

#### Parameters

self | a HdyTabView |
page | a page of `self` |

Since: 1.2

### hdy_tab_view_close_pages_before ()

    void
    hdy_tab_view_close_pages_before (HdyTabView *self,
                                     HdyTabPage *page);

Requests to close all pages before `page` .

#### Parameters

self | a HdyTabView |
page | a page of `self` |

Since: 1.2

### hdy_tab_view_close_pages_after ()

    void
    hdy_tab_view_close_pages_after (HdyTabView *self,
                                    HdyTabPage *page);

Requests to close all pages after `page` .

#### Parameters

self | a HdyTabView |
page | a page of `self` |

Since: 1.2

### hdy_tab_view_reorder_page ()

    gboolean
    hdy_tab_view_reorder_page (HdyTabView *self,
                               HdyTabPage *page,
                               gint position);

Reorders `page` to `position` .

It's a programmer error to try to reorder a pinned page after a non-pinned one, or a non-pinned page before a pinned one.

#### Parameters

self | a HdyTabView |
page | a page of `self` |
position | the position to insert the page at, starting at 0 |

#### Returns

`TRUE` if `page` was moved, `FALSE` otherwise

Since: 1.2

### hdy_tab_view_reorder_backward ()

    gboolean
    hdy_tab_view_reorder_backward (HdyTabView *self,
                                   HdyTabPage *page);

Reorders `page` to before its previous page if possible.

#### Parameters

self | a HdyTabView |
page | a page of `self` |

#### Returns

`TRUE` if `page` was moved, `FALSE` otherwise

Since: 1.2

### hdy_tab_view_reorder_forward ()

    gboolean
    hdy_tab_view_reorder_forward (HdyTabView *self,
                                  HdyTabPage *page);

Reorders `page` to after its next page if possible.

#### Parameters

self | a HdyTabView |
page | a page of `self` |

#### Returns

`TRUE` if `page` was moved, `FALSE` otherwise

Since: 1.2

### hdy_tab_view_reorder_first ()

    gboolean
    hdy_tab_view_reorder_first (HdyTabView *self,
                                HdyTabPage *page);

Reorders `page` to the first possible position.

#### Parameters

self | a HdyTabView |
page | a page of `self` |

#### Returns

`TRUE` if `page` was moved, `FALSE` otherwise

Since: 1.2

### hdy_tab_view_reorder_last ()

    gboolean
    hdy_tab_view_reorder_last (HdyTabView *self,
                               HdyTabPage *page);

Reorders `page` to the last possible position.

#### Parameters

self | a HdyTabView |
page | a page of `self` |

#### Returns

`TRUE` if `page` was moved, `FALSE` otherwise

Since: 1.2

### hdy_tab_view_transfer_page ()

    void
    hdy_tab_view_transfer_page (HdyTabView *self,
                                HdyTabPage *page,
                                HdyTabView *other_view,
                                gint position);

Transfers `page` from `self` to `other_view` . The `page` object will be reused.

It's a programmer error to try to insert a pinned page after a non-pinned one, or a non-pinned page before a pinned one.

#### Parameters

self | a HdyTabView |
page | a page of `self` |
other_view | the tab view to transfer the page to |
position | the position to insert the page at, starting at 0 |

Since: 1.2

### hdy_tab_view_get_pages ()

    GListModel *
    hdy_tab_view_get_pages (HdyTabView *self);

Returns a GListModel containing the pages of `self` . This model can be used to keep an up to date view of the pages.

#### Parameters

self | a HdyTabView |

#### Returns

the model containing pages of `self` .

[transfer none]

Since: 1.2

## Types and Values

### HDY_TYPE_TAB_PAGE

    #define HDY_TYPE_TAB_PAGE (hdy_tab_page_get_type())

### HDY_TYPE_TAB_VIEW

    #define HDY_TYPE_TAB_VIEW (hdy_tab_view_get_type())

### HdyTabPage

    typedef struct _HdyTabPage HdyTabPage;

### HdyTabView

    typedef struct _HdyTabView HdyTabView;

## Property Details

### The `“child”` property

      “child”                    GtkWidget *

The child of the page.

Owner: HdyTabPage

Flags: Read / Write / Construct Only

Since: 1.2

### The `“icon”` property

      “icon”                     GIcon *

The icon of the page, displayed next to the title.

HdyTabBar will not show the icon if “loading” is set to `TRUE`, or if the page is pinned and “indicator-icon” is set.

Owner: HdyTabPage

Flags: Read / Write

Since: 1.2

### The `“indicator-activatable”` property

      “indicator-activatable”    gboolean

Whether the indicator icon is activatable.

If set to `TRUE`, “indicator-activated” will be emitted when the indicator icon is clicked.

If “indicator-icon” is not set, does nothing.

Owner: HdyTabPage

Flags: Read / Write

Default value: FALSE

Since: 1.2

### The `“indicator-icon”` property

      “indicator-icon”           GIcon *

An indicator icon for the page.

A common use case is an audio or camera indicator in a web browser.

HdyTabPage will show it at the beginning of the tab, alongside icon representing “icon” or loading spinner.

If the page is pinned, the indicator will be shown instead of icon or spinner.

If “indicator-activatable” is set to `TRUE`, the indicator icon can act as a button.

Owner: HdyTabPage

Flags: Read / Write

Since: 1.2

### The `“loading”` property

      “loading”                  gboolean

Whether the page is loading.

If set to `TRUE`, HdyTabBar will display a spinner in place of icon.

If the page is pinned and “indicator-icon” is set, the loading status will not be visible.

Owner: HdyTabPage

Flags: Read / Write

Default value: FALSE

Since: 1.2

### The `“needs-attention”` property

      “needs-attention”          gboolean

Whether the page needs attention.

HdyTabBar will display a glow under the tab representing the page if set to `TRUE`. If the tab is not visible, the corresponding edge of the tab bar will be highlighted.

Owner: HdyTabPage

Flags: Read / Write

Default value: FALSE

Since: 1.2

### The `“parent”` property

      “parent”                   HdyTabPage *

The parent page of the page.

See `hdy_tab_view_add_page()` and `hdy_tab_view_close_page()`.

Owner: HdyTabPage

Flags: Read / Write / Construct Only

Since: 1.2

### The `“pinned”` property

      “pinned”                   gboolean

Whether the page is pinned. See `hdy_tab_view_set_page_pinned()`.

Owner: HdyTabPage

Flags: Read

Default value: FALSE

Since: 1.2

### The `“selected”` property

      “selected”                 gboolean

Whether the page is selected.

Owner: HdyTabPage

Flags: Read

Default value: FALSE

Since: 1.2

### The `“title”` property

      “title”                    char *

The title of the page.

HdyTabBar will display it in the center of the tab unless it's pinned, and will use it as a tooltip unless “tooltip” is set.

Owner: HdyTabPage

Flags: Read / Write

Default value: NULL

Since: 1.2

### The `“tooltip”` property

      “tooltip”                  char *

The tooltip of the page, marked up with the Pango text markup language.

If not set, HdyTabBar will use “title” as a tooltip instead.

Owner: HdyTabPage

Flags: Read / Write

Default value: NULL

Since: 1.2

### The `“default-icon”` property

      “default-icon”             GIcon *

Default page icon.

If a page doesn't provide its own icon via “icon”, default icon may be used instead for contexts where having an icon is necessary.

HdyTabBar will use default icon for pinned tabs in case the page is not loading, doesn't have an icon and an indicator. Default icon is never used for tabs that aren't pinned.

Owner: HdyTabView

Flags: Read / Write

Since: 1.2

### The `“is-transferring-page”` property

      “is-transferring-page”     gboolean

Whether a page is being transferred.

This property will be set to `TRUE` when a drag-n-drop tab transfer starts on any HdyTabView, and to `FALSE` after it ends.

During the transfer, children cannot receive pointer input and a tab can be safely dropped on the tab view.

Owner: HdyTabView

Flags: Read

Default value: FALSE

Since: 1.2

### The `“menu-model”` property

      “menu-model”               GMenuModel *

Tab context menu model.

When a context menu is shown for a tab, it will be constructed from the provided menu model. Use “setup-menu” signal to set up the menu actions for the particular tab.

Owner: HdyTabView

Flags: Read / Write

Since: 1.2

### The `“n-pages”` property

      “n-pages”                  int

The number of pages in the tab view.

Owner: HdyTabView

Flags: Read

Allowed values: >= 0

Default value: 0

Since: 1.2

### The `“n-pinned-pages”` property

      “n-pinned-pages”           int

The number of pinned pages in the tab view.

See `hdy_tab_view_set_page_pinned()`.

Owner: HdyTabView

Flags: Read

Allowed values: >= 0

Default value: 0

Since: 1.2

### The `“selected-page”` property

      “selected-page”            HdyTabPage *

The currently selected page.

Owner: HdyTabView

Flags: Read / Write

Since: 1.2

### The `“shortcut-widget”` property

      “shortcut-widget”          GtkWidget *

Tab shortcut widget, has the following shortcuts:

- Ctrl+Page Up - switch to the previous page

- Ctrl+Page Down - switch to the next page

- Ctrl+Home - switch to the first page

- Ctrl+End - switch to the last page

- Ctrl+Shift+Page Up - move the current page backward

- Ctrl+Shift+Page Down - move the current page forward

- Ctrl+Shift+Home - move the current page at the start

- Ctrl+Shift+End - move the current page at the end

- Ctrl+Tab - switch to the next page, with looping

- Ctrl+Shift+Tab - switch to the previous page, with looping

- Alt+1-9 - switch to pages 1-9

- Alt+0 - switch to page 10

These shortcuts are always available on `self` , this property is useful if they should be available globally.

Owner: HdyTabView

Flags: Read / Write

Since: 1.2

## Signal Details

### The `“close-page”` signal

    gboolean
    user_function (HdyTabView *self,
                   HdyTabPage *page,
                   gpointer    user_data)

This signal is emitted after `hdy_tab_view_close_page()` has been called for `page` .

The handler is expected to call `hdy_tab_view_close_page_finish()` to confirm or reject the closing.

The default handler will immediately confirm closing for non-pinned pages, or reject it for pinned pages, equivalent to the following example:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    static gboolean
    close_page_cb (HdyTabView *view,
                   HdyTabPage *page,
                   gpointer    user_data)
    {
      hdy_tab_view_close_page_finish (view, page, !hdy_tab_page_get_pinned (page));

      return GDK_EVENT_STOP;
    }

The `hdy_tab_view_close_page_finish()` doesn't have to happen during the handler, so can be used to do asynchronous checks before confirming the closing.

A typical reason to connect to this signal is to show a confirmation dialog for closing a tab.

#### Parameters

self | a HdyTabView |
page | a page of `self` |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.2

### The `“create-window”` signal

    HdyTabView*
    user_function (HdyTabView *self,
                   gpointer    user_data)

This signal is emitted when a tab is dropped onto desktop and should be transferred into a new window.

The signal handler is expected to create a new window, position it as needed and return its HdyTabView that the page will be transferred into.

#### Parameters

self | a HdyTabView |
user_data | user data set when the signal handler was connected. |

#### Returns

the HdyTabView from the new window.

[transfer none][nullable]

Flags: Run Last

Since: 1.2

### The `“indicator-activated”` signal

    void
    user_function (HdyTabView *self,
                   HdyTabPage *page,
                   gpointer    user_data)

This signal is emitted after the indicator icon on `page` has been activated.

See “indicator-icon” and “indicator-activatable”.

#### Parameters

self | a HdyTabView |
page | a page of `self` |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.2

### The `“page-attached”` signal

    void
    user_function (HdyTabView *self,
                   HdyTabPage *page,
                   int         position,
                   gpointer    user_data)

This signal is emitted when a page has been created or transferred to `self` .

A typical reason to connect to this signal would be to connect to page signals for things such as updating window title.

#### Parameters

self | a HdyTabView |
page | a page of `self` |
position | the position of the page, starting from 0 |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.2

### The `“page-detached”` signal

    void
    user_function (HdyTabView *self,
                   HdyTabPage *page,
                   int         position,
                   gpointer    user_data)

This signal is emitted when a page has been removed or transferred to another view.

A typical reason to connect to this signal would be to disconnect signal handlers connected in the “page-attached” handler.

It is important not to try and destroy the page child in the handler of this function as the child might merely be moved to another window; use child dispose handler for that or do it in sync with your `hdy_tab_view_close_page_finish()` calls.

#### Parameters

self | a HdyTabView |
page | a page of `self` |
position | the position of the removed page, starting from 0 |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.2

### The `“page-reordered”` signal

    void
    user_function (HdyTabView *self,
                   HdyTabPage *page,
                   int         position,
                   gpointer    user_data)

This signal is emitted after `page` has been reordered to `position` .

#### Parameters

self | a HdyTabView |
page | a page of `self` |
position | the position `page` was moved to, starting at 0 |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.2

### The `“setup-menu”` signal

    void
    user_function (HdyTabView *self,
                   HdyTabPage *page,
                   gpointer    user_data)

This signal is emitted before a context menu is opened for `page` , and after it's closed, in the latter case the `page` will be set to `NULL`.

It can be used to set up menu actions before showing the menu, for example disable actions not applicable to `page` .

#### Parameters

self | a HdyTabView |
page | a page of `self` , or `NULL` |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 1.2

## See Also

HdyTabBar