mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-09-10 22:11:52 +00:00
insert new tab after current on middle click
This commit is contained in:
parent
29588c0d0b
commit
18d0da99f2
@ -120,7 +120,7 @@ impl Browser {
|
|||||||
action_tab_append.connect_activate({
|
action_tab_append.connect_activate({
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
move |_, _| {
|
move |_, _| {
|
||||||
window.tab_append();
|
window.tab_append(None);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -74,8 +74,8 @@ impl Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn tab_append(&self) {
|
pub fn tab_append(&self, position: Option<i32>) {
|
||||||
self.tab.append();
|
self.tab.append(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn tab_page_navigation_base(&self) {
|
pub fn tab_page_navigation_base(&self) {
|
||||||
|
@ -98,6 +98,10 @@ impl Tab {
|
|||||||
action_tab_page_navigation_reload.clone(),
|
action_tab_page_navigation_reload.clone(),
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
// Options
|
// Options
|
||||||
|
match gobject.selected_page() {
|
||||||
|
Some(page) => Some(gobject.page_position(&page) + 1),
|
||||||
|
None => None,
|
||||||
|
},
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
@ -133,7 +137,7 @@ impl Tab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn append(&self) -> Arc<Item> {
|
pub fn append(&self, position: Option<i32>) -> Arc<Item> {
|
||||||
// Init new tab item
|
// Init new tab item
|
||||||
let item = Item::new_arc(
|
let item = Item::new_arc(
|
||||||
self.gobject(),
|
self.gobject(),
|
||||||
@ -146,6 +150,7 @@ impl Tab {
|
|||||||
self.action_tab_page_navigation_reload.clone(),
|
self.action_tab_page_navigation_reload.clone(),
|
||||||
self.action_update.clone(),
|
self.action_update.clone(),
|
||||||
// Options
|
// Options
|
||||||
|
position,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
@ -328,7 +333,7 @@ impl Tab {
|
|||||||
pub fn init(&self) {
|
pub fn init(&self) {
|
||||||
// Append just one blank page if no tabs available after last session restore
|
// Append just one blank page if no tabs available after last session restore
|
||||||
if self.index.borrow().is_empty() {
|
if self.index.borrow().is_empty() {
|
||||||
self.append();
|
self.append(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO other/child features..
|
// @TODO other/child features..
|
||||||
|
@ -35,6 +35,7 @@ impl Item {
|
|||||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||||
action_update: Arc<SimpleAction>,
|
action_update: Arc<SimpleAction>,
|
||||||
// Options
|
// Options
|
||||||
|
position: Option<i32>,
|
||||||
is_pinned: bool,
|
is_pinned: bool,
|
||||||
is_selected: bool,
|
is_selected: bool,
|
||||||
) -> Arc<Self> {
|
) -> Arc<Self> {
|
||||||
@ -58,6 +59,7 @@ impl Item {
|
|||||||
tab_view,
|
tab_view,
|
||||||
page.gobject(),
|
page.gobject(),
|
||||||
None,
|
None,
|
||||||
|
position,
|
||||||
is_pinned,
|
is_pinned,
|
||||||
is_selected,
|
is_selected,
|
||||||
); // @TODO
|
); // @TODO
|
||||||
@ -149,6 +151,7 @@ impl Item {
|
|||||||
action_tab_page_navigation_reload.clone(),
|
action_tab_page_navigation_reload.clone(),
|
||||||
action_update.clone(),
|
action_update.clone(),
|
||||||
// Options
|
// Options
|
||||||
|
None,
|
||||||
record.is_pinned,
|
record.is_pinned,
|
||||||
record.is_selected,
|
record.is_selected,
|
||||||
);
|
);
|
||||||
|
@ -20,10 +20,14 @@ impl Widget {
|
|||||||
tab_view: &TabView,
|
tab_view: &TabView,
|
||||||
page: &Box,
|
page: &Box,
|
||||||
title: Option<&str>,
|
title: Option<&str>,
|
||||||
|
position: Option<i32>,
|
||||||
is_pinned: bool,
|
is_pinned: bool,
|
||||||
is_selected: bool,
|
is_selected: bool,
|
||||||
) -> Arc<Self> {
|
) -> Arc<Self> {
|
||||||
let gobject = tab_view.append(page);
|
let gobject = match position {
|
||||||
|
Some(number) => tab_view.insert(page, number),
|
||||||
|
None => tab_view.append(page),
|
||||||
|
};
|
||||||
|
|
||||||
gobject.set_keyword(keyword);
|
gobject.set_keyword(keyword);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user