Skip to content

Commit c43b1e6

Browse files
committed
feat(gtk): app id
1 parent 627eb0f commit c43b1e6

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/runtime/gtk.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
use std::{future::Future, os::fd::OwnedFd, time::Duration};
22

33
use compio::driver::{AsRawFd, DriverType};
4-
use gtk4::glib::{
5-
ControlFlow, IOCondition, MainContext, timeout_add_local_once, unix_fd_add_local,
4+
use gtk4::{
5+
gio::{self, prelude::ApplicationExt},
6+
glib::{ControlFlow, IOCondition, MainContext, timeout_add_local_once, unix_fd_add_local},
67
};
78

89
pub struct Runtime {
910
runtime: compio::runtime::Runtime,
11+
app: gio::Application,
1012
efd: Option<OwnedFd>,
1113
ctx: MainContext,
1214
}
@@ -25,10 +27,21 @@ impl Runtime {
2527
.unwrap_or_else(|| runtime.as_raw_fd());
2628
let ctx = MainContext::default();
2729
gtk4::init().unwrap();
30+
let app = gio::Application::new(None, gio::ApplicationFlags::FLAGS_NONE);
31+
app.set_default();
2832

2933
unix_fd_add_local(poll_fd, IOCondition::IN, |_fd, _cond| ControlFlow::Continue);
3034

31-
Self { runtime, efd, ctx }
35+
Self {
36+
runtime,
37+
app,
38+
efd,
39+
ctx,
40+
}
41+
}
42+
43+
pub fn set_app_id(&mut self, name: &str) {
44+
self.app.set_application_id(Some(name));
3245
}
3346

3447
pub fn run(&self) {

0 commit comments

Comments
 (0)