mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
activate gtk before build children widgets, add browser pointer to the app struct
This commit is contained in:
parent
2d59115c7e
commit
b6fa1016f6
3 changed files with 40 additions and 68 deletions
|
|
@ -7,7 +7,7 @@ use main::Main;
|
|||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
prelude::{ActionMapExt, GtkWindowExt},
|
||||
Application, ApplicationWindow,
|
||||
ApplicationWindow,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
@ -38,8 +38,6 @@ pub struct Browser {
|
|||
impl Browser {
|
||||
// Construct
|
||||
pub fn new(
|
||||
// Dependencies
|
||||
application: &Application,
|
||||
// Extras
|
||||
// connection: Arc<sqlite::Connection>,
|
||||
// Actions
|
||||
|
|
@ -82,7 +80,6 @@ impl Browser {
|
|||
|
||||
// Init widget
|
||||
let widget = ApplicationWindow::builder()
|
||||
.application(application)
|
||||
.titlebar(header.widget())
|
||||
.child(main.widget())
|
||||
.default_height(DEFAULT_HEIGHT)
|
||||
|
|
@ -112,7 +109,7 @@ impl Browser {
|
|||
}
|
||||
|
||||
// Actions
|
||||
pub fn activate(&self) {
|
||||
pub fn activate(&self) -> &Self {
|
||||
// Assign actions
|
||||
self.widget.add_action(self.action_debug.as_ref());
|
||||
self.widget.add_action(self.action_quit.as_ref());
|
||||
|
|
@ -211,6 +208,8 @@ impl Browser {
|
|||
main.tab_pin();
|
||||
}
|
||||
});
|
||||
|
||||
&self
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue