define ptr container outside

This commit is contained in:
yggverse 2024-11-11 01:14:09 +02:00
parent 7b2c07ac45
commit a5fc2a7475
58 changed files with 230 additions and 272 deletions

View file

@ -5,7 +5,6 @@ use database::Database;
use adw::{TabPage, TabView};
use gtk::prelude::IsA;
use sqlite::Transaction;
use std::rc::Rc;
const DEFAULT_TITLE: &str = "New page";
@ -15,7 +14,7 @@ pub struct Widget {
impl Widget {
// Construct
pub fn new_rc(
pub fn new(
keyword: &str, // ID
tab_view: &TabView,
child: &impl IsA<gtk::Widget>,
@ -23,7 +22,7 @@ impl Widget {
position: Option<i32>,
is_pinned: bool,
is_selected: bool,
) -> Rc<Self> {
) -> Self {
let gobject = match position {
Some(value) => {
// If given `position` match pinned tab, GTK will panic with notice:
@ -51,7 +50,7 @@ impl Widget {
tab_view.set_selected_page(&gobject);
}
Rc::new(Self { gobject })
Self { gobject }
}
// Actions