From a1aaebdb7e4db9694f8926899f6083c01e8a2237 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 11 Oct 2024 02:00:26 +0300 Subject: [PATCH] enable tab append, rename struct members --- src/app/browser/window/tab.rs | 6 ++---- src/app/browser/window/tab/item.rs | 4 ++-- src/app/browser/window/tab/item/page.rs | 16 ++++++++-------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index 5b4b821a..66a292e9 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -96,10 +96,8 @@ impl Tab { // Register dynamically created tab components in the HashMap index self.index.borrow_mut().insert(item.id(), item.clone()); - // Append new Notebook page - /* @TODO - self.widget - .append(item.label(), item.page(), item.is_initially_current()); */ + // Append new page + self.widget.gobject().add_page(item.gobject(), None); if page_navigation_request_text.is_none() { item.page_navigation_request_grab_focus(); // @TODO diff --git a/src/app/browser/window/tab/item.rs b/src/app/browser/window/tab/item.rs index 9722ed9f..092e7459 100644 --- a/src/app/browser/window/tab/item.rs +++ b/src/app/browser/window/tab/item.rs @@ -192,8 +192,8 @@ impl Item { self.is_initially_current } - pub fn page(&self) -> &Box { - &self.page.widget() // @TODO + pub fn gobject(&self) -> &Box { + &self.page.gobject() } pub fn page_title(&self) -> Option { diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index 5a4cc82b..b38c20c3 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -22,7 +22,7 @@ use std::{cell::RefCell, path::Path, sync::Arc}; pub struct Page { // GTK - widget: Box, + gobject: Box, // Actions action_page_open: Arc, action_tab_page_navigation_reload: Arc, @@ -67,15 +67,15 @@ impl Page { )); // Init widget - let widget = Box::builder() + let gobject = Box::builder() .orientation(Orientation::Vertical) .name(name) .build(); - widget.append(navigation.widget()); - widget.append(content.widget()); + gobject.append(navigation.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 let meta = Arc::new(RefCell::new(Meta::new())); @@ -104,7 +104,7 @@ impl Page { // Return activated structure Arc::new(Self { // GTK - widget, + gobject, // Actions action_page_open, action_tab_page_navigation_reload, @@ -483,7 +483,7 @@ impl Page { self.meta.borrow().description.clone() } - pub fn widget(&self) -> &Box { - &self.widget + pub fn gobject(&self) -> &Box { + &self.gobject } }