-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathworkbench.rs
More file actions
35 lines (31 loc) · 807 Bytes
/
workbench.rs
File metadata and controls
35 lines (31 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use std::path::Path;
use gtk::gio;
use gtk::prelude::*;
#[allow(dead_code)]
pub(crate) fn builder() -> &'static gtk::Builder {
unsafe {
crate::BUILDER
.as_ref()
.expect("Builder instance should already be initialized.")
}
}
#[allow(dead_code)]
pub(crate) fn window() -> &'static adw::Window {
unsafe {
crate::WINDOW
.as_ref()
.expect("Window instance should already be initialized.")
}
}
#[allow(dead_code)]
pub(crate) fn resolve(path: impl AsRef<Path>) -> String {
unsafe {
let uri = crate::URI
.as_ref()
.expect("URI instance should already be initialized.");
gio::File::for_uri(uri)
.resolve_relative_path(path)
.uri()
.to_string()
}
}