Fix linux compilation

This commit is contained in:
daa 2017-03-16 15:03:00 +03:00
parent b1507a0334
commit f1e98a4899
2 changed files with 10 additions and 9 deletions

View File

@ -1,9 +1,10 @@
#[cfg(unix)] #[cfg(unix)]
use ui::{UI, SET}; use ui::{UI, SET};
#[cfg(unix)] #[cfg(unix)]
use nvim::RedrawEvents; use nvim::RedrawEvents;
use ui::Ui; use shell::Shell;
#[cfg(unix)] #[cfg(unix)]
use gio; use gio;
@ -38,16 +39,16 @@ impl Settings {
} }
#[cfg(unix)] #[cfg(unix)]
pub fn init(&mut self, ui: &mut Ui) { pub fn init(&mut self, shell: &mut Shell) {
self.gnome_interface_settings.connect_changed(|_, _| monospace_font_changed()); self.gnome_interface_settings.connect_changed(|_, _| monospace_font_changed());
self.update_font(ui); self.update_font(shell);
} }
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub fn init(&mut self, _: &mut Ui) {} pub fn init(&mut self, _: &mut Shell) {}
#[cfg(unix)] #[cfg(unix)]
fn update_font(&mut self, ui: &mut Ui) { fn update_font(&mut self, shell: &mut Shell) {
// rpc is priority for font // rpc is priority for font
if self.font_source == FontSource::Rpc { if self.font_source == FontSource::Rpc {
return; return;
@ -56,7 +57,7 @@ impl Settings {
if let Some(ref font_name) = if let Some(ref font_name) =
self.gnome_interface_settings self.gnome_interface_settings
.get_string("monospace-font-name") { .get_string("monospace-font-name") {
ui.set_font_desc(font_name); shell.set_font_desc(font_name);
self.font_source = FontSource::Gnome; self.font_source = FontSource::Gnome;
} }
} }
@ -75,8 +76,8 @@ fn monospace_font_changed() {
let mut set = set_cell.borrow_mut(); let mut set = set_cell.borrow_mut();
// rpc is priority for font // rpc is priority for font
if set.font_source != FontSource::Rpc { if set.font_source != FontSource::Rpc {
set.update_font(&mut *ui); set.update_font(&mut ui.shell);
ui.on_redraw(); ui.shell.on_redraw();
} }
}); });
}); });

View File

@ -63,7 +63,7 @@ impl Ui {
SET.with(|settings| { SET.with(|settings| {
let mut settings = settings.borrow_mut(); let mut settings = settings.borrow_mut();
settings.init(self); settings.init(&mut self.shell);
}); });
self.header_bar.set_show_close_button(true); self.header_bar.set_show_close_button(true);