gdk/
screen.rs

1// Copyright 2013-2017, The Gtk-rs Project Developers.
2// See the COPYRIGHT file at the top-level directory of this distribution.
3// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4
5use cairo;
6use gdk_sys;
7use glib;
8use glib::translate::*;
9use Screen;
10
11impl Screen {
12    pub fn get_font_options(&self) -> Option<cairo::FontOptions> {
13        unsafe {
14            from_glib_none(mut_override(gdk_sys::gdk_screen_get_font_options(
15                self.to_glib_none().0,
16            )))
17        }
18    }
19
20    pub fn get_setting(&self, name: &str) -> Option<glib::Value> {
21        unsafe {
22            let mut value = glib::Value::uninitialized();
23            let done: bool = from_glib(gdk_sys::gdk_screen_get_setting(
24                self.to_glib_none().0,
25                name.to_glib_none().0,
26                value.to_glib_none_mut().0,
27            ));
28
29            if done == true {
30                Some(value)
31            } else {
32                None
33            }
34        }
35    }
36}