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 5 use glib::translate::*; 6 use std::mem; 7 use std::ptr; 8 9 glib::wrapper! { 10 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 11 pub struct RecentInfo(Shared<ffi::GtkRecentInfo>); 12 13 match fn { 14 ref => |ptr| ffi::gtk_recent_info_ref(ptr), 15 unref => |ptr| ffi::gtk_recent_info_unref(ptr), 16 type_ => || ffi::gtk_recent_info_get_type(), 17 } 18 } 19 20 impl RecentInfo { 21 #[doc(alias = "gtk_recent_info_create_app_info")] create_app_info( &self, app_name: Option<&str>, ) -> Result<Option<gio::AppInfo>, glib::Error>22 pub fn create_app_info( 23 &self, 24 app_name: Option<&str>, 25 ) -> Result<Option<gio::AppInfo>, glib::Error> { 26 unsafe { 27 let mut error = ptr::null_mut(); 28 let ret = ffi::gtk_recent_info_create_app_info( 29 self.to_glib_none().0, 30 app_name.to_glib_none().0, 31 &mut error, 32 ); 33 if error.is_null() { 34 Ok(from_glib_full(ret)) 35 } else { 36 Err(from_glib_full(error)) 37 } 38 } 39 } 40 41 #[doc(alias = "gtk_recent_info_exists")] exists(&self) -> bool42 pub fn exists(&self) -> bool { 43 unsafe { from_glib(ffi::gtk_recent_info_exists(self.to_glib_none().0)) } 44 } 45 46 #[doc(alias = "gtk_recent_info_get_added")] 47 #[doc(alias = "get_added")] added(&self) -> libc::c_long48 pub fn added(&self) -> libc::c_long { 49 unsafe { ffi::gtk_recent_info_get_added(self.to_glib_none().0) } 50 } 51 52 #[doc(alias = "gtk_recent_info_get_age")] 53 #[doc(alias = "get_age")] age(&self) -> i3254 pub fn age(&self) -> i32 { 55 unsafe { ffi::gtk_recent_info_get_age(self.to_glib_none().0) } 56 } 57 58 #[doc(alias = "gtk_recent_info_get_application_info")] 59 #[doc(alias = "get_application_info")] application_info(&self, app_name: &str) -> Option<(glib::GString, u32, libc::c_long)>60 pub fn application_info(&self, app_name: &str) -> Option<(glib::GString, u32, libc::c_long)> { 61 unsafe { 62 let mut app_exec = ptr::null(); 63 let mut count = mem::MaybeUninit::uninit(); 64 let mut time_ = mem::MaybeUninit::uninit(); 65 let ret = from_glib(ffi::gtk_recent_info_get_application_info( 66 self.to_glib_none().0, 67 app_name.to_glib_none().0, 68 &mut app_exec, 69 count.as_mut_ptr(), 70 time_.as_mut_ptr(), 71 )); 72 let count = count.assume_init(); 73 let time_ = time_.assume_init(); 74 if ret { 75 Some((from_glib_none(app_exec), count, time_)) 76 } else { 77 None 78 } 79 } 80 } 81 82 #[doc(alias = "gtk_recent_info_get_applications")] 83 #[doc(alias = "get_applications")] applications(&self) -> Vec<glib::GString>84 pub fn applications(&self) -> Vec<glib::GString> { 85 unsafe { 86 let mut length = mem::MaybeUninit::uninit(); 87 let ret = FromGlibContainer::from_glib_full_num( 88 ffi::gtk_recent_info_get_applications(self.to_glib_none().0, length.as_mut_ptr()), 89 length.assume_init() as usize, 90 ); 91 ret 92 } 93 } 94 95 #[doc(alias = "gtk_recent_info_get_description")] 96 #[doc(alias = "get_description")] description(&self) -> Option<glib::GString>97 pub fn description(&self) -> Option<glib::GString> { 98 unsafe { from_glib_none(ffi::gtk_recent_info_get_description(self.to_glib_none().0)) } 99 } 100 101 #[doc(alias = "gtk_recent_info_get_display_name")] 102 #[doc(alias = "get_display_name")] display_name(&self) -> Option<glib::GString>103 pub fn display_name(&self) -> Option<glib::GString> { 104 unsafe { from_glib_none(ffi::gtk_recent_info_get_display_name(self.to_glib_none().0)) } 105 } 106 107 #[doc(alias = "gtk_recent_info_get_gicon")] 108 #[doc(alias = "get_gicon")] gicon(&self) -> Option<gio::Icon>109 pub fn gicon(&self) -> Option<gio::Icon> { 110 unsafe { from_glib_full(ffi::gtk_recent_info_get_gicon(self.to_glib_none().0)) } 111 } 112 113 #[doc(alias = "gtk_recent_info_get_groups")] 114 #[doc(alias = "get_groups")] groups(&self) -> Vec<glib::GString>115 pub fn groups(&self) -> Vec<glib::GString> { 116 unsafe { 117 let mut length = mem::MaybeUninit::uninit(); 118 let ret = FromGlibContainer::from_glib_full_num( 119 ffi::gtk_recent_info_get_groups(self.to_glib_none().0, length.as_mut_ptr()), 120 length.assume_init() as usize, 121 ); 122 ret 123 } 124 } 125 126 #[doc(alias = "gtk_recent_info_get_icon")] 127 #[doc(alias = "get_icon")] icon(&self, size: i32) -> Option<gdk_pixbuf::Pixbuf>128 pub fn icon(&self, size: i32) -> Option<gdk_pixbuf::Pixbuf> { 129 unsafe { from_glib_full(ffi::gtk_recent_info_get_icon(self.to_glib_none().0, size)) } 130 } 131 132 #[doc(alias = "gtk_recent_info_get_mime_type")] 133 #[doc(alias = "get_mime_type")] mime_type(&self) -> Option<glib::GString>134 pub fn mime_type(&self) -> Option<glib::GString> { 135 unsafe { from_glib_none(ffi::gtk_recent_info_get_mime_type(self.to_glib_none().0)) } 136 } 137 138 #[doc(alias = "gtk_recent_info_get_modified")] 139 #[doc(alias = "get_modified")] modified(&self) -> libc::c_long140 pub fn modified(&self) -> libc::c_long { 141 unsafe { ffi::gtk_recent_info_get_modified(self.to_glib_none().0) } 142 } 143 144 #[doc(alias = "gtk_recent_info_get_private_hint")] 145 #[doc(alias = "get_private_hint")] is_private_hint(&self) -> bool146 pub fn is_private_hint(&self) -> bool { 147 unsafe { from_glib(ffi::gtk_recent_info_get_private_hint(self.to_glib_none().0)) } 148 } 149 150 #[doc(alias = "gtk_recent_info_get_short_name")] 151 #[doc(alias = "get_short_name")] short_name(&self) -> Option<glib::GString>152 pub fn short_name(&self) -> Option<glib::GString> { 153 unsafe { from_glib_full(ffi::gtk_recent_info_get_short_name(self.to_glib_none().0)) } 154 } 155 156 #[doc(alias = "gtk_recent_info_get_uri")] 157 #[doc(alias = "get_uri")] uri(&self) -> Option<glib::GString>158 pub fn uri(&self) -> Option<glib::GString> { 159 unsafe { from_glib_none(ffi::gtk_recent_info_get_uri(self.to_glib_none().0)) } 160 } 161 162 #[doc(alias = "gtk_recent_info_get_uri_display")] 163 #[doc(alias = "get_uri_display")] uri_display(&self) -> Option<glib::GString>164 pub fn uri_display(&self) -> Option<glib::GString> { 165 unsafe { from_glib_full(ffi::gtk_recent_info_get_uri_display(self.to_glib_none().0)) } 166 } 167 168 #[doc(alias = "gtk_recent_info_get_visited")] 169 #[doc(alias = "get_visited")] visited(&self) -> libc::c_long170 pub fn visited(&self) -> libc::c_long { 171 unsafe { ffi::gtk_recent_info_get_visited(self.to_glib_none().0) } 172 } 173 174 #[doc(alias = "gtk_recent_info_has_application")] has_application(&self, app_name: &str) -> bool175 pub fn has_application(&self, app_name: &str) -> bool { 176 unsafe { 177 from_glib(ffi::gtk_recent_info_has_application( 178 self.to_glib_none().0, 179 app_name.to_glib_none().0, 180 )) 181 } 182 } 183 184 #[doc(alias = "gtk_recent_info_has_group")] has_group(&self, group_name: &str) -> bool185 pub fn has_group(&self, group_name: &str) -> bool { 186 unsafe { 187 from_glib(ffi::gtk_recent_info_has_group( 188 self.to_glib_none().0, 189 group_name.to_glib_none().0, 190 )) 191 } 192 } 193 194 #[doc(alias = "gtk_recent_info_is_local")] is_local(&self) -> bool195 pub fn is_local(&self) -> bool { 196 unsafe { from_glib(ffi::gtk_recent_info_is_local(self.to_glib_none().0)) } 197 } 198 199 #[doc(alias = "gtk_recent_info_last_application")] last_application(&self) -> Option<glib::GString>200 pub fn last_application(&self) -> Option<glib::GString> { 201 unsafe { from_glib_full(ffi::gtk_recent_info_last_application(self.to_glib_none().0)) } 202 } 203 204 #[doc(alias = "gtk_recent_info_match")] 205 #[doc(alias = "match")] match_(&self, info_b: &RecentInfo) -> bool206 pub fn match_(&self, info_b: &RecentInfo) -> bool { 207 unsafe { 208 from_glib(ffi::gtk_recent_info_match( 209 self.to_glib_none().0, 210 info_b.to_glib_none().0, 211 )) 212 } 213 } 214 } 215