1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// This file was generated by gir (9e3f4cc) from gir-files (71d73f0)
// DO NOT EDIT

use Error;
use ffi;
use gdk_pixbuf;
use gio;
use glib::translate::*;
use libc;
use std::mem;
use std::ptr;

glib_wrapper! {
    pub struct RecentInfo(Shared<ffi::GtkRecentInfo>);

    match fn {
        ref => |ptr| ffi::gtk_recent_info_ref(ptr),
        unref => |ptr| ffi::gtk_recent_info_unref(ptr),
    }
}

impl RecentInfo {
    pub fn create_app_info<'a, P: Into<Option<&'a str>>>(&self, app_name: P) -> Result<Option<gio::AppInfo>, Error> {
        let app_name = app_name.into();
        let app_name = app_name.to_glib_none();
        unsafe {
            let mut error = ptr::null_mut();
            let ret = ffi::gtk_recent_info_create_app_info(self.to_glib_none().0, app_name.0, &mut error);
            if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
        }
    }

    pub fn exists(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_recent_info_exists(self.to_glib_none().0))
        }
    }

    pub fn get_added(&self) -> libc::c_long {
        unsafe {
            ffi::gtk_recent_info_get_added(self.to_glib_none().0)
        }
    }

    pub fn get_age(&self) -> i32 {
        unsafe {
            ffi::gtk_recent_info_get_age(self.to_glib_none().0)
        }
    }

    pub fn get_application_info(&self, app_name: &str) -> Option<(String, u32, libc::c_long)> {
        unsafe {
            let mut app_exec = ptr::null();
            let mut count = mem::uninitialized();
            let mut time_ = mem::uninitialized();
            let ret = from_glib(ffi::gtk_recent_info_get_application_info(self.to_glib_none().0, app_name.to_glib_none().0, &mut app_exec, &mut count, &mut time_));
            if ret { Some((from_glib_none(app_exec), count, time_)) } else { None }
        }
    }

    pub fn get_applications(&self) -> Vec<String> {
        unsafe {
            let mut length = mem::uninitialized();
            let ret = FromGlibPtrContainer::from_glib_full_num(ffi::gtk_recent_info_get_applications(self.to_glib_none().0, &mut length), length as usize);
            ret
        }
    }

    pub fn get_description(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gtk_recent_info_get_description(self.to_glib_none().0))
        }
    }

    pub fn get_display_name(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gtk_recent_info_get_display_name(self.to_glib_none().0))
        }
    }

    pub fn get_gicon(&self) -> Option<gio::Icon> {
        unsafe {
            from_glib_full(ffi::gtk_recent_info_get_gicon(self.to_glib_none().0))
        }
    }

    pub fn get_groups(&self) -> Vec<String> {
        unsafe {
            let mut length = mem::uninitialized();
            let ret = FromGlibPtrContainer::from_glib_full_num(ffi::gtk_recent_info_get_groups(self.to_glib_none().0, &mut length), length as usize);
            ret
        }
    }

    pub fn get_icon(&self, size: i32) -> Option<gdk_pixbuf::Pixbuf> {
        unsafe {
            from_glib_full(ffi::gtk_recent_info_get_icon(self.to_glib_none().0, size))
        }
    }

    pub fn get_mime_type(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gtk_recent_info_get_mime_type(self.to_glib_none().0))
        }
    }

    pub fn get_modified(&self) -> libc::c_long {
        unsafe {
            ffi::gtk_recent_info_get_modified(self.to_glib_none().0)
        }
    }

    pub fn get_private_hint(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_recent_info_get_private_hint(self.to_glib_none().0))
        }
    }

    pub fn get_short_name(&self) -> Option<String> {
        unsafe {
            from_glib_full(ffi::gtk_recent_info_get_short_name(self.to_glib_none().0))
        }
    }

    pub fn get_uri(&self) -> Option<String> {
        unsafe {
            from_glib_none(ffi::gtk_recent_info_get_uri(self.to_glib_none().0))
        }
    }

    pub fn get_uri_display(&self) -> Option<String> {
        unsafe {
            from_glib_full(ffi::gtk_recent_info_get_uri_display(self.to_glib_none().0))
        }
    }

    pub fn get_visited(&self) -> libc::c_long {
        unsafe {
            ffi::gtk_recent_info_get_visited(self.to_glib_none().0)
        }
    }

    pub fn has_application(&self, app_name: &str) -> bool {
        unsafe {
            from_glib(ffi::gtk_recent_info_has_application(self.to_glib_none().0, app_name.to_glib_none().0))
        }
    }

    pub fn has_group(&self, group_name: &str) -> bool {
        unsafe {
            from_glib(ffi::gtk_recent_info_has_group(self.to_glib_none().0, group_name.to_glib_none().0))
        }
    }

    pub fn is_local(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_recent_info_is_local(self.to_glib_none().0))
        }
    }

    pub fn last_application(&self) -> Option<String> {
        unsafe {
            from_glib_full(ffi::gtk_recent_info_last_application(self.to_glib_none().0))
        }
    }

    pub fn match_(&self, info_b: &RecentInfo) -> bool {
        unsafe {
            from_glib(ffi::gtk_recent_info_match(self.to_glib_none().0, info_b.to_glib_none().0))
        }
    }
}