This commit is contained in:
Ashley Wulber 2021-12-30 16:54:35 -05:00
parent e6ef9a5357
commit e48f501b0d
18 changed files with 151 additions and 166 deletions

View file

@ -1,7 +1,6 @@
use gtk::gdk::Display;
use gtk::prelude::*;
use gtk4 as gtk;
use gtk4::CssProvider;
use gtk4::gdk::Display;
use gtk4::prelude::*;
use gtk4::StyleContext;
use once_cell::sync::OnceCell;
use x11rb::rust_connection::RustConnection;
@ -16,7 +15,7 @@ mod window;
static X11_CONN: OnceCell<RustConnection> = OnceCell::new();
fn main() {
let app = gtk::Application::new(Some("com.cosmic.app_library"), Default::default());
let app = gtk4::Application::new(Some("com.cosmic.app_library"), Default::default());
app.connect_startup(|app| {
load_css();
build_ui(&app);
@ -38,11 +37,11 @@ fn load_css() {
StyleContext::add_provider_for_display(
&Display::default().expect("Error initializing GTK CSS provider."),
&provider,
gtk::STYLE_PROVIDER_PRIORITY_APPLICATION,
gtk4::STYLE_PROVIDER_PRIORITY_APPLICATION,
);
}
fn build_ui(app: &gtk::Application) {
fn build_ui(app: &gtk4::Application) {
// Create a new custom window and show it
let window = Window::new(app);
let (conn, _screen_num) = x11rb::connect(None).expect("Failed to connect to X");