Using a template in another blueprint template #1601
-
Coming from web frameworks, i am used to reuse widgets. only resources i could find was https://gtk-rs.org/gtk4-rs/stable/latest/book/composite_templates.html Thanks for your help in advance. Code:
and the imp.rs for the parent widget: use crate::views::tasks::TasksView;
#[derive(CompositeTemplate, Default)]
#[template(file = "src/window.blp")]
pub struct AppWindow {
pub settings: OnceCell<Settings>,
}
#[glib::object_subclass]
impl ObjectSubclass for AppWindow {
const NAME: &'static str = "AppWindow";
type Type = super::AppWindow;
type ParentType = adw::ApplicationWindow;
fn class_init(klass: &mut Self::Class) {
TasksView::ensure_type();
klass.bind_template();
}
fn instance_init(obj: &InitializingObject<Self>) {
obj.init_template();
}
}
impl ObjectImpl for AppWindow {}
impl WidgetImpl for AppWindow {}
impl WindowImpl for AppWindow {}
impl AdwWindowImpl for AppWindow {}
impl ApplicationWindowImpl for AppWindow {}
impl AdwApplicationWindowImpl for AppWindow {} |
Beta Was this translation helpful? Give feedback.
Answered by
bilelmoussaoui
Feb 8, 2024
Replies: 1 comment 3 replies
-
I can't answer this without seeing the content of your |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Per the docs in https://jwestman.pages.gitlab.gnome.org/blueprint-compiler/reference/templates.html, you should be writing
child: $TasksView
no?