browser_window/core/
application.rs1#[cfg(not(feature = "gtk"))]
2pub mod c;
3#[cfg(feature = "gtk")]
4pub mod gtk;
5
6use std::{
7 os::raw::{c_char, c_int},
8 time::Duration,
9};
10
11#[cfg(not(feature = "gtk"))]
12pub use c::ApplicationImpl;
13#[cfg(feature = "gtk")]
14pub use gtk::ApplicationImpl;
15
16use crate::{application::ApplicationSettings, error::Result};
17
18pub trait ApplicationExt: Clone {
19 fn assert_correct_thread(&self);
21 fn dispatch(&self, work: fn(ApplicationImpl, *mut ()), data: *mut ()) -> bool;
23 fn dispatch_delayed(
26 &self, work: fn(ApplicationImpl, *mut ()), data: *mut (), delay: Duration,
27 ) -> bool;
28 fn exit(&self, exit_code: i32);
30 fn exit_threadsafe(self: &Self, exit_code: i32);
32 fn free(&self) {}
35 fn initialize(
36 argc: c_int, argv: *mut *mut c_char, settings: &ApplicationSettings,
37 ) -> Result<ApplicationImpl>;
38 fn mark_as_done(&self);
41 fn run(&self, on_ready: fn(ApplicationImpl, *mut ()), data: *mut ()) -> i32;
44}