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::FileChooserAction; 6 use crate::FileChooserConfirmation; 7 use crate::FileFilter; 8 use crate::Widget; 9 use glib::object::Cast; 10 use glib::object::IsA; 11 use glib::signal::connect_raw; 12 use glib::signal::SignalHandlerId; 13 use glib::translate::*; 14 use std::boxed::Box as Box_; 15 use std::fmt; 16 use std::mem::transmute; 17 use std::ptr; 18 19 glib::wrapper! { 20 #[doc(alias = "GtkFileChooser")] 21 pub struct FileChooser(Interface<ffi::GtkFileChooser>); 22 23 match fn { 24 type_ => || ffi::gtk_file_chooser_get_type(), 25 } 26 } 27 28 pub const NONE_FILE_CHOOSER: Option<&FileChooser> = None; 29 30 pub trait FileChooserExt: 'static { 31 #[doc(alias = "gtk_file_chooser_add_filter")] add_filter(&self, filter: &FileFilter)32 fn add_filter(&self, filter: &FileFilter); 33 34 #[doc(alias = "gtk_file_chooser_add_shortcut_folder")] add_shortcut_folder<P: AsRef<std::path::Path>>(&self, folder: P) -> Result<(), glib::Error>35 fn add_shortcut_folder<P: AsRef<std::path::Path>>(&self, folder: P) -> Result<(), glib::Error>; 36 37 #[doc(alias = "gtk_file_chooser_add_shortcut_folder_uri")] add_shortcut_folder_uri(&self, uri: &str) -> Result<(), glib::Error>38 fn add_shortcut_folder_uri(&self, uri: &str) -> Result<(), glib::Error>; 39 40 #[doc(alias = "gtk_file_chooser_get_action")] 41 #[doc(alias = "get_action")] action(&self) -> FileChooserAction42 fn action(&self) -> FileChooserAction; 43 44 #[cfg(any(feature = "v3_22", feature = "dox"))] 45 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 46 #[doc(alias = "gtk_file_chooser_get_choice")] 47 #[doc(alias = "get_choice")] choice(&self, id: &str) -> Option<glib::GString>48 fn choice(&self, id: &str) -> Option<glib::GString>; 49 50 #[doc(alias = "gtk_file_chooser_get_create_folders")] 51 #[doc(alias = "get_create_folders")] creates_folders(&self) -> bool52 fn creates_folders(&self) -> bool; 53 54 #[doc(alias = "gtk_file_chooser_get_current_folder")] 55 #[doc(alias = "get_current_folder")] current_folder(&self) -> Option<std::path::PathBuf>56 fn current_folder(&self) -> Option<std::path::PathBuf>; 57 58 #[doc(alias = "gtk_file_chooser_get_current_folder_file")] 59 #[doc(alias = "get_current_folder_file")] current_folder_file(&self) -> Option<gio::File>60 fn current_folder_file(&self) -> Option<gio::File>; 61 62 #[doc(alias = "gtk_file_chooser_get_current_folder_uri")] 63 #[doc(alias = "get_current_folder_uri")] current_folder_uri(&self) -> Option<glib::GString>64 fn current_folder_uri(&self) -> Option<glib::GString>; 65 66 #[doc(alias = "gtk_file_chooser_get_current_name")] 67 #[doc(alias = "get_current_name")] current_name(&self) -> Option<glib::GString>68 fn current_name(&self) -> Option<glib::GString>; 69 70 #[doc(alias = "gtk_file_chooser_get_do_overwrite_confirmation")] 71 #[doc(alias = "get_do_overwrite_confirmation")] does_overwrite_confirmation(&self) -> bool72 fn does_overwrite_confirmation(&self) -> bool; 73 74 #[doc(alias = "gtk_file_chooser_get_extra_widget")] 75 #[doc(alias = "get_extra_widget")] extra_widget(&self) -> Option<Widget>76 fn extra_widget(&self) -> Option<Widget>; 77 78 #[doc(alias = "gtk_file_chooser_get_file")] 79 #[doc(alias = "get_file")] file(&self) -> Option<gio::File>80 fn file(&self) -> Option<gio::File>; 81 82 #[doc(alias = "gtk_file_chooser_get_filename")] 83 #[doc(alias = "get_filename")] filename(&self) -> Option<std::path::PathBuf>84 fn filename(&self) -> Option<std::path::PathBuf>; 85 86 #[doc(alias = "gtk_file_chooser_get_filenames")] 87 #[doc(alias = "get_filenames")] filenames(&self) -> Vec<std::path::PathBuf>88 fn filenames(&self) -> Vec<std::path::PathBuf>; 89 90 #[doc(alias = "gtk_file_chooser_get_files")] 91 #[doc(alias = "get_files")] files(&self) -> Vec<gio::File>92 fn files(&self) -> Vec<gio::File>; 93 94 #[doc(alias = "gtk_file_chooser_get_filter")] 95 #[doc(alias = "get_filter")] filter(&self) -> Option<FileFilter>96 fn filter(&self) -> Option<FileFilter>; 97 98 #[doc(alias = "gtk_file_chooser_get_local_only")] 99 #[doc(alias = "get_local_only")] is_local_only(&self) -> bool100 fn is_local_only(&self) -> bool; 101 102 #[doc(alias = "gtk_file_chooser_get_preview_file")] 103 #[doc(alias = "get_preview_file")] preview_file(&self) -> Option<gio::File>104 fn preview_file(&self) -> Option<gio::File>; 105 106 #[doc(alias = "gtk_file_chooser_get_preview_filename")] 107 #[doc(alias = "get_preview_filename")] preview_filename(&self) -> Option<std::path::PathBuf>108 fn preview_filename(&self) -> Option<std::path::PathBuf>; 109 110 #[doc(alias = "gtk_file_chooser_get_preview_uri")] 111 #[doc(alias = "get_preview_uri")] preview_uri(&self) -> Option<glib::GString>112 fn preview_uri(&self) -> Option<glib::GString>; 113 114 #[doc(alias = "gtk_file_chooser_get_preview_widget")] 115 #[doc(alias = "get_preview_widget")] preview_widget(&self) -> Option<Widget>116 fn preview_widget(&self) -> Option<Widget>; 117 118 #[doc(alias = "gtk_file_chooser_get_preview_widget_active")] 119 #[doc(alias = "get_preview_widget_active")] is_preview_widget_active(&self) -> bool120 fn is_preview_widget_active(&self) -> bool; 121 122 #[doc(alias = "gtk_file_chooser_get_select_multiple")] 123 #[doc(alias = "get_select_multiple")] selects_multiple(&self) -> bool124 fn selects_multiple(&self) -> bool; 125 126 #[doc(alias = "gtk_file_chooser_get_show_hidden")] 127 #[doc(alias = "get_show_hidden")] shows_hidden(&self) -> bool128 fn shows_hidden(&self) -> bool; 129 130 #[doc(alias = "gtk_file_chooser_get_uri")] 131 #[doc(alias = "get_uri")] uri(&self) -> Option<glib::GString>132 fn uri(&self) -> Option<glib::GString>; 133 134 #[doc(alias = "gtk_file_chooser_get_uris")] 135 #[doc(alias = "get_uris")] uris(&self) -> Vec<glib::GString>136 fn uris(&self) -> Vec<glib::GString>; 137 138 #[doc(alias = "gtk_file_chooser_get_use_preview_label")] 139 #[doc(alias = "get_use_preview_label")] uses_preview_label(&self) -> bool140 fn uses_preview_label(&self) -> bool; 141 142 #[doc(alias = "gtk_file_chooser_list_filters")] list_filters(&self) -> Vec<FileFilter>143 fn list_filters(&self) -> Vec<FileFilter>; 144 145 #[doc(alias = "gtk_file_chooser_list_shortcut_folder_uris")] list_shortcut_folder_uris(&self) -> Vec<glib::GString>146 fn list_shortcut_folder_uris(&self) -> Vec<glib::GString>; 147 148 #[doc(alias = "gtk_file_chooser_list_shortcut_folders")] list_shortcut_folders(&self) -> Vec<std::path::PathBuf>149 fn list_shortcut_folders(&self) -> Vec<std::path::PathBuf>; 150 151 #[cfg(any(feature = "v3_22", feature = "dox"))] 152 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 153 #[doc(alias = "gtk_file_chooser_remove_choice")] remove_choice(&self, id: &str)154 fn remove_choice(&self, id: &str); 155 156 #[doc(alias = "gtk_file_chooser_remove_filter")] remove_filter(&self, filter: &FileFilter)157 fn remove_filter(&self, filter: &FileFilter); 158 159 #[doc(alias = "gtk_file_chooser_remove_shortcut_folder")] remove_shortcut_folder<P: AsRef<std::path::Path>>( &self, folder: P, ) -> Result<(), glib::Error>160 fn remove_shortcut_folder<P: AsRef<std::path::Path>>( 161 &self, 162 folder: P, 163 ) -> Result<(), glib::Error>; 164 165 #[doc(alias = "gtk_file_chooser_remove_shortcut_folder_uri")] remove_shortcut_folder_uri(&self, uri: &str) -> Result<(), glib::Error>166 fn remove_shortcut_folder_uri(&self, uri: &str) -> Result<(), glib::Error>; 167 168 #[doc(alias = "gtk_file_chooser_select_all")] select_all(&self)169 fn select_all(&self); 170 171 #[doc(alias = "gtk_file_chooser_select_file")] select_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error>172 fn select_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error>; 173 174 #[doc(alias = "gtk_file_chooser_select_filename")] select_filename<P: AsRef<std::path::Path>>(&self, filename: P) -> bool175 fn select_filename<P: AsRef<std::path::Path>>(&self, filename: P) -> bool; 176 177 #[doc(alias = "gtk_file_chooser_select_uri")] select_uri(&self, uri: &str) -> bool178 fn select_uri(&self, uri: &str) -> bool; 179 180 #[doc(alias = "gtk_file_chooser_set_action")] set_action(&self, action: FileChooserAction)181 fn set_action(&self, action: FileChooserAction); 182 183 #[cfg(any(feature = "v3_22", feature = "dox"))] 184 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 185 #[doc(alias = "gtk_file_chooser_set_choice")] set_choice(&self, id: &str, option: &str)186 fn set_choice(&self, id: &str, option: &str); 187 188 #[doc(alias = "gtk_file_chooser_set_create_folders")] set_create_folders(&self, create_folders: bool)189 fn set_create_folders(&self, create_folders: bool); 190 191 #[doc(alias = "gtk_file_chooser_set_current_folder")] set_current_folder<P: AsRef<std::path::Path>>(&self, filename: P) -> bool192 fn set_current_folder<P: AsRef<std::path::Path>>(&self, filename: P) -> bool; 193 194 #[doc(alias = "gtk_file_chooser_set_current_folder_file")] set_current_folder_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error>195 fn set_current_folder_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error>; 196 197 #[doc(alias = "gtk_file_chooser_set_current_folder_uri")] set_current_folder_uri(&self, uri: &str) -> bool198 fn set_current_folder_uri(&self, uri: &str) -> bool; 199 200 #[doc(alias = "gtk_file_chooser_set_current_name")] set_current_name(&self, name: &str)201 fn set_current_name(&self, name: &str); 202 203 #[doc(alias = "gtk_file_chooser_set_do_overwrite_confirmation")] set_do_overwrite_confirmation(&self, do_overwrite_confirmation: bool)204 fn set_do_overwrite_confirmation(&self, do_overwrite_confirmation: bool); 205 206 #[doc(alias = "gtk_file_chooser_set_extra_widget")] set_extra_widget<P: IsA<Widget>>(&self, extra_widget: &P)207 fn set_extra_widget<P: IsA<Widget>>(&self, extra_widget: &P); 208 209 #[doc(alias = "gtk_file_chooser_set_file")] set_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error>210 fn set_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error>; 211 212 #[doc(alias = "gtk_file_chooser_set_filename")] set_filename<P: AsRef<std::path::Path>>(&self, filename: P) -> bool213 fn set_filename<P: AsRef<std::path::Path>>(&self, filename: P) -> bool; 214 215 #[doc(alias = "gtk_file_chooser_set_filter")] set_filter(&self, filter: &FileFilter)216 fn set_filter(&self, filter: &FileFilter); 217 218 #[doc(alias = "gtk_file_chooser_set_local_only")] set_local_only(&self, local_only: bool)219 fn set_local_only(&self, local_only: bool); 220 221 #[doc(alias = "gtk_file_chooser_set_preview_widget")] set_preview_widget<P: IsA<Widget>>(&self, preview_widget: &P)222 fn set_preview_widget<P: IsA<Widget>>(&self, preview_widget: &P); 223 224 #[doc(alias = "gtk_file_chooser_set_preview_widget_active")] set_preview_widget_active(&self, active: bool)225 fn set_preview_widget_active(&self, active: bool); 226 227 #[doc(alias = "gtk_file_chooser_set_select_multiple")] set_select_multiple(&self, select_multiple: bool)228 fn set_select_multiple(&self, select_multiple: bool); 229 230 #[doc(alias = "gtk_file_chooser_set_show_hidden")] set_show_hidden(&self, show_hidden: bool)231 fn set_show_hidden(&self, show_hidden: bool); 232 233 #[doc(alias = "gtk_file_chooser_set_uri")] set_uri(&self, uri: &str) -> bool234 fn set_uri(&self, uri: &str) -> bool; 235 236 #[doc(alias = "gtk_file_chooser_set_use_preview_label")] set_use_preview_label(&self, use_label: bool)237 fn set_use_preview_label(&self, use_label: bool); 238 239 #[doc(alias = "gtk_file_chooser_unselect_all")] unselect_all(&self)240 fn unselect_all(&self); 241 242 #[doc(alias = "gtk_file_chooser_unselect_file")] unselect_file<P: IsA<gio::File>>(&self, file: &P)243 fn unselect_file<P: IsA<gio::File>>(&self, file: &P); 244 245 #[doc(alias = "gtk_file_chooser_unselect_filename")] unselect_filename<P: AsRef<std::path::Path>>(&self, filename: P)246 fn unselect_filename<P: AsRef<std::path::Path>>(&self, filename: P); 247 248 #[doc(alias = "gtk_file_chooser_unselect_uri")] unselect_uri(&self, uri: &str)249 fn unselect_uri(&self, uri: &str); 250 251 #[doc(alias = "confirm-overwrite")] connect_confirm_overwrite<F: Fn(&Self) -> FileChooserConfirmation + 'static>( &self, f: F, ) -> SignalHandlerId252 fn connect_confirm_overwrite<F: Fn(&Self) -> FileChooserConfirmation + 'static>( 253 &self, 254 f: F, 255 ) -> SignalHandlerId; 256 257 #[doc(alias = "current-folder-changed")] connect_current_folder_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId258 fn connect_current_folder_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 259 260 #[doc(alias = "file-activated")] connect_file_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId261 fn connect_file_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 262 263 #[doc(alias = "selection-changed")] connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId264 fn connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 265 266 #[doc(alias = "update-preview")] connect_update_preview<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId267 fn connect_update_preview<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 268 269 #[doc(alias = "action")] connect_action_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId270 fn connect_action_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 271 272 #[doc(alias = "create-folders")] connect_create_folders_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId273 fn connect_create_folders_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 274 275 #[doc(alias = "do-overwrite-confirmation")] connect_do_overwrite_confirmation_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId276 fn connect_do_overwrite_confirmation_notify<F: Fn(&Self) + 'static>( 277 &self, 278 f: F, 279 ) -> SignalHandlerId; 280 281 #[doc(alias = "extra-widget")] connect_extra_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId282 fn connect_extra_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 283 284 #[doc(alias = "filter")] connect_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId285 fn connect_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 286 287 #[doc(alias = "local-only")] connect_local_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId288 fn connect_local_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 289 290 #[doc(alias = "preview-widget")] connect_preview_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId291 fn connect_preview_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 292 293 #[doc(alias = "preview-widget-active")] connect_preview_widget_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId294 fn connect_preview_widget_active_notify<F: Fn(&Self) + 'static>(&self, f: F) 295 -> SignalHandlerId; 296 297 #[doc(alias = "select-multiple")] connect_select_multiple_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId298 fn connect_select_multiple_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 299 300 #[doc(alias = "show-hidden")] connect_show_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId301 fn connect_show_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 302 303 #[doc(alias = "use-preview-label")] connect_use_preview_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId304 fn connect_use_preview_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 305 } 306 307 impl<O: IsA<FileChooser>> FileChooserExt for O { add_filter(&self, filter: &FileFilter)308 fn add_filter(&self, filter: &FileFilter) { 309 unsafe { 310 ffi::gtk_file_chooser_add_filter(self.as_ref().to_glib_none().0, filter.to_glib_full()); 311 } 312 } 313 add_shortcut_folder<P: AsRef<std::path::Path>>(&self, folder: P) -> Result<(), glib::Error>314 fn add_shortcut_folder<P: AsRef<std::path::Path>>(&self, folder: P) -> Result<(), glib::Error> { 315 unsafe { 316 let mut error = ptr::null_mut(); 317 let _ = ffi::gtk_file_chooser_add_shortcut_folder( 318 self.as_ref().to_glib_none().0, 319 folder.as_ref().to_glib_none().0, 320 &mut error, 321 ); 322 if error.is_null() { 323 Ok(()) 324 } else { 325 Err(from_glib_full(error)) 326 } 327 } 328 } 329 add_shortcut_folder_uri(&self, uri: &str) -> Result<(), glib::Error>330 fn add_shortcut_folder_uri(&self, uri: &str) -> Result<(), glib::Error> { 331 unsafe { 332 let mut error = ptr::null_mut(); 333 let _ = ffi::gtk_file_chooser_add_shortcut_folder_uri( 334 self.as_ref().to_glib_none().0, 335 uri.to_glib_none().0, 336 &mut error, 337 ); 338 if error.is_null() { 339 Ok(()) 340 } else { 341 Err(from_glib_full(error)) 342 } 343 } 344 } 345 action(&self) -> FileChooserAction346 fn action(&self) -> FileChooserAction { 347 unsafe { 348 from_glib(ffi::gtk_file_chooser_get_action( 349 self.as_ref().to_glib_none().0, 350 )) 351 } 352 } 353 354 #[cfg(any(feature = "v3_22", feature = "dox"))] 355 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] choice(&self, id: &str) -> Option<glib::GString>356 fn choice(&self, id: &str) -> Option<glib::GString> { 357 unsafe { 358 from_glib_none(ffi::gtk_file_chooser_get_choice( 359 self.as_ref().to_glib_none().0, 360 id.to_glib_none().0, 361 )) 362 } 363 } 364 creates_folders(&self) -> bool365 fn creates_folders(&self) -> bool { 366 unsafe { 367 from_glib(ffi::gtk_file_chooser_get_create_folders( 368 self.as_ref().to_glib_none().0, 369 )) 370 } 371 } 372 current_folder(&self) -> Option<std::path::PathBuf>373 fn current_folder(&self) -> Option<std::path::PathBuf> { 374 unsafe { 375 from_glib_full(ffi::gtk_file_chooser_get_current_folder( 376 self.as_ref().to_glib_none().0, 377 )) 378 } 379 } 380 current_folder_file(&self) -> Option<gio::File>381 fn current_folder_file(&self) -> Option<gio::File> { 382 unsafe { 383 from_glib_full(ffi::gtk_file_chooser_get_current_folder_file( 384 self.as_ref().to_glib_none().0, 385 )) 386 } 387 } 388 current_folder_uri(&self) -> Option<glib::GString>389 fn current_folder_uri(&self) -> Option<glib::GString> { 390 unsafe { 391 from_glib_full(ffi::gtk_file_chooser_get_current_folder_uri( 392 self.as_ref().to_glib_none().0, 393 )) 394 } 395 } 396 current_name(&self) -> Option<glib::GString>397 fn current_name(&self) -> Option<glib::GString> { 398 unsafe { 399 from_glib_full(ffi::gtk_file_chooser_get_current_name( 400 self.as_ref().to_glib_none().0, 401 )) 402 } 403 } 404 does_overwrite_confirmation(&self) -> bool405 fn does_overwrite_confirmation(&self) -> bool { 406 unsafe { 407 from_glib(ffi::gtk_file_chooser_get_do_overwrite_confirmation( 408 self.as_ref().to_glib_none().0, 409 )) 410 } 411 } 412 extra_widget(&self) -> Option<Widget>413 fn extra_widget(&self) -> Option<Widget> { 414 unsafe { 415 from_glib_none(ffi::gtk_file_chooser_get_extra_widget( 416 self.as_ref().to_glib_none().0, 417 )) 418 } 419 } 420 file(&self) -> Option<gio::File>421 fn file(&self) -> Option<gio::File> { 422 unsafe { 423 from_glib_full(ffi::gtk_file_chooser_get_file( 424 self.as_ref().to_glib_none().0, 425 )) 426 } 427 } 428 filename(&self) -> Option<std::path::PathBuf>429 fn filename(&self) -> Option<std::path::PathBuf> { 430 unsafe { 431 from_glib_full(ffi::gtk_file_chooser_get_filename( 432 self.as_ref().to_glib_none().0, 433 )) 434 } 435 } 436 filenames(&self) -> Vec<std::path::PathBuf>437 fn filenames(&self) -> Vec<std::path::PathBuf> { 438 unsafe { 439 FromGlibPtrContainer::from_glib_full(ffi::gtk_file_chooser_get_filenames( 440 self.as_ref().to_glib_none().0, 441 )) 442 } 443 } 444 files(&self) -> Vec<gio::File>445 fn files(&self) -> Vec<gio::File> { 446 unsafe { 447 FromGlibPtrContainer::from_glib_full(ffi::gtk_file_chooser_get_files( 448 self.as_ref().to_glib_none().0, 449 )) 450 } 451 } 452 filter(&self) -> Option<FileFilter>453 fn filter(&self) -> Option<FileFilter> { 454 unsafe { 455 from_glib_none(ffi::gtk_file_chooser_get_filter( 456 self.as_ref().to_glib_none().0, 457 )) 458 } 459 } 460 is_local_only(&self) -> bool461 fn is_local_only(&self) -> bool { 462 unsafe { 463 from_glib(ffi::gtk_file_chooser_get_local_only( 464 self.as_ref().to_glib_none().0, 465 )) 466 } 467 } 468 preview_file(&self) -> Option<gio::File>469 fn preview_file(&self) -> Option<gio::File> { 470 unsafe { 471 from_glib_full(ffi::gtk_file_chooser_get_preview_file( 472 self.as_ref().to_glib_none().0, 473 )) 474 } 475 } 476 preview_filename(&self) -> Option<std::path::PathBuf>477 fn preview_filename(&self) -> Option<std::path::PathBuf> { 478 unsafe { 479 from_glib_full(ffi::gtk_file_chooser_get_preview_filename( 480 self.as_ref().to_glib_none().0, 481 )) 482 } 483 } 484 preview_uri(&self) -> Option<glib::GString>485 fn preview_uri(&self) -> Option<glib::GString> { 486 unsafe { 487 from_glib_full(ffi::gtk_file_chooser_get_preview_uri( 488 self.as_ref().to_glib_none().0, 489 )) 490 } 491 } 492 preview_widget(&self) -> Option<Widget>493 fn preview_widget(&self) -> Option<Widget> { 494 unsafe { 495 from_glib_none(ffi::gtk_file_chooser_get_preview_widget( 496 self.as_ref().to_glib_none().0, 497 )) 498 } 499 } 500 is_preview_widget_active(&self) -> bool501 fn is_preview_widget_active(&self) -> bool { 502 unsafe { 503 from_glib(ffi::gtk_file_chooser_get_preview_widget_active( 504 self.as_ref().to_glib_none().0, 505 )) 506 } 507 } 508 selects_multiple(&self) -> bool509 fn selects_multiple(&self) -> bool { 510 unsafe { 511 from_glib(ffi::gtk_file_chooser_get_select_multiple( 512 self.as_ref().to_glib_none().0, 513 )) 514 } 515 } 516 shows_hidden(&self) -> bool517 fn shows_hidden(&self) -> bool { 518 unsafe { 519 from_glib(ffi::gtk_file_chooser_get_show_hidden( 520 self.as_ref().to_glib_none().0, 521 )) 522 } 523 } 524 uri(&self) -> Option<glib::GString>525 fn uri(&self) -> Option<glib::GString> { 526 unsafe { 527 from_glib_full(ffi::gtk_file_chooser_get_uri( 528 self.as_ref().to_glib_none().0, 529 )) 530 } 531 } 532 uris(&self) -> Vec<glib::GString>533 fn uris(&self) -> Vec<glib::GString> { 534 unsafe { 535 FromGlibPtrContainer::from_glib_full(ffi::gtk_file_chooser_get_uris( 536 self.as_ref().to_glib_none().0, 537 )) 538 } 539 } 540 uses_preview_label(&self) -> bool541 fn uses_preview_label(&self) -> bool { 542 unsafe { 543 from_glib(ffi::gtk_file_chooser_get_use_preview_label( 544 self.as_ref().to_glib_none().0, 545 )) 546 } 547 } 548 list_filters(&self) -> Vec<FileFilter>549 fn list_filters(&self) -> Vec<FileFilter> { 550 unsafe { 551 FromGlibPtrContainer::from_glib_container(ffi::gtk_file_chooser_list_filters( 552 self.as_ref().to_glib_none().0, 553 )) 554 } 555 } 556 list_shortcut_folder_uris(&self) -> Vec<glib::GString>557 fn list_shortcut_folder_uris(&self) -> Vec<glib::GString> { 558 unsafe { 559 FromGlibPtrContainer::from_glib_full(ffi::gtk_file_chooser_list_shortcut_folder_uris( 560 self.as_ref().to_glib_none().0, 561 )) 562 } 563 } 564 list_shortcut_folders(&self) -> Vec<std::path::PathBuf>565 fn list_shortcut_folders(&self) -> Vec<std::path::PathBuf> { 566 unsafe { 567 FromGlibPtrContainer::from_glib_full(ffi::gtk_file_chooser_list_shortcut_folders( 568 self.as_ref().to_glib_none().0, 569 )) 570 } 571 } 572 573 #[cfg(any(feature = "v3_22", feature = "dox"))] 574 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] remove_choice(&self, id: &str)575 fn remove_choice(&self, id: &str) { 576 unsafe { 577 ffi::gtk_file_chooser_remove_choice( 578 self.as_ref().to_glib_none().0, 579 id.to_glib_none().0, 580 ); 581 } 582 } 583 remove_filter(&self, filter: &FileFilter)584 fn remove_filter(&self, filter: &FileFilter) { 585 unsafe { 586 ffi::gtk_file_chooser_remove_filter( 587 self.as_ref().to_glib_none().0, 588 filter.to_glib_none().0, 589 ); 590 } 591 } 592 remove_shortcut_folder<P: AsRef<std::path::Path>>( &self, folder: P, ) -> Result<(), glib::Error>593 fn remove_shortcut_folder<P: AsRef<std::path::Path>>( 594 &self, 595 folder: P, 596 ) -> Result<(), glib::Error> { 597 unsafe { 598 let mut error = ptr::null_mut(); 599 let _ = ffi::gtk_file_chooser_remove_shortcut_folder( 600 self.as_ref().to_glib_none().0, 601 folder.as_ref().to_glib_none().0, 602 &mut error, 603 ); 604 if error.is_null() { 605 Ok(()) 606 } else { 607 Err(from_glib_full(error)) 608 } 609 } 610 } 611 remove_shortcut_folder_uri(&self, uri: &str) -> Result<(), glib::Error>612 fn remove_shortcut_folder_uri(&self, uri: &str) -> Result<(), glib::Error> { 613 unsafe { 614 let mut error = ptr::null_mut(); 615 let _ = ffi::gtk_file_chooser_remove_shortcut_folder_uri( 616 self.as_ref().to_glib_none().0, 617 uri.to_glib_none().0, 618 &mut error, 619 ); 620 if error.is_null() { 621 Ok(()) 622 } else { 623 Err(from_glib_full(error)) 624 } 625 } 626 } 627 select_all(&self)628 fn select_all(&self) { 629 unsafe { 630 ffi::gtk_file_chooser_select_all(self.as_ref().to_glib_none().0); 631 } 632 } 633 select_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error>634 fn select_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error> { 635 unsafe { 636 let mut error = ptr::null_mut(); 637 let _ = ffi::gtk_file_chooser_select_file( 638 self.as_ref().to_glib_none().0, 639 file.as_ref().to_glib_none().0, 640 &mut error, 641 ); 642 if error.is_null() { 643 Ok(()) 644 } else { 645 Err(from_glib_full(error)) 646 } 647 } 648 } 649 select_filename<P: AsRef<std::path::Path>>(&self, filename: P) -> bool650 fn select_filename<P: AsRef<std::path::Path>>(&self, filename: P) -> bool { 651 unsafe { 652 from_glib(ffi::gtk_file_chooser_select_filename( 653 self.as_ref().to_glib_none().0, 654 filename.as_ref().to_glib_none().0, 655 )) 656 } 657 } 658 select_uri(&self, uri: &str) -> bool659 fn select_uri(&self, uri: &str) -> bool { 660 unsafe { 661 from_glib(ffi::gtk_file_chooser_select_uri( 662 self.as_ref().to_glib_none().0, 663 uri.to_glib_none().0, 664 )) 665 } 666 } 667 set_action(&self, action: FileChooserAction)668 fn set_action(&self, action: FileChooserAction) { 669 unsafe { 670 ffi::gtk_file_chooser_set_action(self.as_ref().to_glib_none().0, action.into_glib()); 671 } 672 } 673 674 #[cfg(any(feature = "v3_22", feature = "dox"))] 675 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] set_choice(&self, id: &str, option: &str)676 fn set_choice(&self, id: &str, option: &str) { 677 unsafe { 678 ffi::gtk_file_chooser_set_choice( 679 self.as_ref().to_glib_none().0, 680 id.to_glib_none().0, 681 option.to_glib_none().0, 682 ); 683 } 684 } 685 set_create_folders(&self, create_folders: bool)686 fn set_create_folders(&self, create_folders: bool) { 687 unsafe { 688 ffi::gtk_file_chooser_set_create_folders( 689 self.as_ref().to_glib_none().0, 690 create_folders.into_glib(), 691 ); 692 } 693 } 694 set_current_folder<P: AsRef<std::path::Path>>(&self, filename: P) -> bool695 fn set_current_folder<P: AsRef<std::path::Path>>(&self, filename: P) -> bool { 696 unsafe { 697 from_glib(ffi::gtk_file_chooser_set_current_folder( 698 self.as_ref().to_glib_none().0, 699 filename.as_ref().to_glib_none().0, 700 )) 701 } 702 } 703 set_current_folder_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error>704 fn set_current_folder_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error> { 705 unsafe { 706 let mut error = ptr::null_mut(); 707 let _ = ffi::gtk_file_chooser_set_current_folder_file( 708 self.as_ref().to_glib_none().0, 709 file.as_ref().to_glib_none().0, 710 &mut error, 711 ); 712 if error.is_null() { 713 Ok(()) 714 } else { 715 Err(from_glib_full(error)) 716 } 717 } 718 } 719 set_current_folder_uri(&self, uri: &str) -> bool720 fn set_current_folder_uri(&self, uri: &str) -> bool { 721 unsafe { 722 from_glib(ffi::gtk_file_chooser_set_current_folder_uri( 723 self.as_ref().to_glib_none().0, 724 uri.to_glib_none().0, 725 )) 726 } 727 } 728 set_current_name(&self, name: &str)729 fn set_current_name(&self, name: &str) { 730 unsafe { 731 ffi::gtk_file_chooser_set_current_name( 732 self.as_ref().to_glib_none().0, 733 name.to_glib_none().0, 734 ); 735 } 736 } 737 set_do_overwrite_confirmation(&self, do_overwrite_confirmation: bool)738 fn set_do_overwrite_confirmation(&self, do_overwrite_confirmation: bool) { 739 unsafe { 740 ffi::gtk_file_chooser_set_do_overwrite_confirmation( 741 self.as_ref().to_glib_none().0, 742 do_overwrite_confirmation.into_glib(), 743 ); 744 } 745 } 746 set_extra_widget<P: IsA<Widget>>(&self, extra_widget: &P)747 fn set_extra_widget<P: IsA<Widget>>(&self, extra_widget: &P) { 748 unsafe { 749 ffi::gtk_file_chooser_set_extra_widget( 750 self.as_ref().to_glib_none().0, 751 extra_widget.as_ref().to_glib_none().0, 752 ); 753 } 754 } 755 set_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error>756 fn set_file<P: IsA<gio::File>>(&self, file: &P) -> Result<(), glib::Error> { 757 unsafe { 758 let mut error = ptr::null_mut(); 759 let _ = ffi::gtk_file_chooser_set_file( 760 self.as_ref().to_glib_none().0, 761 file.as_ref().to_glib_none().0, 762 &mut error, 763 ); 764 if error.is_null() { 765 Ok(()) 766 } else { 767 Err(from_glib_full(error)) 768 } 769 } 770 } 771 set_filename<P: AsRef<std::path::Path>>(&self, filename: P) -> bool772 fn set_filename<P: AsRef<std::path::Path>>(&self, filename: P) -> bool { 773 unsafe { 774 from_glib(ffi::gtk_file_chooser_set_filename( 775 self.as_ref().to_glib_none().0, 776 filename.as_ref().to_glib_none().0, 777 )) 778 } 779 } 780 set_filter(&self, filter: &FileFilter)781 fn set_filter(&self, filter: &FileFilter) { 782 unsafe { 783 ffi::gtk_file_chooser_set_filter( 784 self.as_ref().to_glib_none().0, 785 filter.to_glib_none().0, 786 ); 787 } 788 } 789 set_local_only(&self, local_only: bool)790 fn set_local_only(&self, local_only: bool) { 791 unsafe { 792 ffi::gtk_file_chooser_set_local_only( 793 self.as_ref().to_glib_none().0, 794 local_only.into_glib(), 795 ); 796 } 797 } 798 set_preview_widget<P: IsA<Widget>>(&self, preview_widget: &P)799 fn set_preview_widget<P: IsA<Widget>>(&self, preview_widget: &P) { 800 unsafe { 801 ffi::gtk_file_chooser_set_preview_widget( 802 self.as_ref().to_glib_none().0, 803 preview_widget.as_ref().to_glib_none().0, 804 ); 805 } 806 } 807 set_preview_widget_active(&self, active: bool)808 fn set_preview_widget_active(&self, active: bool) { 809 unsafe { 810 ffi::gtk_file_chooser_set_preview_widget_active( 811 self.as_ref().to_glib_none().0, 812 active.into_glib(), 813 ); 814 } 815 } 816 set_select_multiple(&self, select_multiple: bool)817 fn set_select_multiple(&self, select_multiple: bool) { 818 unsafe { 819 ffi::gtk_file_chooser_set_select_multiple( 820 self.as_ref().to_glib_none().0, 821 select_multiple.into_glib(), 822 ); 823 } 824 } 825 set_show_hidden(&self, show_hidden: bool)826 fn set_show_hidden(&self, show_hidden: bool) { 827 unsafe { 828 ffi::gtk_file_chooser_set_show_hidden( 829 self.as_ref().to_glib_none().0, 830 show_hidden.into_glib(), 831 ); 832 } 833 } 834 set_uri(&self, uri: &str) -> bool835 fn set_uri(&self, uri: &str) -> bool { 836 unsafe { 837 from_glib(ffi::gtk_file_chooser_set_uri( 838 self.as_ref().to_glib_none().0, 839 uri.to_glib_none().0, 840 )) 841 } 842 } 843 set_use_preview_label(&self, use_label: bool)844 fn set_use_preview_label(&self, use_label: bool) { 845 unsafe { 846 ffi::gtk_file_chooser_set_use_preview_label( 847 self.as_ref().to_glib_none().0, 848 use_label.into_glib(), 849 ); 850 } 851 } 852 unselect_all(&self)853 fn unselect_all(&self) { 854 unsafe { 855 ffi::gtk_file_chooser_unselect_all(self.as_ref().to_glib_none().0); 856 } 857 } 858 unselect_file<P: IsA<gio::File>>(&self, file: &P)859 fn unselect_file<P: IsA<gio::File>>(&self, file: &P) { 860 unsafe { 861 ffi::gtk_file_chooser_unselect_file( 862 self.as_ref().to_glib_none().0, 863 file.as_ref().to_glib_none().0, 864 ); 865 } 866 } 867 unselect_filename<P: AsRef<std::path::Path>>(&self, filename: P)868 fn unselect_filename<P: AsRef<std::path::Path>>(&self, filename: P) { 869 unsafe { 870 ffi::gtk_file_chooser_unselect_filename( 871 self.as_ref().to_glib_none().0, 872 filename.as_ref().to_glib_none().0, 873 ); 874 } 875 } 876 unselect_uri(&self, uri: &str)877 fn unselect_uri(&self, uri: &str) { 878 unsafe { 879 ffi::gtk_file_chooser_unselect_uri( 880 self.as_ref().to_glib_none().0, 881 uri.to_glib_none().0, 882 ); 883 } 884 } 885 connect_confirm_overwrite<F: Fn(&Self) -> FileChooserConfirmation + 'static>( &self, f: F, ) -> SignalHandlerId886 fn connect_confirm_overwrite<F: Fn(&Self) -> FileChooserConfirmation + 'static>( 887 &self, 888 f: F, 889 ) -> SignalHandlerId { 890 unsafe extern "C" fn confirm_overwrite_trampoline< 891 P: IsA<FileChooser>, 892 F: Fn(&P) -> FileChooserConfirmation + 'static, 893 >( 894 this: *mut ffi::GtkFileChooser, 895 f: glib::ffi::gpointer, 896 ) -> ffi::GtkFileChooserConfirmation { 897 let f: &F = &*(f as *const F); 898 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()).into_glib() 899 } 900 unsafe { 901 let f: Box_<F> = Box_::new(f); 902 connect_raw( 903 self.as_ptr() as *mut _, 904 b"confirm-overwrite\0".as_ptr() as *const _, 905 Some(transmute::<_, unsafe extern "C" fn()>( 906 confirm_overwrite_trampoline::<Self, F> as *const (), 907 )), 908 Box_::into_raw(f), 909 ) 910 } 911 } 912 connect_current_folder_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId913 fn connect_current_folder_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 914 unsafe extern "C" fn current_folder_changed_trampoline< 915 P: IsA<FileChooser>, 916 F: Fn(&P) + 'static, 917 >( 918 this: *mut ffi::GtkFileChooser, 919 f: glib::ffi::gpointer, 920 ) { 921 let f: &F = &*(f as *const F); 922 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 923 } 924 unsafe { 925 let f: Box_<F> = Box_::new(f); 926 connect_raw( 927 self.as_ptr() as *mut _, 928 b"current-folder-changed\0".as_ptr() as *const _, 929 Some(transmute::<_, unsafe extern "C" fn()>( 930 current_folder_changed_trampoline::<Self, F> as *const (), 931 )), 932 Box_::into_raw(f), 933 ) 934 } 935 } 936 connect_file_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId937 fn connect_file_activated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 938 unsafe extern "C" fn file_activated_trampoline<P: IsA<FileChooser>, F: Fn(&P) + 'static>( 939 this: *mut ffi::GtkFileChooser, 940 f: glib::ffi::gpointer, 941 ) { 942 let f: &F = &*(f as *const F); 943 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 944 } 945 unsafe { 946 let f: Box_<F> = Box_::new(f); 947 connect_raw( 948 self.as_ptr() as *mut _, 949 b"file-activated\0".as_ptr() as *const _, 950 Some(transmute::<_, unsafe extern "C" fn()>( 951 file_activated_trampoline::<Self, F> as *const (), 952 )), 953 Box_::into_raw(f), 954 ) 955 } 956 } 957 connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId958 fn connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 959 unsafe extern "C" fn selection_changed_trampoline< 960 P: IsA<FileChooser>, 961 F: Fn(&P) + 'static, 962 >( 963 this: *mut ffi::GtkFileChooser, 964 f: glib::ffi::gpointer, 965 ) { 966 let f: &F = &*(f as *const F); 967 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 968 } 969 unsafe { 970 let f: Box_<F> = Box_::new(f); 971 connect_raw( 972 self.as_ptr() as *mut _, 973 b"selection-changed\0".as_ptr() as *const _, 974 Some(transmute::<_, unsafe extern "C" fn()>( 975 selection_changed_trampoline::<Self, F> as *const (), 976 )), 977 Box_::into_raw(f), 978 ) 979 } 980 } 981 connect_update_preview<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId982 fn connect_update_preview<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 983 unsafe extern "C" fn update_preview_trampoline<P: IsA<FileChooser>, F: Fn(&P) + 'static>( 984 this: *mut ffi::GtkFileChooser, 985 f: glib::ffi::gpointer, 986 ) { 987 let f: &F = &*(f as *const F); 988 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 989 } 990 unsafe { 991 let f: Box_<F> = Box_::new(f); 992 connect_raw( 993 self.as_ptr() as *mut _, 994 b"update-preview\0".as_ptr() as *const _, 995 Some(transmute::<_, unsafe extern "C" fn()>( 996 update_preview_trampoline::<Self, F> as *const (), 997 )), 998 Box_::into_raw(f), 999 ) 1000 } 1001 } 1002 connect_action_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1003 fn connect_action_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1004 unsafe extern "C" fn notify_action_trampoline<P: IsA<FileChooser>, F: Fn(&P) + 'static>( 1005 this: *mut ffi::GtkFileChooser, 1006 _param_spec: glib::ffi::gpointer, 1007 f: glib::ffi::gpointer, 1008 ) { 1009 let f: &F = &*(f as *const F); 1010 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1011 } 1012 unsafe { 1013 let f: Box_<F> = Box_::new(f); 1014 connect_raw( 1015 self.as_ptr() as *mut _, 1016 b"notify::action\0".as_ptr() as *const _, 1017 Some(transmute::<_, unsafe extern "C" fn()>( 1018 notify_action_trampoline::<Self, F> as *const (), 1019 )), 1020 Box_::into_raw(f), 1021 ) 1022 } 1023 } 1024 connect_create_folders_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1025 fn connect_create_folders_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1026 unsafe extern "C" fn notify_create_folders_trampoline< 1027 P: IsA<FileChooser>, 1028 F: Fn(&P) + 'static, 1029 >( 1030 this: *mut ffi::GtkFileChooser, 1031 _param_spec: glib::ffi::gpointer, 1032 f: glib::ffi::gpointer, 1033 ) { 1034 let f: &F = &*(f as *const F); 1035 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1036 } 1037 unsafe { 1038 let f: Box_<F> = Box_::new(f); 1039 connect_raw( 1040 self.as_ptr() as *mut _, 1041 b"notify::create-folders\0".as_ptr() as *const _, 1042 Some(transmute::<_, unsafe extern "C" fn()>( 1043 notify_create_folders_trampoline::<Self, F> as *const (), 1044 )), 1045 Box_::into_raw(f), 1046 ) 1047 } 1048 } 1049 connect_do_overwrite_confirmation_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1050 fn connect_do_overwrite_confirmation_notify<F: Fn(&Self) + 'static>( 1051 &self, 1052 f: F, 1053 ) -> SignalHandlerId { 1054 unsafe extern "C" fn notify_do_overwrite_confirmation_trampoline< 1055 P: IsA<FileChooser>, 1056 F: Fn(&P) + 'static, 1057 >( 1058 this: *mut ffi::GtkFileChooser, 1059 _param_spec: glib::ffi::gpointer, 1060 f: glib::ffi::gpointer, 1061 ) { 1062 let f: &F = &*(f as *const F); 1063 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1064 } 1065 unsafe { 1066 let f: Box_<F> = Box_::new(f); 1067 connect_raw( 1068 self.as_ptr() as *mut _, 1069 b"notify::do-overwrite-confirmation\0".as_ptr() as *const _, 1070 Some(transmute::<_, unsafe extern "C" fn()>( 1071 notify_do_overwrite_confirmation_trampoline::<Self, F> as *const (), 1072 )), 1073 Box_::into_raw(f), 1074 ) 1075 } 1076 } 1077 connect_extra_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1078 fn connect_extra_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1079 unsafe extern "C" fn notify_extra_widget_trampoline< 1080 P: IsA<FileChooser>, 1081 F: Fn(&P) + 'static, 1082 >( 1083 this: *mut ffi::GtkFileChooser, 1084 _param_spec: glib::ffi::gpointer, 1085 f: glib::ffi::gpointer, 1086 ) { 1087 let f: &F = &*(f as *const F); 1088 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1089 } 1090 unsafe { 1091 let f: Box_<F> = Box_::new(f); 1092 connect_raw( 1093 self.as_ptr() as *mut _, 1094 b"notify::extra-widget\0".as_ptr() as *const _, 1095 Some(transmute::<_, unsafe extern "C" fn()>( 1096 notify_extra_widget_trampoline::<Self, F> as *const (), 1097 )), 1098 Box_::into_raw(f), 1099 ) 1100 } 1101 } 1102 connect_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1103 fn connect_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1104 unsafe extern "C" fn notify_filter_trampoline<P: IsA<FileChooser>, F: Fn(&P) + 'static>( 1105 this: *mut ffi::GtkFileChooser, 1106 _param_spec: glib::ffi::gpointer, 1107 f: glib::ffi::gpointer, 1108 ) { 1109 let f: &F = &*(f as *const F); 1110 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1111 } 1112 unsafe { 1113 let f: Box_<F> = Box_::new(f); 1114 connect_raw( 1115 self.as_ptr() as *mut _, 1116 b"notify::filter\0".as_ptr() as *const _, 1117 Some(transmute::<_, unsafe extern "C" fn()>( 1118 notify_filter_trampoline::<Self, F> as *const (), 1119 )), 1120 Box_::into_raw(f), 1121 ) 1122 } 1123 } 1124 connect_local_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1125 fn connect_local_only_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1126 unsafe extern "C" fn notify_local_only_trampoline< 1127 P: IsA<FileChooser>, 1128 F: Fn(&P) + 'static, 1129 >( 1130 this: *mut ffi::GtkFileChooser, 1131 _param_spec: glib::ffi::gpointer, 1132 f: glib::ffi::gpointer, 1133 ) { 1134 let f: &F = &*(f as *const F); 1135 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1136 } 1137 unsafe { 1138 let f: Box_<F> = Box_::new(f); 1139 connect_raw( 1140 self.as_ptr() as *mut _, 1141 b"notify::local-only\0".as_ptr() as *const _, 1142 Some(transmute::<_, unsafe extern "C" fn()>( 1143 notify_local_only_trampoline::<Self, F> as *const (), 1144 )), 1145 Box_::into_raw(f), 1146 ) 1147 } 1148 } 1149 connect_preview_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1150 fn connect_preview_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1151 unsafe extern "C" fn notify_preview_widget_trampoline< 1152 P: IsA<FileChooser>, 1153 F: Fn(&P) + 'static, 1154 >( 1155 this: *mut ffi::GtkFileChooser, 1156 _param_spec: glib::ffi::gpointer, 1157 f: glib::ffi::gpointer, 1158 ) { 1159 let f: &F = &*(f as *const F); 1160 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1161 } 1162 unsafe { 1163 let f: Box_<F> = Box_::new(f); 1164 connect_raw( 1165 self.as_ptr() as *mut _, 1166 b"notify::preview-widget\0".as_ptr() as *const _, 1167 Some(transmute::<_, unsafe extern "C" fn()>( 1168 notify_preview_widget_trampoline::<Self, F> as *const (), 1169 )), 1170 Box_::into_raw(f), 1171 ) 1172 } 1173 } 1174 connect_preview_widget_active_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId1175 fn connect_preview_widget_active_notify<F: Fn(&Self) + 'static>( 1176 &self, 1177 f: F, 1178 ) -> SignalHandlerId { 1179 unsafe extern "C" fn notify_preview_widget_active_trampoline< 1180 P: IsA<FileChooser>, 1181 F: Fn(&P) + 'static, 1182 >( 1183 this: *mut ffi::GtkFileChooser, 1184 _param_spec: glib::ffi::gpointer, 1185 f: glib::ffi::gpointer, 1186 ) { 1187 let f: &F = &*(f as *const F); 1188 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1189 } 1190 unsafe { 1191 let f: Box_<F> = Box_::new(f); 1192 connect_raw( 1193 self.as_ptr() as *mut _, 1194 b"notify::preview-widget-active\0".as_ptr() as *const _, 1195 Some(transmute::<_, unsafe extern "C" fn()>( 1196 notify_preview_widget_active_trampoline::<Self, F> as *const (), 1197 )), 1198 Box_::into_raw(f), 1199 ) 1200 } 1201 } 1202 connect_select_multiple_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1203 fn connect_select_multiple_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1204 unsafe extern "C" fn notify_select_multiple_trampoline< 1205 P: IsA<FileChooser>, 1206 F: Fn(&P) + 'static, 1207 >( 1208 this: *mut ffi::GtkFileChooser, 1209 _param_spec: glib::ffi::gpointer, 1210 f: glib::ffi::gpointer, 1211 ) { 1212 let f: &F = &*(f as *const F); 1213 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1214 } 1215 unsafe { 1216 let f: Box_<F> = Box_::new(f); 1217 connect_raw( 1218 self.as_ptr() as *mut _, 1219 b"notify::select-multiple\0".as_ptr() as *const _, 1220 Some(transmute::<_, unsafe extern "C" fn()>( 1221 notify_select_multiple_trampoline::<Self, F> as *const (), 1222 )), 1223 Box_::into_raw(f), 1224 ) 1225 } 1226 } 1227 connect_show_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1228 fn connect_show_hidden_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1229 unsafe extern "C" fn notify_show_hidden_trampoline< 1230 P: IsA<FileChooser>, 1231 F: Fn(&P) + 'static, 1232 >( 1233 this: *mut ffi::GtkFileChooser, 1234 _param_spec: glib::ffi::gpointer, 1235 f: glib::ffi::gpointer, 1236 ) { 1237 let f: &F = &*(f as *const F); 1238 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1239 } 1240 unsafe { 1241 let f: Box_<F> = Box_::new(f); 1242 connect_raw( 1243 self.as_ptr() as *mut _, 1244 b"notify::show-hidden\0".as_ptr() as *const _, 1245 Some(transmute::<_, unsafe extern "C" fn()>( 1246 notify_show_hidden_trampoline::<Self, F> as *const (), 1247 )), 1248 Box_::into_raw(f), 1249 ) 1250 } 1251 } 1252 connect_use_preview_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1253 fn connect_use_preview_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1254 unsafe extern "C" fn notify_use_preview_label_trampoline< 1255 P: IsA<FileChooser>, 1256 F: Fn(&P) + 'static, 1257 >( 1258 this: *mut ffi::GtkFileChooser, 1259 _param_spec: glib::ffi::gpointer, 1260 f: glib::ffi::gpointer, 1261 ) { 1262 let f: &F = &*(f as *const F); 1263 f(FileChooser::from_glib_borrow(this).unsafe_cast_ref()) 1264 } 1265 unsafe { 1266 let f: Box_<F> = Box_::new(f); 1267 connect_raw( 1268 self.as_ptr() as *mut _, 1269 b"notify::use-preview-label\0".as_ptr() as *const _, 1270 Some(transmute::<_, unsafe extern "C" fn()>( 1271 notify_use_preview_label_trampoline::<Self, F> as *const (), 1272 )), 1273 Box_::into_raw(f), 1274 ) 1275 } 1276 } 1277 } 1278 1279 impl fmt::Display for FileChooser { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1280 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 1281 f.write_str("FileChooser") 1282 } 1283 } 1284