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 crate::RecentFilter; 6 use crate::RecentInfo; 7 use crate::RecentSortType; 8 use glib::object::Cast; 9 use glib::object::IsA; 10 use glib::signal::connect_raw; 11 use glib::signal::SignalHandlerId; 12 use glib::translate::*; 13 use std::boxed::Box as Box_; 14 use std::fmt; 15 use std::mem; 16 use std::mem::transmute; 17 use std::ptr; 18 19 glib::wrapper! { 20 #[doc(alias = "GtkRecentChooser")] 21 pub struct RecentChooser(Interface<ffi::GtkRecentChooser, ffi::GtkRecentChooserIface>); 22 23 match fn { 24 type_ => || ffi::gtk_recent_chooser_get_type(), 25 } 26 } 27 28 pub const NONE_RECENT_CHOOSER: Option<&RecentChooser> = None; 29 30 pub trait RecentChooserExt: 'static { 31 #[doc(alias = "gtk_recent_chooser_add_filter")] add_filter(&self, filter: &RecentFilter)32 fn add_filter(&self, filter: &RecentFilter); 33 34 #[doc(alias = "gtk_recent_chooser_get_current_item")] 35 #[doc(alias = "get_current_item")] current_item(&self) -> Option<RecentInfo>36 fn current_item(&self) -> Option<RecentInfo>; 37 38 #[doc(alias = "gtk_recent_chooser_get_current_uri")] 39 #[doc(alias = "get_current_uri")] current_uri(&self) -> Option<glib::GString>40 fn current_uri(&self) -> Option<glib::GString>; 41 42 #[doc(alias = "gtk_recent_chooser_get_filter")] 43 #[doc(alias = "get_filter")] filter(&self) -> Option<RecentFilter>44 fn filter(&self) -> Option<RecentFilter>; 45 46 #[doc(alias = "gtk_recent_chooser_get_items")] 47 #[doc(alias = "get_items")] items(&self) -> Vec<RecentInfo>48 fn items(&self) -> Vec<RecentInfo>; 49 50 #[doc(alias = "gtk_recent_chooser_get_limit")] 51 #[doc(alias = "get_limit")] limit(&self) -> i3252 fn limit(&self) -> i32; 53 54 #[doc(alias = "gtk_recent_chooser_get_local_only")] 55 #[doc(alias = "get_local_only")] is_local_only(&self) -> bool56 fn is_local_only(&self) -> bool; 57 58 #[doc(alias = "gtk_recent_chooser_get_select_multiple")] 59 #[doc(alias = "get_select_multiple")] selects_multiple(&self) -> bool60 fn selects_multiple(&self) -> bool; 61 62 #[doc(alias = "gtk_recent_chooser_get_show_icons")] 63 #[doc(alias = "get_show_icons")] shows_icons(&self) -> bool64 fn shows_icons(&self) -> bool; 65 66 #[doc(alias = "gtk_recent_chooser_get_show_not_found")] 67 #[doc(alias = "get_show_not_found")] shows_not_found(&self) -> bool68 fn shows_not_found(&self) -> bool; 69 70 #[doc(alias = "gtk_recent_chooser_get_show_private")] 71 #[doc(alias = "get_show_private")] shows_private(&self) -> bool72 fn shows_private(&self) -> bool; 73 74 #[doc(alias = "gtk_recent_chooser_get_show_tips")] 75 #[doc(alias = "get_show_tips")] shows_tips(&self) -> bool76 fn shows_tips(&self) -> bool; 77 78 #[doc(alias = "gtk_recent_chooser_get_sort_type")] 79 #[doc(alias = "get_sort_type")] sort_type(&self) -> RecentSortType80 fn sort_type(&self) -> RecentSortType; 81 82 #[doc(alias = "gtk_recent_chooser_get_uris")] 83 #[doc(alias = "get_uris")] uris(&self) -> Vec<glib::GString>84 fn uris(&self) -> Vec<glib::GString>; 85 86 #[doc(alias = "gtk_recent_chooser_list_filters")] list_filters(&self) -> Vec<RecentFilter>87 fn list_filters(&self) -> Vec<RecentFilter>; 88 89 #[doc(alias = "gtk_recent_chooser_remove_filter")] remove_filter(&self, filter: &RecentFilter)90 fn remove_filter(&self, filter: &RecentFilter); 91 92 #[doc(alias = "gtk_recent_chooser_select_all")] select_all(&self)93 fn select_all(&self); 94 95 #[doc(alias = "gtk_recent_chooser_select_uri")] select_uri(&self, uri: &str) -> Result<(), glib::Error>96 fn select_uri(&self, uri: &str) -> Result<(), glib::Error>; 97 98 #[doc(alias = "gtk_recent_chooser_set_current_uri")] set_current_uri(&self, uri: &str) -> Result<(), glib::Error>99 fn set_current_uri(&self, uri: &str) -> Result<(), glib::Error>; 100 101 #[doc(alias = "gtk_recent_chooser_set_filter")] set_filter(&self, filter: Option<&RecentFilter>)102 fn set_filter(&self, filter: Option<&RecentFilter>); 103 104 #[doc(alias = "gtk_recent_chooser_set_limit")] set_limit(&self, limit: i32)105 fn set_limit(&self, limit: i32); 106 107 #[doc(alias = "gtk_recent_chooser_set_local_only")] set_local_only(&self, local_only: bool)108 fn set_local_only(&self, local_only: bool); 109 110 #[doc(alias = "gtk_recent_chooser_set_select_multiple")] set_select_multiple(&self, select_multiple: bool)111 fn set_select_multiple(&self, select_multiple: bool); 112 113 #[doc(alias = "gtk_recent_chooser_set_show_icons")] set_show_icons(&self, show_icons: bool)114 fn set_show_icons(&self, show_icons: bool); 115 116 #[doc(alias = "gtk_recent_chooser_set_show_not_found")] set_show_not_found(&self, show_not_found: bool)117 fn set_show_not_found(&self, show_not_found: bool); 118 119 #[doc(alias = "gtk_recent_chooser_set_show_private")] set_show_private(&self, show_private: bool)120 fn set_show_private(&self, show_private: bool); 121 122 #[doc(alias = "gtk_recent_chooser_set_show_tips")] set_show_tips(&self, show_tips: bool)123 fn set_show_tips(&self, show_tips: bool); 124 125 #[doc(alias = "gtk_recent_chooser_set_sort_func")] set_sort_func<P: Fn(&RecentInfo, &RecentInfo) -> i32 + 'static>(&self, sort_func: P)126 fn set_sort_func<P: Fn(&RecentInfo, &RecentInfo) -> i32 + 'static>(&self, sort_func: P); 127 128 #[doc(alias = "gtk_recent_chooser_set_sort_type")] set_sort_type(&self, sort_type: RecentSortType)129 fn set_sort_type(&self, sort_type: RecentSortType); 130 131 #[doc(alias = "gtk_recent_chooser_unselect_all")] unselect_all(&self)132 fn unselect_all(&self); 133 134 #[doc(alias = "gtk_recent_chooser_unselect_uri")] unselect_uri(&self, uri: &str)135 fn unselect_uri(&self, uri: &str); 136 137 #[doc(alias = "item-activated")] connect_item_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId138 fn connect_item_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 139 140 #[doc(alias = "selection-changed")] connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId141 fn connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 142 143 #[doc(alias = "filter")] connect_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId144 fn connect_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 145 146 #[doc(alias = "limit")] connect_limit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId147 fn connect_limit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 148 149 #[doc(alias = "local-only")] connect_local_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId150 fn connect_local_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 151 152 #[doc(alias = "select-multiple")] connect_select_multiple_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId153 fn connect_select_multiple_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 154 155 #[doc(alias = "show-icons")] connect_show_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId156 fn connect_show_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 157 158 #[doc(alias = "show-not-found")] connect_show_not_found_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId159 fn connect_show_not_found_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 160 161 #[doc(alias = "show-private")] connect_show_private_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId162 fn connect_show_private_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 163 164 #[doc(alias = "show-tips")] connect_show_tips_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId165 fn connect_show_tips_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 166 167 #[doc(alias = "sort-type")] connect_sort_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId168 fn connect_sort_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 169 } 170 171 impl<O: IsA<RecentChooser>> RecentChooserExt for O { add_filter(&self, filter: &RecentFilter)172 fn add_filter(&self, filter: &RecentFilter) { 173 unsafe { 174 ffi::gtk_recent_chooser_add_filter( 175 self.as_ref().to_glib_none().0, 176 filter.to_glib_none().0, 177 ); 178 } 179 } 180 current_item(&self) -> Option<RecentInfo>181 fn current_item(&self) -> Option<RecentInfo> { 182 unsafe { 183 from_glib_full(ffi::gtk_recent_chooser_get_current_item( 184 self.as_ref().to_glib_none().0, 185 )) 186 } 187 } 188 current_uri(&self) -> Option<glib::GString>189 fn current_uri(&self) -> Option<glib::GString> { 190 unsafe { 191 from_glib_full(ffi::gtk_recent_chooser_get_current_uri( 192 self.as_ref().to_glib_none().0, 193 )) 194 } 195 } 196 filter(&self) -> Option<RecentFilter>197 fn filter(&self) -> Option<RecentFilter> { 198 unsafe { 199 from_glib_none(ffi::gtk_recent_chooser_get_filter( 200 self.as_ref().to_glib_none().0, 201 )) 202 } 203 } 204 items(&self) -> Vec<RecentInfo>205 fn items(&self) -> Vec<RecentInfo> { 206 unsafe { 207 FromGlibPtrContainer::from_glib_full(ffi::gtk_recent_chooser_get_items( 208 self.as_ref().to_glib_none().0, 209 )) 210 } 211 } 212 limit(&self) -> i32213 fn limit(&self) -> i32 { 214 unsafe { ffi::gtk_recent_chooser_get_limit(self.as_ref().to_glib_none().0) } 215 } 216 is_local_only(&self) -> bool217 fn is_local_only(&self) -> bool { 218 unsafe { 219 from_glib(ffi::gtk_recent_chooser_get_local_only( 220 self.as_ref().to_glib_none().0, 221 )) 222 } 223 } 224 selects_multiple(&self) -> bool225 fn selects_multiple(&self) -> bool { 226 unsafe { 227 from_glib(ffi::gtk_recent_chooser_get_select_multiple( 228 self.as_ref().to_glib_none().0, 229 )) 230 } 231 } 232 shows_icons(&self) -> bool233 fn shows_icons(&self) -> bool { 234 unsafe { 235 from_glib(ffi::gtk_recent_chooser_get_show_icons( 236 self.as_ref().to_glib_none().0, 237 )) 238 } 239 } 240 shows_not_found(&self) -> bool241 fn shows_not_found(&self) -> bool { 242 unsafe { 243 from_glib(ffi::gtk_recent_chooser_get_show_not_found( 244 self.as_ref().to_glib_none().0, 245 )) 246 } 247 } 248 shows_private(&self) -> bool249 fn shows_private(&self) -> bool { 250 unsafe { 251 from_glib(ffi::gtk_recent_chooser_get_show_private( 252 self.as_ref().to_glib_none().0, 253 )) 254 } 255 } 256 shows_tips(&self) -> bool257 fn shows_tips(&self) -> bool { 258 unsafe { 259 from_glib(ffi::gtk_recent_chooser_get_show_tips( 260 self.as_ref().to_glib_none().0, 261 )) 262 } 263 } 264 sort_type(&self) -> RecentSortType265 fn sort_type(&self) -> RecentSortType { 266 unsafe { 267 from_glib(ffi::gtk_recent_chooser_get_sort_type( 268 self.as_ref().to_glib_none().0, 269 )) 270 } 271 } 272 uris(&self) -> Vec<glib::GString>273 fn uris(&self) -> Vec<glib::GString> { 274 unsafe { 275 let mut length = mem::MaybeUninit::uninit(); 276 let ret = FromGlibContainer::from_glib_full_num( 277 ffi::gtk_recent_chooser_get_uris( 278 self.as_ref().to_glib_none().0, 279 length.as_mut_ptr(), 280 ), 281 length.assume_init() as usize, 282 ); 283 ret 284 } 285 } 286 list_filters(&self) -> Vec<RecentFilter>287 fn list_filters(&self) -> Vec<RecentFilter> { 288 unsafe { 289 FromGlibPtrContainer::from_glib_container(ffi::gtk_recent_chooser_list_filters( 290 self.as_ref().to_glib_none().0, 291 )) 292 } 293 } 294 remove_filter(&self, filter: &RecentFilter)295 fn remove_filter(&self, filter: &RecentFilter) { 296 unsafe { 297 ffi::gtk_recent_chooser_remove_filter( 298 self.as_ref().to_glib_none().0, 299 filter.to_glib_none().0, 300 ); 301 } 302 } 303 select_all(&self)304 fn select_all(&self) { 305 unsafe { 306 ffi::gtk_recent_chooser_select_all(self.as_ref().to_glib_none().0); 307 } 308 } 309 select_uri(&self, uri: &str) -> Result<(), glib::Error>310 fn select_uri(&self, uri: &str) -> Result<(), glib::Error> { 311 unsafe { 312 let mut error = ptr::null_mut(); 313 let _ = ffi::gtk_recent_chooser_select_uri( 314 self.as_ref().to_glib_none().0, 315 uri.to_glib_none().0, 316 &mut error, 317 ); 318 if error.is_null() { 319 Ok(()) 320 } else { 321 Err(from_glib_full(error)) 322 } 323 } 324 } 325 set_current_uri(&self, uri: &str) -> Result<(), glib::Error>326 fn set_current_uri(&self, uri: &str) -> Result<(), glib::Error> { 327 unsafe { 328 let mut error = ptr::null_mut(); 329 let _ = ffi::gtk_recent_chooser_set_current_uri( 330 self.as_ref().to_glib_none().0, 331 uri.to_glib_none().0, 332 &mut error, 333 ); 334 if error.is_null() { 335 Ok(()) 336 } else { 337 Err(from_glib_full(error)) 338 } 339 } 340 } 341 set_filter(&self, filter: Option<&RecentFilter>)342 fn set_filter(&self, filter: Option<&RecentFilter>) { 343 unsafe { 344 ffi::gtk_recent_chooser_set_filter( 345 self.as_ref().to_glib_none().0, 346 filter.to_glib_none().0, 347 ); 348 } 349 } 350 set_limit(&self, limit: i32)351 fn set_limit(&self, limit: i32) { 352 unsafe { 353 ffi::gtk_recent_chooser_set_limit(self.as_ref().to_glib_none().0, limit); 354 } 355 } 356 set_local_only(&self, local_only: bool)357 fn set_local_only(&self, local_only: bool) { 358 unsafe { 359 ffi::gtk_recent_chooser_set_local_only( 360 self.as_ref().to_glib_none().0, 361 local_only.into_glib(), 362 ); 363 } 364 } 365 set_select_multiple(&self, select_multiple: bool)366 fn set_select_multiple(&self, select_multiple: bool) { 367 unsafe { 368 ffi::gtk_recent_chooser_set_select_multiple( 369 self.as_ref().to_glib_none().0, 370 select_multiple.into_glib(), 371 ); 372 } 373 } 374 set_show_icons(&self, show_icons: bool)375 fn set_show_icons(&self, show_icons: bool) { 376 unsafe { 377 ffi::gtk_recent_chooser_set_show_icons( 378 self.as_ref().to_glib_none().0, 379 show_icons.into_glib(), 380 ); 381 } 382 } 383 set_show_not_found(&self, show_not_found: bool)384 fn set_show_not_found(&self, show_not_found: bool) { 385 unsafe { 386 ffi::gtk_recent_chooser_set_show_not_found( 387 self.as_ref().to_glib_none().0, 388 show_not_found.into_glib(), 389 ); 390 } 391 } 392 set_show_private(&self, show_private: bool)393 fn set_show_private(&self, show_private: bool) { 394 unsafe { 395 ffi::gtk_recent_chooser_set_show_private( 396 self.as_ref().to_glib_none().0, 397 show_private.into_glib(), 398 ); 399 } 400 } 401 set_show_tips(&self, show_tips: bool)402 fn set_show_tips(&self, show_tips: bool) { 403 unsafe { 404 ffi::gtk_recent_chooser_set_show_tips( 405 self.as_ref().to_glib_none().0, 406 show_tips.into_glib(), 407 ); 408 } 409 } 410 set_sort_func<P: Fn(&RecentInfo, &RecentInfo) -> i32 + 'static>(&self, sort_func: P)411 fn set_sort_func<P: Fn(&RecentInfo, &RecentInfo) -> i32 + 'static>(&self, sort_func: P) { 412 let sort_func_data: Box_<P> = Box_::new(sort_func); 413 unsafe extern "C" fn sort_func_func<P: Fn(&RecentInfo, &RecentInfo) -> i32 + 'static>( 414 a: *mut ffi::GtkRecentInfo, 415 b: *mut ffi::GtkRecentInfo, 416 user_data: glib::ffi::gpointer, 417 ) -> libc::c_int { 418 let a = from_glib_borrow(a); 419 let b = from_glib_borrow(b); 420 let callback: &P = &*(user_data as *mut _); 421 let res = (*callback)(&a, &b); 422 res 423 } 424 let sort_func = Some(sort_func_func::<P> as _); 425 unsafe extern "C" fn data_destroy_func<P: Fn(&RecentInfo, &RecentInfo) -> i32 + 'static>( 426 data: glib::ffi::gpointer, 427 ) { 428 let _callback: Box_<P> = Box_::from_raw(data as *mut _); 429 } 430 let destroy_call3 = Some(data_destroy_func::<P> as _); 431 let super_callback0: Box_<P> = sort_func_data; 432 unsafe { 433 ffi::gtk_recent_chooser_set_sort_func( 434 self.as_ref().to_glib_none().0, 435 sort_func, 436 Box_::into_raw(super_callback0) as *mut _, 437 destroy_call3, 438 ); 439 } 440 } 441 set_sort_type(&self, sort_type: RecentSortType)442 fn set_sort_type(&self, sort_type: RecentSortType) { 443 unsafe { 444 ffi::gtk_recent_chooser_set_sort_type( 445 self.as_ref().to_glib_none().0, 446 sort_type.into_glib(), 447 ); 448 } 449 } 450 unselect_all(&self)451 fn unselect_all(&self) { 452 unsafe { 453 ffi::gtk_recent_chooser_unselect_all(self.as_ref().to_glib_none().0); 454 } 455 } 456 unselect_uri(&self, uri: &str)457 fn unselect_uri(&self, uri: &str) { 458 unsafe { 459 ffi::gtk_recent_chooser_unselect_uri( 460 self.as_ref().to_glib_none().0, 461 uri.to_glib_none().0, 462 ); 463 } 464 } 465 connect_item_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId466 fn connect_item_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 467 unsafe extern "C" fn item_activated_trampoline< 468 P: IsA<RecentChooser>, 469 F: Fn(&P) + 'static, 470 >( 471 this: *mut ffi::GtkRecentChooser, 472 f: glib::ffi::gpointer, 473 ) { 474 let f: &F = &*(f as *const F); 475 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 476 } 477 unsafe { 478 let f: Box_<F> = Box_::new(f); 479 connect_raw( 480 self.as_ptr() as *mut _, 481 b"item-activated\0".as_ptr() as *const _, 482 Some(transmute::<_, unsafe extern "C" fn()>( 483 item_activated_trampoline::<Self, F> as *const (), 484 )), 485 Box_::into_raw(f), 486 ) 487 } 488 } 489 connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId490 fn connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 491 unsafe extern "C" fn selection_changed_trampoline< 492 P: IsA<RecentChooser>, 493 F: Fn(&P) + 'static, 494 >( 495 this: *mut ffi::GtkRecentChooser, 496 f: glib::ffi::gpointer, 497 ) { 498 let f: &F = &*(f as *const F); 499 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 500 } 501 unsafe { 502 let f: Box_<F> = Box_::new(f); 503 connect_raw( 504 self.as_ptr() as *mut _, 505 b"selection-changed\0".as_ptr() as *const _, 506 Some(transmute::<_, unsafe extern "C" fn()>( 507 selection_changed_trampoline::<Self, F> as *const (), 508 )), 509 Box_::into_raw(f), 510 ) 511 } 512 } 513 connect_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId514 fn connect_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 515 unsafe extern "C" fn notify_filter_trampoline< 516 P: IsA<RecentChooser>, 517 F: Fn(&P) + 'static, 518 >( 519 this: *mut ffi::GtkRecentChooser, 520 _param_spec: glib::ffi::gpointer, 521 f: glib::ffi::gpointer, 522 ) { 523 let f: &F = &*(f as *const F); 524 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 525 } 526 unsafe { 527 let f: Box_<F> = Box_::new(f); 528 connect_raw( 529 self.as_ptr() as *mut _, 530 b"notify::filter\0".as_ptr() as *const _, 531 Some(transmute::<_, unsafe extern "C" fn()>( 532 notify_filter_trampoline::<Self, F> as *const (), 533 )), 534 Box_::into_raw(f), 535 ) 536 } 537 } 538 connect_limit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId539 fn connect_limit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 540 unsafe extern "C" fn notify_limit_trampoline<P: IsA<RecentChooser>, F: Fn(&P) + 'static>( 541 this: *mut ffi::GtkRecentChooser, 542 _param_spec: glib::ffi::gpointer, 543 f: glib::ffi::gpointer, 544 ) { 545 let f: &F = &*(f as *const F); 546 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 547 } 548 unsafe { 549 let f: Box_<F> = Box_::new(f); 550 connect_raw( 551 self.as_ptr() as *mut _, 552 b"notify::limit\0".as_ptr() as *const _, 553 Some(transmute::<_, unsafe extern "C" fn()>( 554 notify_limit_trampoline::<Self, F> as *const (), 555 )), 556 Box_::into_raw(f), 557 ) 558 } 559 } 560 connect_local_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId561 fn connect_local_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 562 unsafe extern "C" fn notify_local_only_trampoline< 563 P: IsA<RecentChooser>, 564 F: Fn(&P) + 'static, 565 >( 566 this: *mut ffi::GtkRecentChooser, 567 _param_spec: glib::ffi::gpointer, 568 f: glib::ffi::gpointer, 569 ) { 570 let f: &F = &*(f as *const F); 571 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 572 } 573 unsafe { 574 let f: Box_<F> = Box_::new(f); 575 connect_raw( 576 self.as_ptr() as *mut _, 577 b"notify::local-only\0".as_ptr() as *const _, 578 Some(transmute::<_, unsafe extern "C" fn()>( 579 notify_local_only_trampoline::<Self, F> as *const (), 580 )), 581 Box_::into_raw(f), 582 ) 583 } 584 } 585 connect_select_multiple_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId586 fn connect_select_multiple_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 587 unsafe extern "C" fn notify_select_multiple_trampoline< 588 P: IsA<RecentChooser>, 589 F: Fn(&P) + 'static, 590 >( 591 this: *mut ffi::GtkRecentChooser, 592 _param_spec: glib::ffi::gpointer, 593 f: glib::ffi::gpointer, 594 ) { 595 let f: &F = &*(f as *const F); 596 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 597 } 598 unsafe { 599 let f: Box_<F> = Box_::new(f); 600 connect_raw( 601 self.as_ptr() as *mut _, 602 b"notify::select-multiple\0".as_ptr() as *const _, 603 Some(transmute::<_, unsafe extern "C" fn()>( 604 notify_select_multiple_trampoline::<Self, F> as *const (), 605 )), 606 Box_::into_raw(f), 607 ) 608 } 609 } 610 connect_show_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId611 fn connect_show_icons_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 612 unsafe extern "C" fn notify_show_icons_trampoline< 613 P: IsA<RecentChooser>, 614 F: Fn(&P) + 'static, 615 >( 616 this: *mut ffi::GtkRecentChooser, 617 _param_spec: glib::ffi::gpointer, 618 f: glib::ffi::gpointer, 619 ) { 620 let f: &F = &*(f as *const F); 621 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 622 } 623 unsafe { 624 let f: Box_<F> = Box_::new(f); 625 connect_raw( 626 self.as_ptr() as *mut _, 627 b"notify::show-icons\0".as_ptr() as *const _, 628 Some(transmute::<_, unsafe extern "C" fn()>( 629 notify_show_icons_trampoline::<Self, F> as *const (), 630 )), 631 Box_::into_raw(f), 632 ) 633 } 634 } 635 connect_show_not_found_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId636 fn connect_show_not_found_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 637 unsafe extern "C" fn notify_show_not_found_trampoline< 638 P: IsA<RecentChooser>, 639 F: Fn(&P) + 'static, 640 >( 641 this: *mut ffi::GtkRecentChooser, 642 _param_spec: glib::ffi::gpointer, 643 f: glib::ffi::gpointer, 644 ) { 645 let f: &F = &*(f as *const F); 646 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 647 } 648 unsafe { 649 let f: Box_<F> = Box_::new(f); 650 connect_raw( 651 self.as_ptr() as *mut _, 652 b"notify::show-not-found\0".as_ptr() as *const _, 653 Some(transmute::<_, unsafe extern "C" fn()>( 654 notify_show_not_found_trampoline::<Self, F> as *const (), 655 )), 656 Box_::into_raw(f), 657 ) 658 } 659 } 660 connect_show_private_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId661 fn connect_show_private_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 662 unsafe extern "C" fn notify_show_private_trampoline< 663 P: IsA<RecentChooser>, 664 F: Fn(&P) + 'static, 665 >( 666 this: *mut ffi::GtkRecentChooser, 667 _param_spec: glib::ffi::gpointer, 668 f: glib::ffi::gpointer, 669 ) { 670 let f: &F = &*(f as *const F); 671 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 672 } 673 unsafe { 674 let f: Box_<F> = Box_::new(f); 675 connect_raw( 676 self.as_ptr() as *mut _, 677 b"notify::show-private\0".as_ptr() as *const _, 678 Some(transmute::<_, unsafe extern "C" fn()>( 679 notify_show_private_trampoline::<Self, F> as *const (), 680 )), 681 Box_::into_raw(f), 682 ) 683 } 684 } 685 connect_show_tips_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId686 fn connect_show_tips_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 687 unsafe extern "C" fn notify_show_tips_trampoline< 688 P: IsA<RecentChooser>, 689 F: Fn(&P) + 'static, 690 >( 691 this: *mut ffi::GtkRecentChooser, 692 _param_spec: glib::ffi::gpointer, 693 f: glib::ffi::gpointer, 694 ) { 695 let f: &F = &*(f as *const F); 696 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 697 } 698 unsafe { 699 let f: Box_<F> = Box_::new(f); 700 connect_raw( 701 self.as_ptr() as *mut _, 702 b"notify::show-tips\0".as_ptr() as *const _, 703 Some(transmute::<_, unsafe extern "C" fn()>( 704 notify_show_tips_trampoline::<Self, F> as *const (), 705 )), 706 Box_::into_raw(f), 707 ) 708 } 709 } 710 connect_sort_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId711 fn connect_sort_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 712 unsafe extern "C" fn notify_sort_type_trampoline< 713 P: IsA<RecentChooser>, 714 F: Fn(&P) + 'static, 715 >( 716 this: *mut ffi::GtkRecentChooser, 717 _param_spec: glib::ffi::gpointer, 718 f: glib::ffi::gpointer, 719 ) { 720 let f: &F = &*(f as *const F); 721 f(RecentChooser::from_glib_borrow(this).unsafe_cast_ref()) 722 } 723 unsafe { 724 let f: Box_<F> = Box_::new(f); 725 connect_raw( 726 self.as_ptr() as *mut _, 727 b"notify::sort-type\0".as_ptr() as *const _, 728 Some(transmute::<_, unsafe extern "C" fn()>( 729 notify_sort_type_trampoline::<Self, F> as *const (), 730 )), 731 Box_::into_raw(f), 732 ) 733 } 734 } 735 } 736 737 impl fmt::Display for RecentChooser { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result738 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 739 f.write_str("RecentChooser") 740 } 741 } 742