From 84a0e73f79d1d003ab380a1ee6cd736b9e7f6950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Moreno?= Date: Tue, 31 Oct 2017 08:56:33 +0100 Subject: [PATCH] Loading custom css --- Cargo.toml | 1 + res/app.css | 8 ++++++++ res/main_window.glade | 3 +++ src/app.rs | 8 ++++++++ 4 files changed, 20 insertions(+) create mode 100644 res/app.css diff --git a/Cargo.toml b/Cargo.toml index 93706bec..eca3aa0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ version = "0.1.0" [dependencies] chrono = "0.4.0" +gdk = "0.6.0" gdk-pixbuf = "0.2.0" gio = "0.2.0" glib = "0.3.1" diff --git a/res/app.css b/res/app.css new file mode 100644 index 00000000..b4ca3b5f --- /dev/null +++ b/res/app.css @@ -0,0 +1,8 @@ +.rooms { + background-color: alpha(@borders, 0.25); +} + +.rooms:selected { + color: white; + background-color: @theme_selected_bg_color; +} diff --git a/res/main_window.glade b/res/main_window.glade index 97a9771d..834e0f25 100644 --- a/res/main_window.glade +++ b/res/main_window.glade @@ -66,6 +66,9 @@ False + True True rooms_tree_store diff --git a/src/app.rs b/src/app.rs index 5f7ee779..a37af4fa 100644 --- a/src/app.rs +++ b/src/app.rs @@ -5,6 +5,7 @@ extern crate gdk_pixbuf; extern crate secret_service; extern crate libnotify; extern crate chrono; +extern crate gdk; use self::chrono::prelude::*; @@ -1476,6 +1477,13 @@ impl App { glib::set_application_name("guillotine"); glib::set_prgname(Some("guillotine")); + let provider = gtk::CssProvider::new(); + let uri = "res/app.css"; + if let Err(_) = provider.load_from_path(uri) { + println!("Error: Failed to add application style"); + } + gtk::StyleContext::add_provider_for_screen(&gdk::Screen::get_default().unwrap(), &provider, 600); + gtk::main(); libnotify::uninit();