Browse Source

drop label mod

master
yggverse 2 months ago
parent
commit
5529fcaa71
  1. 6
      src/app/browser/window/tab.rs
  2. 24
      src/app/browser/window/tab/item.rs

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

@ -106,8 +106,9 @@ impl Tab {
self.index.borrow_mut().insert(item.id(), item.clone()); self.index.borrow_mut().insert(item.id(), item.clone());
// Append new Notebook page // Append new Notebook page
/* @TODO
self.widget self.widget
.append(item.label(), item.page(), item.is_initially_current()); .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
@ -223,11 +224,12 @@ impl Tab {
self.index.borrow_mut().insert(item.id(), item.clone()); self.index.borrow_mut().insert(item.id(), item.clone());
// Append new Notebook page // Append new Notebook page
/* @TODO
self.widget.append( self.widget.append(
item.label(), item.label(),
item.page(), item.page(),
item.is_initially_current(), item.is_initially_current(),
); ); */
} }
} }
Err(e) => return Err(e.to_string()), Err(e) => return Err(e.to_string()),

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

@ -1,9 +1,7 @@
mod database; mod database;
mod label;
mod page; mod page;
use database::Database; use database::Database;
use label::Label;
use page::Page; use page::Page;
use sqlite::Transaction; use sqlite::Transaction;
@ -21,7 +19,6 @@ pub struct Item {
// useful as widget name in GTK actions callback // useful as widget name in GTK actions callback
id: GString, id: GString,
// Components // Components
label: Arc<Label>,
page: Arc<Page>, page: Arc<Page>,
// Extras, useful for session restore // Extras, useful for session restore
is_initially_current: bool, is_initially_current: bool,
@ -43,8 +40,6 @@ impl Item {
let id = uuid_string_random(); let id = uuid_string_random();
// Init components // Init components
let label = Label::new_arc(id.clone(), false);
let page = Page::new_arc( let page = Page::new_arc(
id.clone(), id.clone(),
page_navigation_request_text.clone(), page_navigation_request_text.clone(),
@ -59,14 +54,13 @@ impl Item {
Arc::new(Self { Arc::new(Self {
id, id,
is_initially_current, is_initially_current,
label,
page, page,
}) })
} }
// Actions // Actions
pub fn pin(&self) { pub fn pin(&self) {
self.label.pin(!self.label.is_pinned()) // toggle //self.label.pin(!self.label.is_pinned()) // toggle
} }
pub fn page_navigation_base(&self) { pub fn page_navigation_base(&self) {
@ -91,11 +85,6 @@ impl Item {
pub fn update(&self) { pub fn update(&self) {
self.page.update(); self.page.update();
if let Some(title) = self.page.title() {
self.label.update(Some(&title));
} else {
self.label.update(None);
}
} }
pub fn clean( pub fn clean(
@ -109,7 +98,6 @@ impl Item {
match Database::delete(transaction, &record.id) { match Database::delete(transaction, &record.id) {
Ok(_) => { Ok(_) => {
// Delegate clean action to the item childs // Delegate clean action to the item childs
self.label.clean(transaction, &record.id)?;
/* @TODO /* @TODO
self.page.clean(transaction, &record.id)?;*/ self.page.clean(transaction, &record.id)?;*/
@ -154,7 +142,9 @@ impl Item {
); );
// Delegate restore action to the item childs // Delegate restore action to the item childs
item.label.restore(transaction, &record.id)?;
/* @TODO
self.page.restore(transaction, &id)?; */
// Result // Result
items.push(item); items.push(item);
@ -183,7 +173,6 @@ impl Item {
let id = Database::last_insert_id(transaction); let id = Database::last_insert_id(transaction);
// Delegate save action to childs // Delegate save action to childs
self.label.save(transaction, &id)?;
/* @TODO /* @TODO
self.page.save(transaction, &id)?; */ self.page.save(transaction, &id)?; */
@ -203,10 +192,6 @@ impl Item {
self.is_initially_current self.is_initially_current
} }
pub fn label(&self) -> &Box {
&self.label.gobject()
}
pub fn page(&self) -> &Box { pub fn page(&self) -> &Box {
&self.page.widget() // @TODO &self.page.widget() // @TODO
} }
@ -227,7 +212,6 @@ impl Item {
} }
// Delegate migration to childs // Delegate migration to childs
Label::migrate(&tx)?;
/* @TODO /* @TODO
Page::migrate(&tx)? */ Page::migrate(&tx)? */

Loading…
Cancel
Save