use namespaces

This commit is contained in:
yggverse 2024-09-23 02:17:53 +03:00
parent b5b4b359fa
commit 9b12642960

View File

@ -3,6 +3,8 @@ mod header;
mod main; mod main;
mod widget; mod widget;
use gtk::gio::ActionEntry;
use gtk::{Application, ApplicationWindow};
use std::sync::Arc; use std::sync::Arc;
use gtk::prelude::{ActionMapExtManual, GtkWindowExt}; use gtk::prelude::{ActionMapExtManual, GtkWindowExt};
@ -17,8 +19,8 @@ pub struct Browser {
impl Browser { impl Browser {
// Construct new browser // Construct new browser
pub fn new( pub fn new(
app: &gtk::Application, app: &Application,
connection: std::sync::Arc<sqlite::Connection>, // @TODO glib clone macro? connection: Arc<sqlite::Connection>, // @TODO glib clone macro?
default_width: i32, default_width: i32,
default_height: i32, default_height: i32,
) -> Browser { ) -> Browser {
@ -37,17 +39,17 @@ impl Browser {
// Init actions @TODO separated module // Init actions @TODO separated module
widget.gtk().add_action_entries([ widget.gtk().add_action_entries([
gtk::gio::ActionEntry::builder("debug") ActionEntry::builder("debug")
.activate(|this: &gtk::ApplicationWindow, _, _| { .activate(|this: &ApplicationWindow, _, _| {
this.emit_enable_debugging(true); this.emit_enable_debugging(true);
}) })
.build(), .build(),
gtk::gio::ActionEntry::builder("quit") ActionEntry::builder("quit")
.activate(|this: &gtk::ApplicationWindow, _, _| { .activate(|this: &ApplicationWindow, _, _| {
this.close(); this.close();
}) })
.build(), .build(),
gtk::gio::ActionEntry::builder("tab_append") ActionEntry::builder("tab_append")
.activate({ .activate({
let main = main.clone(); let main = main.clone();
move |_, _, _| { move |_, _, _| {