Browse Source

enable tab append, rename struct members

master
yggverse 2 months ago
parent
commit
a1aaebdb7e
  1. 6
      src/app/browser/window/tab.rs
  2. 4
      src/app/browser/window/tab/item.rs
  3. 16
      src/app/browser/window/tab/item/page.rs

6
src/app/browser/window/tab.rs

@ -96,10 +96,8 @@ impl Tab {
// Register dynamically created tab components in the HashMap index // Register dynamically created tab components in the HashMap index
self.index.borrow_mut().insert(item.id(), item.clone()); self.index.borrow_mut().insert(item.id(), item.clone());
// Append new Notebook page // Append new page
/* @TODO self.widget.gobject().add_page(item.gobject(), None);
self.widget
.append(item.label(), item.page(), item.is_initially_current()); */
if page_navigation_request_text.is_none() { if page_navigation_request_text.is_none() {
item.page_navigation_request_grab_focus(); // @TODO item.page_navigation_request_grab_focus(); // @TODO

4
src/app/browser/window/tab/item.rs

@ -192,8 +192,8 @@ impl Item {
self.is_initially_current self.is_initially_current
} }
pub fn page(&self) -> &Box { pub fn gobject(&self) -> &Box {
&self.page.widget() // @TODO &self.page.gobject()
} }
pub fn page_title(&self) -> Option<GString> { pub fn page_title(&self) -> Option<GString> {

16
src/app/browser/window/tab/item/page.rs

@ -22,7 +22,7 @@ use std::{cell::RefCell, path::Path, sync::Arc};
pub struct Page { pub struct Page {
// GTK // GTK
widget: Box, gobject: Box,
// Actions // Actions
action_page_open: Arc<SimpleAction>, action_page_open: Arc<SimpleAction>,
action_tab_page_navigation_reload: Arc<SimpleAction>, action_tab_page_navigation_reload: Arc<SimpleAction>,
@ -67,15 +67,15 @@ impl Page {
)); ));
// Init widget // Init widget
let widget = Box::builder() let gobject = Box::builder()
.orientation(Orientation::Vertical) .orientation(Orientation::Vertical)
.name(name) .name(name)
.build(); .build();
widget.append(navigation.widget()); gobject.append(navigation.widget());
widget.append(content.widget()); gobject.append(content.widget());
widget.insert_action_group("page", Some(&action_group)); gobject.insert_action_group("page", Some(&action_group));
// Init async mutable Meta object // Init async mutable Meta object
let meta = Arc::new(RefCell::new(Meta::new())); let meta = Arc::new(RefCell::new(Meta::new()));
@ -104,7 +104,7 @@ impl Page {
// Return activated structure // Return activated structure
Arc::new(Self { Arc::new(Self {
// GTK // GTK
widget, gobject,
// Actions // Actions
action_page_open, action_page_open,
action_tab_page_navigation_reload, action_tab_page_navigation_reload,
@ -483,7 +483,7 @@ impl Page {
self.meta.borrow().description.clone() self.meta.borrow().description.clone()
} }
pub fn widget(&self) -> &Box { pub fn gobject(&self) -> &Box {
&self.widget &self.gobject
} }
} }

Loading…
Cancel
Save