It derives from <GtkWidget>.
A dynamic tabbed container.
<AdwTabView> 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 switcher and relies on external
widgets for that, such as TabBar, TabOverview and
TabButton.
<AdwTabView> maintains a TabPage object for
each page, which holds additional per-page properties. You can obtain
the <AdwTabPage> for a page with
TabView.get_page, and as the return value for
TabView.append and other functions for adding children.
<AdwTabView> 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.
<AdwTabView> adds a number of global page
switching and reordering shortcuts. The TabView:shortcuts
property can be used to manage them.
See TabViewShortcuts for the list of the available shortcuts. All
of the shortcuts are enabled by default.
TabView.add_shortcuts and TabView.remove_shortcuts can be
used to manage shortcuts in a convenient way, for example:
adw_tab_view_remove_shortcuts (view, ADW_TAB_VIEW_SHORTCUT_CONTROL_HOME |
ADW_TAB_VIEW_SHORTCUT_CONTROL_END);
<AdwTabView> has a main CSS node with the name
tabview.
<AdwTabView> uses the
Gtk.AccessibleRole.tab-panel role for the tab pages which are the
accessible parent objects of the child widgets.
Default page icon.
If a page doesn’t provide its own icon via TabPage:icon, a
default icon may be used instead for contexts where having an icon is
necessary.
TabBar 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.
TabOverview will use default icon for pages with missing
thumbnails.
By default, the adw-tab-icon-missing-symbolic icon is used.
Its value is a <GIcon>, or #f.
Set it with (set! (tab-view:default-icon self) value).
Whether a page is being transferred.
This property will be set to TRUE when a drag-n-drop tab transfer
starts on any <AdwTabView>, 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.
Its value is a boolean.
It is read only.
Tab context menu model.
When a context menu is shown for a tab, it will be constructed from the
provided menu model. Use the "setup-menu" signal to set up the
menu actions for the particular tab.
Its value is a <GMenuModel>, or #f.
Set it with (set! (tab-view:menu-model self) value).
The number of pages in the tab view.
Its value is a 32-bit integer.
It is read only.
The number of pinned pages in the tab view.
See TabView.set_page_pinned.
Its value is a 32-bit integer.
It is read only.
A list model with the tab view’s pages.
This can be used to keep an up-to-date view.
The model implements <GtkSectionModel>,
with one section for pinned pages and one for the rest of the pages.
It also implements <GtkSelectionModel>
and can be used to track and change the selected page.
Its value is a <GtkSelectionModel>, or
#f.
It is read only.
The currently selected page.
Its value is a <AdwTabPage>, or #f.
Set it with (set! (tab-view:selected-page self) value).
The enabled shortcuts.
See TabViewShortcuts for the list of the available shortcuts. All
of the shortcuts are enabled by default.
TabView.add_shortcuts and TabView.remove_shortcuts provide
a convenient way to manage individual shortcuts.
Its value is a <AdwTabViewShortcuts> (or,
to set it, a list of its symbols, or one of them).
Set it with (set! (tab-view:shortcuts self) value).
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 TabView.close_page).
If parent is NULL, this function is equivalent to
TabView.append.
Passed: a <AdwTabView>.
a tab view
Passed: a <GtkWidget>.
a widget to add
Passed, or left out: a <AdwTabPage>, or #f.
a parent page for child
Returned: a <AdwTabPage>.
the page object representing child
Adds shortcuts for self.
See TabView:shortcuts for details.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabViewShortcuts>, or a
list of its symbols, or one of them.
the shortcuts to add
Inserts child as the last non-pinned page.
Passed: a <AdwTabView>.
a tab view
Passed: a <GtkWidget>.
a widget to add
Returned: a <AdwTabPage>.
the page object representing child
Inserts child as the last pinned page.
Passed: a <AdwTabView>.
a tab view
Passed: a <GtkWidget>.
a widget to add
Returned: a <AdwTabPage>.
the page object representing child
Requests to close all pages other than page.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Requests to close page.
Calling this function will result in the "close-page" signal
being emitted for page. Closing the page can then be confirmed or
denied via TabView.close_page_finish.
If the page is waiting for a TabView.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 TabPage: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.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Completes a TabView.close_page call for page.
If confirm is TRUE, page will be closed. If it’s
FALSE, it will be reverted to its previous state and
TabView.close_page can be called for it again.
This function should not be called unless a custom handler for
"close-page" is used.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Passed: a boolean.
whether to confirm or deny closing page
Requests to close all pages after page.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Requests to close all pages before page.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Gets the default icon of self.
Passed: a <AdwTabView>.
a tab view
Returned: a <GIcon>.
the default icon of self.
Whether a page is being transferred.
The corresponding property will be set to TRUE when a drag-n-drop
tab transfer starts on any <AdwTabView>, 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.
Passed: a <AdwTabView>.
a tab view
Returned: a boolean.
whether a page is being transferred
Gets the tab context menu model for self.
Passed: a <AdwTabView>.
a tab view
Returned: a <GMenuModel>, or #f.
the tab context menu model for self
Gets the number of pages in self.
Passed: a <AdwTabView>.
a tab view
Returned: a 32-bit integer.
the number of pages in self
Gets the number of pinned pages in self.
See TabView.set_page_pinned.
Passed: a <AdwTabView>.
a tab view
Returned: a 32-bit integer.
the number of pinned pages in self
Gets the TabPage representing the child at position.
Passed: a <AdwTabView>.
a tab view
Passed: a 32-bit integer.
the index of the page in self, starting from 0
Returned: a <AdwTabPage>.
the page object at position
Gets the TabPage object representing child.
Passed: a <AdwTabView>.
a tab view
Passed: a <GtkWidget>.
a child in self
Returned: a <AdwTabPage>.
the page object for child
Finds the position of page in self, starting from 0.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Returned: a 32-bit integer.
the position of page in self
Returns a <GListModel> that contains the
pages of self.
This can be used to keep an up-to-date view.
The model implements <GtkSectionModel>,
with one section for pinned pages and one for the rest of the pages.
It also implements <GtkSelectionModel>
and can be used to track and change the selected page.
Passed: a <AdwTabView>.
a tab view
Returned: a <GtkSelectionModel>.
a <GtkSelectionModel> for the pages of
self
Gets the currently selected page in self.
Passed: a <AdwTabView>.
a tab view
Returned: a <AdwTabPage>, or #f.
the selected page
Gets the enabled shortcuts for self.
Passed: a <AdwTabView>.
a tab view
Returned: a <AdwTabViewShortcuts>.
the shortcut mask
Inserts a non-pinned page at position.
It’s an error to try to insert a page before a pinned page, in that case
TabView.insert_pinned should be used instead.
Passed: a <AdwTabView>.
a tab view
Passed: a <GtkWidget>.
a widget to add
Passed: a 32-bit integer.
the position to add child at, starting from 0
Returned: a <AdwTabPage>.
the page object representing child
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 TabView.insert should be used instead.
Passed: a <AdwTabView>.
a tab view
Passed: a <GtkWidget>.
a widget to add
Passed: a 32-bit integer.
the position to add child at, starting from 0
Returned: a <AdwTabPage>.
the page object representing child
Invalidates thumbnails for all pages in self.
This is a convenience method, equivalent to calling
TabPage.invalidate_thumbnail on each page.
Passed: a <AdwTabView>.
a tab view
Creates a new <AdwTabView>.
Returned: a <AdwTabView>.
the newly created <AdwTabView>
Inserts child as the first non-pinned page.
Passed: a <AdwTabView>.
a tab view
Passed: a <GtkWidget>.
a widget to add
Returned: a <AdwTabPage>.
the page object representing child
Inserts child as the first pinned page.
Passed: a <AdwTabView>.
a tab view
Passed: a <GtkWidget>.
a widget to add
Returned: a <AdwTabPage>.
the page object representing child
Removes shortcuts from self.
See TabView:shortcuts for details.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabViewShortcuts>, or a
list of its symbols, or one of them.
the shortcuts to remove
Reorders page to before its previous page if possible.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Returned: a boolean.
whether page was moved
Reorders page to the first possible position.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Returned: a boolean.
whether page was moved
Reorders page to after its next page if possible.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Returned: a boolean.
whether page was moved
Reorders page to the last possible position.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Returned: a boolean.
whether page was moved
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.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Passed: a 32-bit integer.
the position to insert the page at, starting at 0
Returned: a boolean.
whether page was moved
Selects the page after the currently selected page.
If the last page was already selected, this function does nothing.
Passed: a <AdwTabView>.
a tab view
Returned: a boolean.
whether the selected page was changed
Selects the page before the currently selected page.
If the first page was already selected, this function does nothing.
Passed: a <AdwTabView>.
a tab view
Returned: a boolean.
whether the selected page was changed
Sets the default page icon for self.
If a page doesn’t provide its own icon via TabPage:icon, a
default icon may be used instead for contexts where having an icon is
necessary.
TabBar 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.
TabOverview will use default icon for pages with missing
thumbnails.
By default, the adw-tab-icon-missing-symbolic icon is used.
Passed: a <AdwTabView>.
a tab view
Passed: a <GIcon>.
the default icon
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 the "setup-menu" signal to set up the
menu actions for the particular tab.
Passed: a <AdwTabView>.
a tab view
Passed, or left out: a <GMenuModel>, or
#f.
a menu model
Pins or unpins page.
Pinned pages are guaranteed to be placed before all non-pinned pages; at
any given moment the first TabView: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.
TabBar 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:
TabPage:indicator-icon
TabPage:loading is TRUE
TabPage:icon
TabView:default-icon
TabOverview will not show a thumbnail for pinned pages, and
replace the close button with an unpin button. Unlike
<AdwTabBar>, it will still display the page’s
title, icon and indicator separately.
Pinned pages cannot be closed by default, see "close-page" for
how to override that behavior.
Changes the value of the TabPage:pinned property.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Passed: a boolean.
whether page should be pinned
Sets the currently selected page in self.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page in self
Sets the enabled shortcuts for self.
See TabViewShortcuts for the list of the available shortcuts. All
of the shortcuts are enabled by default.
TabView.add_shortcuts and TabView.remove_shortcuts provide
a convenient way to manage individual shortcuts.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabViewShortcuts>, or a
list of its symbols, or one of them.
the new shortcuts
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.
Passed: a <AdwTabView>.
a tab view
Passed: a <AdwTabPage>.
a page of self
Passed: a <AdwTabView>.
the tab view to transfer the page to
Passed: a 32-bit integer.
the position to insert the page at, starting at 0
Connect a handler with (connect object tab-view:close-page
handler). It is called as (handler self page) ⇒ %return.
Emitted after TabView.close_page has been called for page.
The handler is expected to call TabView.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:
static gboolean
close_page_cb (AdwTabView *view,
AdwTabPage *page,
gpointer user_data)
{
adw_tab_view_close_page_finish (view, page, !adw_tab_page_get_pinned (page));
return GDK_EVENT_STOP;
}
The TabView.close_page_finish call doesn’t have to happen inside
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.
The signal handler should return Gdk.EVENT_STOP to stop
propagation or Gdk.EVENT_PROPAGATE to invoke the default handler.
Passed: a <AdwTabView>.
Passed: a <AdwTabPage>.
a page of self
Returned: a boolean.
whether propagation should be stopped
Connect a handler with (connect object tab-view:create-window
handler). It is called as (handler self) ⇒ %return.
Emitted when a tab should be transferred into a new window.
This can happen after a tab has been dropped on desktop.
The signal handler is expected to create a new window, position it as
needed and return its <AdwTabView> that the page
will be transferred into.
Passed: a <AdwTabView>.
Returned: a <AdwTabView>, or #f.
the <AdwTabView> from the new window
Connect a handler with (connect object
tab-view:indicator-activated handler). It is called as (handler
self page).
Emitted after the indicator icon on page has been activated.
See TabPage:indicator-icon and
TabPage:indicator-activatable.
Passed: a <AdwTabView>.
Passed: a <AdwTabPage>.
a page of self
Connect a handler with (connect object tab-view:page-attached
handler). It is called as (handler self page position).
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.
Passed: a <AdwTabView>.
Passed: a <AdwTabPage>.
a page of self
Passed: a 32-bit integer.
the position of the page, starting from 0
Connect a handler with (connect object tab-view:page-detached
handler). It is called as (handler self page position).
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
TabView.close_page_finish calls.
Passed: a <AdwTabView>.
Passed: a <AdwTabPage>.
a page of self
Passed: a 32-bit integer.
the position of the removed page, starting from 0
Connect a handler with (connect object tab-view:page-reordered
handler). It is called as (handler self page position).
Emitted after page has been reordered to position.
Passed: a <AdwTabView>.
Passed: a <AdwTabPage>.
a page of self
Passed: a 32-bit integer.
the position page was moved to, starting at 0
Connect a handler with (connect object tab-view:setup-menu
handler). It is called as (handler self page).
Emitted when a context menu is opened or closed for page.
If the menu has been closed, 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.
Passed: a <AdwTabView>.
Passed: a <AdwTabPage>, or #f.
a page of self