use any widget for child

This commit is contained in:
yggverse 2024-11-03 22:44:48 +02:00
parent 2466463d53
commit 51f543143d

View File

@ -3,7 +3,7 @@ mod database;
use database::Database;
use adw::{TabPage, TabView};
use gtk::Box;
use gtk::prelude::IsA;
use sqlite::Transaction;
use std::sync::Arc;
@ -18,15 +18,15 @@ impl Widget {
pub fn new_arc(
keyword: &str, // ID
tab_view: &TabView,
page: &Box,
child: &impl IsA<gtk::Widget>,
title: Option<&str>,
position: Option<i32>,
is_pinned: bool,
is_selected: bool,
) -> Arc<Self> {
let gobject = match position {
Some(number) => tab_view.insert(page, number),
None => tab_view.append(page),
Some(number) => tab_view.insert(child, number),
None => tab_view.append(child),
};
gobject.set_keyword(keyword);