Fix compilation warnings

This commit is contained in:
daa84 2017-03-14 10:48:04 +03:00
parent 7915541a7d
commit b68d2470c3

View File

@ -10,6 +10,7 @@ use gio;
#[derive(PartialEq)] #[derive(PartialEq)]
pub enum FontSource { pub enum FontSource {
Rpc, Rpc,
#[cfg(unix)]
Gnome, Gnome,
Default, Default,
} }
@ -23,10 +24,9 @@ pub struct Settings {
} }
impl Settings { impl Settings {
#[cfg(unix)] #[cfg(unix)]
pub fn new() -> Settings { pub fn new() -> Settings {
Settings { Settings {
font_source: FontSource::Default, font_source: FontSource::Default,
gnome_interface_settings: gio::Settings::new("org.gnome.desktop.interface"), gnome_interface_settings: gio::Settings::new("org.gnome.desktop.interface"),
} }
@ -34,9 +34,7 @@ impl Settings {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub fn new() -> Settings { pub fn new() -> Settings {
Settings { Settings { font_source: FontSource::Default }
font_source: FontSource::Default,
}
} }
#[cfg(unix)] #[cfg(unix)]
@ -46,13 +44,7 @@ impl Settings {
} }
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub fn init(&mut self, ui: &mut Ui) { pub fn init(&mut self, _: &mut Ui) {}
}
#[cfg(target_os = "windows")]
fn update_font(&mut self, ui: &mut Ui) {
}
#[cfg(unix)] #[cfg(unix)]
fn update_font(&mut self, ui: &mut Ui) { fn update_font(&mut self, ui: &mut Ui) {
@ -61,10 +53,11 @@ impl Settings {
return; return;
} }
if let Some(ref font_name) = self.gnome_interface_settings.get_string("monospace-font-name") { if let Some(ref font_name) = self.gnome_interface_settings
ui.set_font_desc(font_name); .get_string("monospace-font-name") {
self.font_source = FontSource::Gnome; ui.set_font_desc(font_name);
} self.font_source = FontSource::Gnome;
}
} }
pub fn set_font_source(&mut self, src: FontSource) { pub fn set_font_source(&mut self, src: FontSource) {
@ -87,4 +80,3 @@ fn monospace_font_changed() {
}); });
}); });
} }