mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
add pin action to context menu
This commit is contained in:
parent
2aed6691b9
commit
998f51e0fc
4 changed files with 30 additions and 18 deletions
|
|
@ -32,7 +32,7 @@ impl Widget {
|
|||
|
||||
// Actions
|
||||
|
||||
/// Close page at given `position`, `None` to close selected page
|
||||
/// Close page at given `position`, `None` to close selected page (if available)
|
||||
/// * this action includes `pinned` pages, to prevent that:
|
||||
/// * deactivate [SimpleAction](https://docs.gtk.org/gio/class.SimpleAction.html) outside if selected page should not be closed
|
||||
/// * use native [TabView](https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.TabView.html) API with `GObject` reference getter
|
||||
|
|
@ -54,6 +54,13 @@ impl Widget {
|
|||
}
|
||||
}
|
||||
|
||||
/// Toggle pin for page at given `position`, `None` to pin selected page (if available)
|
||||
pub fn pin(&self, position: Option<i32>) {
|
||||
if let Some(page) = self.page(position) {
|
||||
self.gobject.set_page_pinned(&page, !page.is_pinned()); // toggle
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
||||
pub fn current_page_keyword(&self) -> Option<GString> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue