gio/auto/
file_icon.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use gio_sys;
6use glib::object::IsA;
7use glib::translate::*;
8use std::fmt;
9use File;
10use Icon;
11use LoadableIcon;
12
13glib_wrapper! {
14    pub struct FileIcon(Object<gio_sys::GFileIcon, gio_sys::GFileIconClass, FileIconClass>) @implements Icon, LoadableIcon;
15
16    match fn {
17        get_type => || gio_sys::g_file_icon_get_type(),
18    }
19}
20
21impl FileIcon {
22    pub fn new<P: IsA<File>>(file: &P) -> FileIcon {
23        unsafe { from_glib_full(gio_sys::g_file_icon_new(file.as_ref().to_glib_none().0)) }
24    }
25
26    pub fn get_file(&self) -> Option<File> {
27        unsafe { from_glib_none(gio_sys::g_file_icon_get_file(self.to_glib_none().0)) }
28    }
29}
30
31impl fmt::Display for FileIcon {
32    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
33        write!(f, "FileIcon")
34    }
35}