Loading custom css

This commit is contained in:
Daniel García Moreno 2017-10-31 08:56:33 +01:00
parent 7cba0c5728
commit 84a0e73f79
4 changed files with 20 additions and 0 deletions

View file

@ -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"

8
res/app.css Normal file
View file

@ -0,0 +1,8 @@
.rooms {
background-color: alpha(@borders, 0.25);
}
.rooms:selected {
color: white;
background-color: @theme_selected_bg_color;
}

View file

@ -66,6 +66,9 @@
<property name="can_focus">False</property>
<child>
<object class="GtkTreeView" id="rooms_tree_view">
<style>
<class name="rooms"/>
</style>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="model">rooms_tree_store</property>

View file

@ -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();