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::Align; 6 use crate::BaselinePosition; 7 use crate::Box; 8 use crate::Buildable; 9 use crate::Container; 10 use crate::FileChooser; 11 use crate::FileChooserAction; 12 use crate::FileFilter; 13 use crate::Orientable; 14 use crate::Orientation; 15 use crate::ResizeMode; 16 use crate::Widget; 17 use glib::object::Cast; 18 use glib::object::IsA; 19 use glib::object::ObjectExt; 20 use glib::signal::connect_raw; 21 use glib::signal::SignalHandlerId; 22 use glib::translate::*; 23 use glib::StaticType; 24 use glib::ToValue; 25 use std::boxed::Box as Box_; 26 use std::fmt; 27 use std::mem::transmute; 28 29 glib::wrapper! { 30 #[doc(alias = "GtkFileChooserWidget")] 31 pub struct FileChooserWidget(Object<ffi::GtkFileChooserWidget, ffi::GtkFileChooserWidgetClass>) @extends Box, Container, Widget, @implements Buildable, Orientable, FileChooser; 32 33 match fn { 34 type_ => || ffi::gtk_file_chooser_widget_get_type(), 35 } 36 } 37 38 impl FileChooserWidget { 39 #[doc(alias = "gtk_file_chooser_widget_new")] new(action: FileChooserAction) -> FileChooserWidget40 pub fn new(action: FileChooserAction) -> FileChooserWidget { 41 assert_initialized_main_thread!(); 42 unsafe { 43 Widget::from_glib_none(ffi::gtk_file_chooser_widget_new(action.into_glib())) 44 .unsafe_cast() 45 } 46 } 47 48 // rustdoc-stripper-ignore-next 49 /// Creates a new builder-pattern struct instance to construct [`FileChooserWidget`] objects. 50 /// 51 /// This method returns an instance of [`FileChooserWidgetBuilder`] which can be used to create [`FileChooserWidget`] objects. builder() -> FileChooserWidgetBuilder52 pub fn builder() -> FileChooserWidgetBuilder { 53 FileChooserWidgetBuilder::default() 54 } 55 } 56 57 #[derive(Clone, Default)] 58 // rustdoc-stripper-ignore-next 59 /// A [builder-pattern] type to construct [`FileChooserWidget`] objects. 60 /// 61 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 62 pub struct FileChooserWidgetBuilder { 63 search_mode: Option<bool>, 64 baseline_position: Option<BaselinePosition>, 65 homogeneous: Option<bool>, 66 spacing: Option<i32>, 67 border_width: Option<u32>, 68 child: Option<Widget>, 69 resize_mode: Option<ResizeMode>, 70 app_paintable: Option<bool>, 71 can_default: Option<bool>, 72 can_focus: Option<bool>, 73 events: Option<gdk::EventMask>, 74 expand: Option<bool>, 75 #[cfg(any(feature = "v3_20", feature = "dox"))] 76 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 77 focus_on_click: Option<bool>, 78 halign: Option<Align>, 79 has_default: Option<bool>, 80 has_focus: Option<bool>, 81 has_tooltip: Option<bool>, 82 height_request: Option<i32>, 83 hexpand: Option<bool>, 84 hexpand_set: Option<bool>, 85 is_focus: Option<bool>, 86 margin: Option<i32>, 87 margin_bottom: Option<i32>, 88 margin_end: Option<i32>, 89 margin_start: Option<i32>, 90 margin_top: Option<i32>, 91 name: Option<String>, 92 no_show_all: Option<bool>, 93 opacity: Option<f64>, 94 parent: Option<Container>, 95 receives_default: Option<bool>, 96 sensitive: Option<bool>, 97 tooltip_markup: Option<String>, 98 tooltip_text: Option<String>, 99 valign: Option<Align>, 100 vexpand: Option<bool>, 101 vexpand_set: Option<bool>, 102 visible: Option<bool>, 103 width_request: Option<i32>, 104 orientation: Option<Orientation>, 105 action: Option<FileChooserAction>, 106 create_folders: Option<bool>, 107 do_overwrite_confirmation: Option<bool>, 108 extra_widget: Option<Widget>, 109 filter: Option<FileFilter>, 110 local_only: Option<bool>, 111 preview_widget: Option<Widget>, 112 preview_widget_active: Option<bool>, 113 select_multiple: Option<bool>, 114 show_hidden: Option<bool>, 115 use_preview_label: Option<bool>, 116 } 117 118 impl FileChooserWidgetBuilder { 119 // rustdoc-stripper-ignore-next 120 /// Create a new [`FileChooserWidgetBuilder`]. new() -> Self121 pub fn new() -> Self { 122 Self::default() 123 } 124 125 // rustdoc-stripper-ignore-next 126 /// Build the [`FileChooserWidget`]. build(self) -> FileChooserWidget127 pub fn build(self) -> FileChooserWidget { 128 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 129 if let Some(ref search_mode) = self.search_mode { 130 properties.push(("search-mode", search_mode)); 131 } 132 if let Some(ref baseline_position) = self.baseline_position { 133 properties.push(("baseline-position", baseline_position)); 134 } 135 if let Some(ref homogeneous) = self.homogeneous { 136 properties.push(("homogeneous", homogeneous)); 137 } 138 if let Some(ref spacing) = self.spacing { 139 properties.push(("spacing", spacing)); 140 } 141 if let Some(ref border_width) = self.border_width { 142 properties.push(("border-width", border_width)); 143 } 144 if let Some(ref child) = self.child { 145 properties.push(("child", child)); 146 } 147 if let Some(ref resize_mode) = self.resize_mode { 148 properties.push(("resize-mode", resize_mode)); 149 } 150 if let Some(ref app_paintable) = self.app_paintable { 151 properties.push(("app-paintable", app_paintable)); 152 } 153 if let Some(ref can_default) = self.can_default { 154 properties.push(("can-default", can_default)); 155 } 156 if let Some(ref can_focus) = self.can_focus { 157 properties.push(("can-focus", can_focus)); 158 } 159 if let Some(ref events) = self.events { 160 properties.push(("events", events)); 161 } 162 if let Some(ref expand) = self.expand { 163 properties.push(("expand", expand)); 164 } 165 #[cfg(any(feature = "v3_20", feature = "dox"))] 166 if let Some(ref focus_on_click) = self.focus_on_click { 167 properties.push(("focus-on-click", focus_on_click)); 168 } 169 if let Some(ref halign) = self.halign { 170 properties.push(("halign", halign)); 171 } 172 if let Some(ref has_default) = self.has_default { 173 properties.push(("has-default", has_default)); 174 } 175 if let Some(ref has_focus) = self.has_focus { 176 properties.push(("has-focus", has_focus)); 177 } 178 if let Some(ref has_tooltip) = self.has_tooltip { 179 properties.push(("has-tooltip", has_tooltip)); 180 } 181 if let Some(ref height_request) = self.height_request { 182 properties.push(("height-request", height_request)); 183 } 184 if let Some(ref hexpand) = self.hexpand { 185 properties.push(("hexpand", hexpand)); 186 } 187 if let Some(ref hexpand_set) = self.hexpand_set { 188 properties.push(("hexpand-set", hexpand_set)); 189 } 190 if let Some(ref is_focus) = self.is_focus { 191 properties.push(("is-focus", is_focus)); 192 } 193 if let Some(ref margin) = self.margin { 194 properties.push(("margin", margin)); 195 } 196 if let Some(ref margin_bottom) = self.margin_bottom { 197 properties.push(("margin-bottom", margin_bottom)); 198 } 199 if let Some(ref margin_end) = self.margin_end { 200 properties.push(("margin-end", margin_end)); 201 } 202 if let Some(ref margin_start) = self.margin_start { 203 properties.push(("margin-start", margin_start)); 204 } 205 if let Some(ref margin_top) = self.margin_top { 206 properties.push(("margin-top", margin_top)); 207 } 208 if let Some(ref name) = self.name { 209 properties.push(("name", name)); 210 } 211 if let Some(ref no_show_all) = self.no_show_all { 212 properties.push(("no-show-all", no_show_all)); 213 } 214 if let Some(ref opacity) = self.opacity { 215 properties.push(("opacity", opacity)); 216 } 217 if let Some(ref parent) = self.parent { 218 properties.push(("parent", parent)); 219 } 220 if let Some(ref receives_default) = self.receives_default { 221 properties.push(("receives-default", receives_default)); 222 } 223 if let Some(ref sensitive) = self.sensitive { 224 properties.push(("sensitive", sensitive)); 225 } 226 if let Some(ref tooltip_markup) = self.tooltip_markup { 227 properties.push(("tooltip-markup", tooltip_markup)); 228 } 229 if let Some(ref tooltip_text) = self.tooltip_text { 230 properties.push(("tooltip-text", tooltip_text)); 231 } 232 if let Some(ref valign) = self.valign { 233 properties.push(("valign", valign)); 234 } 235 if let Some(ref vexpand) = self.vexpand { 236 properties.push(("vexpand", vexpand)); 237 } 238 if let Some(ref vexpand_set) = self.vexpand_set { 239 properties.push(("vexpand-set", vexpand_set)); 240 } 241 if let Some(ref visible) = self.visible { 242 properties.push(("visible", visible)); 243 } 244 if let Some(ref width_request) = self.width_request { 245 properties.push(("width-request", width_request)); 246 } 247 if let Some(ref orientation) = self.orientation { 248 properties.push(("orientation", orientation)); 249 } 250 if let Some(ref action) = self.action { 251 properties.push(("action", action)); 252 } 253 if let Some(ref create_folders) = self.create_folders { 254 properties.push(("create-folders", create_folders)); 255 } 256 if let Some(ref do_overwrite_confirmation) = self.do_overwrite_confirmation { 257 properties.push(("do-overwrite-confirmation", do_overwrite_confirmation)); 258 } 259 if let Some(ref extra_widget) = self.extra_widget { 260 properties.push(("extra-widget", extra_widget)); 261 } 262 if let Some(ref filter) = self.filter { 263 properties.push(("filter", filter)); 264 } 265 if let Some(ref local_only) = self.local_only { 266 properties.push(("local-only", local_only)); 267 } 268 if let Some(ref preview_widget) = self.preview_widget { 269 properties.push(("preview-widget", preview_widget)); 270 } 271 if let Some(ref preview_widget_active) = self.preview_widget_active { 272 properties.push(("preview-widget-active", preview_widget_active)); 273 } 274 if let Some(ref select_multiple) = self.select_multiple { 275 properties.push(("select-multiple", select_multiple)); 276 } 277 if let Some(ref show_hidden) = self.show_hidden { 278 properties.push(("show-hidden", show_hidden)); 279 } 280 if let Some(ref use_preview_label) = self.use_preview_label { 281 properties.push(("use-preview-label", use_preview_label)); 282 } 283 glib::Object::new::<FileChooserWidget>(&properties) 284 .expect("Failed to create an instance of FileChooserWidget") 285 } 286 search_mode(mut self, search_mode: bool) -> Self287 pub fn search_mode(mut self, search_mode: bool) -> Self { 288 self.search_mode = Some(search_mode); 289 self 290 } 291 baseline_position(mut self, baseline_position: BaselinePosition) -> Self292 pub fn baseline_position(mut self, baseline_position: BaselinePosition) -> Self { 293 self.baseline_position = Some(baseline_position); 294 self 295 } 296 homogeneous(mut self, homogeneous: bool) -> Self297 pub fn homogeneous(mut self, homogeneous: bool) -> Self { 298 self.homogeneous = Some(homogeneous); 299 self 300 } 301 spacing(mut self, spacing: i32) -> Self302 pub fn spacing(mut self, spacing: i32) -> Self { 303 self.spacing = Some(spacing); 304 self 305 } 306 border_width(mut self, border_width: u32) -> Self307 pub fn border_width(mut self, border_width: u32) -> Self { 308 self.border_width = Some(border_width); 309 self 310 } 311 child<P: IsA<Widget>>(mut self, child: &P) -> Self312 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 313 self.child = Some(child.clone().upcast()); 314 self 315 } 316 resize_mode(mut self, resize_mode: ResizeMode) -> Self317 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 318 self.resize_mode = Some(resize_mode); 319 self 320 } 321 app_paintable(mut self, app_paintable: bool) -> Self322 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 323 self.app_paintable = Some(app_paintable); 324 self 325 } 326 can_default(mut self, can_default: bool) -> Self327 pub fn can_default(mut self, can_default: bool) -> Self { 328 self.can_default = Some(can_default); 329 self 330 } 331 can_focus(mut self, can_focus: bool) -> Self332 pub fn can_focus(mut self, can_focus: bool) -> Self { 333 self.can_focus = Some(can_focus); 334 self 335 } 336 events(mut self, events: gdk::EventMask) -> Self337 pub fn events(mut self, events: gdk::EventMask) -> Self { 338 self.events = Some(events); 339 self 340 } 341 expand(mut self, expand: bool) -> Self342 pub fn expand(mut self, expand: bool) -> Self { 343 self.expand = Some(expand); 344 self 345 } 346 347 #[cfg(any(feature = "v3_20", feature = "dox"))] 348 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self349 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 350 self.focus_on_click = Some(focus_on_click); 351 self 352 } 353 halign(mut self, halign: Align) -> Self354 pub fn halign(mut self, halign: Align) -> Self { 355 self.halign = Some(halign); 356 self 357 } 358 has_default(mut self, has_default: bool) -> Self359 pub fn has_default(mut self, has_default: bool) -> Self { 360 self.has_default = Some(has_default); 361 self 362 } 363 has_focus(mut self, has_focus: bool) -> Self364 pub fn has_focus(mut self, has_focus: bool) -> Self { 365 self.has_focus = Some(has_focus); 366 self 367 } 368 has_tooltip(mut self, has_tooltip: bool) -> Self369 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 370 self.has_tooltip = Some(has_tooltip); 371 self 372 } 373 height_request(mut self, height_request: i32) -> Self374 pub fn height_request(mut self, height_request: i32) -> Self { 375 self.height_request = Some(height_request); 376 self 377 } 378 hexpand(mut self, hexpand: bool) -> Self379 pub fn hexpand(mut self, hexpand: bool) -> Self { 380 self.hexpand = Some(hexpand); 381 self 382 } 383 hexpand_set(mut self, hexpand_set: bool) -> Self384 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 385 self.hexpand_set = Some(hexpand_set); 386 self 387 } 388 is_focus(mut self, is_focus: bool) -> Self389 pub fn is_focus(mut self, is_focus: bool) -> Self { 390 self.is_focus = Some(is_focus); 391 self 392 } 393 margin(mut self, margin: i32) -> Self394 pub fn margin(mut self, margin: i32) -> Self { 395 self.margin = Some(margin); 396 self 397 } 398 margin_bottom(mut self, margin_bottom: i32) -> Self399 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 400 self.margin_bottom = Some(margin_bottom); 401 self 402 } 403 margin_end(mut self, margin_end: i32) -> Self404 pub fn margin_end(mut self, margin_end: i32) -> Self { 405 self.margin_end = Some(margin_end); 406 self 407 } 408 margin_start(mut self, margin_start: i32) -> Self409 pub fn margin_start(mut self, margin_start: i32) -> Self { 410 self.margin_start = Some(margin_start); 411 self 412 } 413 margin_top(mut self, margin_top: i32) -> Self414 pub fn margin_top(mut self, margin_top: i32) -> Self { 415 self.margin_top = Some(margin_top); 416 self 417 } 418 name(mut self, name: &str) -> Self419 pub fn name(mut self, name: &str) -> Self { 420 self.name = Some(name.to_string()); 421 self 422 } 423 no_show_all(mut self, no_show_all: bool) -> Self424 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 425 self.no_show_all = Some(no_show_all); 426 self 427 } 428 opacity(mut self, opacity: f64) -> Self429 pub fn opacity(mut self, opacity: f64) -> Self { 430 self.opacity = Some(opacity); 431 self 432 } 433 parent<P: IsA<Container>>(mut self, parent: &P) -> Self434 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 435 self.parent = Some(parent.clone().upcast()); 436 self 437 } 438 receives_default(mut self, receives_default: bool) -> Self439 pub fn receives_default(mut self, receives_default: bool) -> Self { 440 self.receives_default = Some(receives_default); 441 self 442 } 443 sensitive(mut self, sensitive: bool) -> Self444 pub fn sensitive(mut self, sensitive: bool) -> Self { 445 self.sensitive = Some(sensitive); 446 self 447 } 448 tooltip_markup(mut self, tooltip_markup: &str) -> Self449 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 450 self.tooltip_markup = Some(tooltip_markup.to_string()); 451 self 452 } 453 tooltip_text(mut self, tooltip_text: &str) -> Self454 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 455 self.tooltip_text = Some(tooltip_text.to_string()); 456 self 457 } 458 valign(mut self, valign: Align) -> Self459 pub fn valign(mut self, valign: Align) -> Self { 460 self.valign = Some(valign); 461 self 462 } 463 vexpand(mut self, vexpand: bool) -> Self464 pub fn vexpand(mut self, vexpand: bool) -> Self { 465 self.vexpand = Some(vexpand); 466 self 467 } 468 vexpand_set(mut self, vexpand_set: bool) -> Self469 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 470 self.vexpand_set = Some(vexpand_set); 471 self 472 } 473 visible(mut self, visible: bool) -> Self474 pub fn visible(mut self, visible: bool) -> Self { 475 self.visible = Some(visible); 476 self 477 } 478 width_request(mut self, width_request: i32) -> Self479 pub fn width_request(mut self, width_request: i32) -> Self { 480 self.width_request = Some(width_request); 481 self 482 } 483 orientation(mut self, orientation: Orientation) -> Self484 pub fn orientation(mut self, orientation: Orientation) -> Self { 485 self.orientation = Some(orientation); 486 self 487 } 488 action(mut self, action: FileChooserAction) -> Self489 pub fn action(mut self, action: FileChooserAction) -> Self { 490 self.action = Some(action); 491 self 492 } 493 create_folders(mut self, create_folders: bool) -> Self494 pub fn create_folders(mut self, create_folders: bool) -> Self { 495 self.create_folders = Some(create_folders); 496 self 497 } 498 do_overwrite_confirmation(mut self, do_overwrite_confirmation: bool) -> Self499 pub fn do_overwrite_confirmation(mut self, do_overwrite_confirmation: bool) -> Self { 500 self.do_overwrite_confirmation = Some(do_overwrite_confirmation); 501 self 502 } 503 extra_widget<P: IsA<Widget>>(mut self, extra_widget: &P) -> Self504 pub fn extra_widget<P: IsA<Widget>>(mut self, extra_widget: &P) -> Self { 505 self.extra_widget = Some(extra_widget.clone().upcast()); 506 self 507 } 508 filter(mut self, filter: &FileFilter) -> Self509 pub fn filter(mut self, filter: &FileFilter) -> Self { 510 self.filter = Some(filter.clone()); 511 self 512 } 513 local_only(mut self, local_only: bool) -> Self514 pub fn local_only(mut self, local_only: bool) -> Self { 515 self.local_only = Some(local_only); 516 self 517 } 518 preview_widget<P: IsA<Widget>>(mut self, preview_widget: &P) -> Self519 pub fn preview_widget<P: IsA<Widget>>(mut self, preview_widget: &P) -> Self { 520 self.preview_widget = Some(preview_widget.clone().upcast()); 521 self 522 } 523 preview_widget_active(mut self, preview_widget_active: bool) -> Self524 pub fn preview_widget_active(mut self, preview_widget_active: bool) -> Self { 525 self.preview_widget_active = Some(preview_widget_active); 526 self 527 } 528 select_multiple(mut self, select_multiple: bool) -> Self529 pub fn select_multiple(mut self, select_multiple: bool) -> Self { 530 self.select_multiple = Some(select_multiple); 531 self 532 } 533 show_hidden(mut self, show_hidden: bool) -> Self534 pub fn show_hidden(mut self, show_hidden: bool) -> Self { 535 self.show_hidden = Some(show_hidden); 536 self 537 } 538 use_preview_label(mut self, use_preview_label: bool) -> Self539 pub fn use_preview_label(mut self, use_preview_label: bool) -> Self { 540 self.use_preview_label = Some(use_preview_label); 541 self 542 } 543 } 544 545 pub const NONE_FILE_CHOOSER_WIDGET: Option<&FileChooserWidget> = None; 546 547 pub trait FileChooserWidgetExt: 'static { 548 #[doc(alias = "search-mode")] is_search_mode(&self) -> bool549 fn is_search_mode(&self) -> bool; 550 551 #[doc(alias = "search-mode")] set_search_mode(&self, search_mode: bool)552 fn set_search_mode(&self, search_mode: bool); 553 subtitle(&self) -> Option<glib::GString>554 fn subtitle(&self) -> Option<glib::GString>; 555 556 #[doc(alias = "desktop-folder")] connect_desktop_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId557 fn connect_desktop_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 558 emit_desktop_folder(&self)559 fn emit_desktop_folder(&self); 560 561 #[doc(alias = "down-folder")] connect_down_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId562 fn connect_down_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 563 emit_down_folder(&self)564 fn emit_down_folder(&self); 565 566 #[doc(alias = "home-folder")] connect_home_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId567 fn connect_home_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 568 emit_home_folder(&self)569 fn emit_home_folder(&self); 570 571 #[doc(alias = "location-popup")] connect_location_popup<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId572 fn connect_location_popup<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId; 573 emit_location_popup(&self, path: &str)574 fn emit_location_popup(&self, path: &str); 575 576 #[doc(alias = "location-popup-on-paste")] connect_location_popup_on_paste<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId577 fn connect_location_popup_on_paste<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 578 emit_location_popup_on_paste(&self)579 fn emit_location_popup_on_paste(&self); 580 581 #[doc(alias = "location-toggle-popup")] connect_location_toggle_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId582 fn connect_location_toggle_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 583 emit_location_toggle_popup(&self)584 fn emit_location_toggle_popup(&self); 585 586 #[doc(alias = "places-shortcut")] connect_places_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId587 fn connect_places_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 588 emit_places_shortcut(&self)589 fn emit_places_shortcut(&self); 590 591 #[doc(alias = "quick-bookmark")] connect_quick_bookmark<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId592 fn connect_quick_bookmark<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId; 593 emit_quick_bookmark(&self, bookmark_index: i32)594 fn emit_quick_bookmark(&self, bookmark_index: i32); 595 596 #[doc(alias = "recent-shortcut")] connect_recent_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId597 fn connect_recent_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 598 emit_recent_shortcut(&self)599 fn emit_recent_shortcut(&self); 600 601 #[doc(alias = "search-shortcut")] connect_search_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId602 fn connect_search_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 603 emit_search_shortcut(&self)604 fn emit_search_shortcut(&self); 605 606 #[doc(alias = "show-hidden")] connect_show_hidden<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId607 fn connect_show_hidden<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 608 emit_show_hidden(&self)609 fn emit_show_hidden(&self); 610 611 #[doc(alias = "up-folder")] connect_up_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId612 fn connect_up_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 613 emit_up_folder(&self)614 fn emit_up_folder(&self); 615 616 #[doc(alias = "search-mode")] connect_search_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId617 fn connect_search_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 618 619 #[doc(alias = "subtitle")] connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId620 fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 621 } 622 623 impl<O: IsA<FileChooserWidget>> FileChooserWidgetExt for O { is_search_mode(&self) -> bool624 fn is_search_mode(&self) -> bool { 625 unsafe { 626 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 627 glib::gobject_ffi::g_object_get_property( 628 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 629 b"search-mode\0".as_ptr() as *const _, 630 value.to_glib_none_mut().0, 631 ); 632 value 633 .get() 634 .expect("Return Value for property `search-mode` getter") 635 } 636 } 637 set_search_mode(&self, search_mode: bool)638 fn set_search_mode(&self, search_mode: bool) { 639 unsafe { 640 glib::gobject_ffi::g_object_set_property( 641 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 642 b"search-mode\0".as_ptr() as *const _, 643 search_mode.to_value().to_glib_none().0, 644 ); 645 } 646 } 647 subtitle(&self) -> Option<glib::GString>648 fn subtitle(&self) -> Option<glib::GString> { 649 unsafe { 650 let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type()); 651 glib::gobject_ffi::g_object_get_property( 652 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 653 b"subtitle\0".as_ptr() as *const _, 654 value.to_glib_none_mut().0, 655 ); 656 value 657 .get() 658 .expect("Return Value for property `subtitle` getter") 659 } 660 } 661 connect_desktop_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId662 fn connect_desktop_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 663 unsafe extern "C" fn desktop_folder_trampoline< 664 P: IsA<FileChooserWidget>, 665 F: Fn(&P) + 'static, 666 >( 667 this: *mut ffi::GtkFileChooserWidget, 668 f: glib::ffi::gpointer, 669 ) { 670 let f: &F = &*(f as *const F); 671 f(FileChooserWidget::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"desktop-folder\0".as_ptr() as *const _, 678 Some(transmute::<_, unsafe extern "C" fn()>( 679 desktop_folder_trampoline::<Self, F> as *const (), 680 )), 681 Box_::into_raw(f), 682 ) 683 } 684 } 685 emit_desktop_folder(&self)686 fn emit_desktop_folder(&self) { 687 let _ = unsafe { 688 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 689 .emit_by_name("desktop-folder", &[]) 690 .unwrap() 691 }; 692 } 693 connect_down_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId694 fn connect_down_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 695 unsafe extern "C" fn down_folder_trampoline< 696 P: IsA<FileChooserWidget>, 697 F: Fn(&P) + 'static, 698 >( 699 this: *mut ffi::GtkFileChooserWidget, 700 f: glib::ffi::gpointer, 701 ) { 702 let f: &F = &*(f as *const F); 703 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) 704 } 705 unsafe { 706 let f: Box_<F> = Box_::new(f); 707 connect_raw( 708 self.as_ptr() as *mut _, 709 b"down-folder\0".as_ptr() as *const _, 710 Some(transmute::<_, unsafe extern "C" fn()>( 711 down_folder_trampoline::<Self, F> as *const (), 712 )), 713 Box_::into_raw(f), 714 ) 715 } 716 } 717 emit_down_folder(&self)718 fn emit_down_folder(&self) { 719 let _ = unsafe { 720 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 721 .emit_by_name("down-folder", &[]) 722 .unwrap() 723 }; 724 } 725 connect_home_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId726 fn connect_home_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 727 unsafe extern "C" fn home_folder_trampoline< 728 P: IsA<FileChooserWidget>, 729 F: Fn(&P) + 'static, 730 >( 731 this: *mut ffi::GtkFileChooserWidget, 732 f: glib::ffi::gpointer, 733 ) { 734 let f: &F = &*(f as *const F); 735 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) 736 } 737 unsafe { 738 let f: Box_<F> = Box_::new(f); 739 connect_raw( 740 self.as_ptr() as *mut _, 741 b"home-folder\0".as_ptr() as *const _, 742 Some(transmute::<_, unsafe extern "C" fn()>( 743 home_folder_trampoline::<Self, F> as *const (), 744 )), 745 Box_::into_raw(f), 746 ) 747 } 748 } 749 emit_home_folder(&self)750 fn emit_home_folder(&self) { 751 let _ = unsafe { 752 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 753 .emit_by_name("home-folder", &[]) 754 .unwrap() 755 }; 756 } 757 connect_location_popup<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId758 fn connect_location_popup<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId { 759 unsafe extern "C" fn location_popup_trampoline< 760 P: IsA<FileChooserWidget>, 761 F: Fn(&P, &str) + 'static, 762 >( 763 this: *mut ffi::GtkFileChooserWidget, 764 path: *mut libc::c_char, 765 f: glib::ffi::gpointer, 766 ) { 767 let f: &F = &*(f as *const F); 768 f( 769 FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref(), 770 &glib::GString::from_glib_borrow(path), 771 ) 772 } 773 unsafe { 774 let f: Box_<F> = Box_::new(f); 775 connect_raw( 776 self.as_ptr() as *mut _, 777 b"location-popup\0".as_ptr() as *const _, 778 Some(transmute::<_, unsafe extern "C" fn()>( 779 location_popup_trampoline::<Self, F> as *const (), 780 )), 781 Box_::into_raw(f), 782 ) 783 } 784 } 785 emit_location_popup(&self, path: &str)786 fn emit_location_popup(&self, path: &str) { 787 let _ = unsafe { 788 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 789 .emit_by_name("location-popup", &[&path]) 790 .unwrap() 791 }; 792 } 793 connect_location_popup_on_paste<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId794 fn connect_location_popup_on_paste<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 795 unsafe extern "C" fn location_popup_on_paste_trampoline< 796 P: IsA<FileChooserWidget>, 797 F: Fn(&P) + 'static, 798 >( 799 this: *mut ffi::GtkFileChooserWidget, 800 f: glib::ffi::gpointer, 801 ) { 802 let f: &F = &*(f as *const F); 803 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) 804 } 805 unsafe { 806 let f: Box_<F> = Box_::new(f); 807 connect_raw( 808 self.as_ptr() as *mut _, 809 b"location-popup-on-paste\0".as_ptr() as *const _, 810 Some(transmute::<_, unsafe extern "C" fn()>( 811 location_popup_on_paste_trampoline::<Self, F> as *const (), 812 )), 813 Box_::into_raw(f), 814 ) 815 } 816 } 817 emit_location_popup_on_paste(&self)818 fn emit_location_popup_on_paste(&self) { 819 let _ = unsafe { 820 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 821 .emit_by_name("location-popup-on-paste", &[]) 822 .unwrap() 823 }; 824 } 825 connect_location_toggle_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId826 fn connect_location_toggle_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 827 unsafe extern "C" fn location_toggle_popup_trampoline< 828 P: IsA<FileChooserWidget>, 829 F: Fn(&P) + 'static, 830 >( 831 this: *mut ffi::GtkFileChooserWidget, 832 f: glib::ffi::gpointer, 833 ) { 834 let f: &F = &*(f as *const F); 835 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) 836 } 837 unsafe { 838 let f: Box_<F> = Box_::new(f); 839 connect_raw( 840 self.as_ptr() as *mut _, 841 b"location-toggle-popup\0".as_ptr() as *const _, 842 Some(transmute::<_, unsafe extern "C" fn()>( 843 location_toggle_popup_trampoline::<Self, F> as *const (), 844 )), 845 Box_::into_raw(f), 846 ) 847 } 848 } 849 emit_location_toggle_popup(&self)850 fn emit_location_toggle_popup(&self) { 851 let _ = unsafe { 852 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 853 .emit_by_name("location-toggle-popup", &[]) 854 .unwrap() 855 }; 856 } 857 connect_places_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId858 fn connect_places_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 859 unsafe extern "C" fn places_shortcut_trampoline< 860 P: IsA<FileChooserWidget>, 861 F: Fn(&P) + 'static, 862 >( 863 this: *mut ffi::GtkFileChooserWidget, 864 f: glib::ffi::gpointer, 865 ) { 866 let f: &F = &*(f as *const F); 867 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) 868 } 869 unsafe { 870 let f: Box_<F> = Box_::new(f); 871 connect_raw( 872 self.as_ptr() as *mut _, 873 b"places-shortcut\0".as_ptr() as *const _, 874 Some(transmute::<_, unsafe extern "C" fn()>( 875 places_shortcut_trampoline::<Self, F> as *const (), 876 )), 877 Box_::into_raw(f), 878 ) 879 } 880 } 881 emit_places_shortcut(&self)882 fn emit_places_shortcut(&self) { 883 let _ = unsafe { 884 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 885 .emit_by_name("places-shortcut", &[]) 886 .unwrap() 887 }; 888 } 889 connect_quick_bookmark<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId890 fn connect_quick_bookmark<F: Fn(&Self, i32) + 'static>(&self, f: F) -> SignalHandlerId { 891 unsafe extern "C" fn quick_bookmark_trampoline< 892 P: IsA<FileChooserWidget>, 893 F: Fn(&P, i32) + 'static, 894 >( 895 this: *mut ffi::GtkFileChooserWidget, 896 bookmark_index: libc::c_int, 897 f: glib::ffi::gpointer, 898 ) { 899 let f: &F = &*(f as *const F); 900 f( 901 FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref(), 902 bookmark_index, 903 ) 904 } 905 unsafe { 906 let f: Box_<F> = Box_::new(f); 907 connect_raw( 908 self.as_ptr() as *mut _, 909 b"quick-bookmark\0".as_ptr() as *const _, 910 Some(transmute::<_, unsafe extern "C" fn()>( 911 quick_bookmark_trampoline::<Self, F> as *const (), 912 )), 913 Box_::into_raw(f), 914 ) 915 } 916 } 917 emit_quick_bookmark(&self, bookmark_index: i32)918 fn emit_quick_bookmark(&self, bookmark_index: i32) { 919 let _ = unsafe { 920 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 921 .emit_by_name("quick-bookmark", &[&bookmark_index]) 922 .unwrap() 923 }; 924 } 925 connect_recent_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId926 fn connect_recent_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 927 unsafe extern "C" fn recent_shortcut_trampoline< 928 P: IsA<FileChooserWidget>, 929 F: Fn(&P) + 'static, 930 >( 931 this: *mut ffi::GtkFileChooserWidget, 932 f: glib::ffi::gpointer, 933 ) { 934 let f: &F = &*(f as *const F); 935 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) 936 } 937 unsafe { 938 let f: Box_<F> = Box_::new(f); 939 connect_raw( 940 self.as_ptr() as *mut _, 941 b"recent-shortcut\0".as_ptr() as *const _, 942 Some(transmute::<_, unsafe extern "C" fn()>( 943 recent_shortcut_trampoline::<Self, F> as *const (), 944 )), 945 Box_::into_raw(f), 946 ) 947 } 948 } 949 emit_recent_shortcut(&self)950 fn emit_recent_shortcut(&self) { 951 let _ = unsafe { 952 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 953 .emit_by_name("recent-shortcut", &[]) 954 .unwrap() 955 }; 956 } 957 connect_search_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId958 fn connect_search_shortcut<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 959 unsafe extern "C" fn search_shortcut_trampoline< 960 P: IsA<FileChooserWidget>, 961 F: Fn(&P) + 'static, 962 >( 963 this: *mut ffi::GtkFileChooserWidget, 964 f: glib::ffi::gpointer, 965 ) { 966 let f: &F = &*(f as *const F); 967 f(FileChooserWidget::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"search-shortcut\0".as_ptr() as *const _, 974 Some(transmute::<_, unsafe extern "C" fn()>( 975 search_shortcut_trampoline::<Self, F> as *const (), 976 )), 977 Box_::into_raw(f), 978 ) 979 } 980 } 981 emit_search_shortcut(&self)982 fn emit_search_shortcut(&self) { 983 let _ = unsafe { 984 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 985 .emit_by_name("search-shortcut", &[]) 986 .unwrap() 987 }; 988 } 989 connect_show_hidden<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId990 fn connect_show_hidden<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 991 unsafe extern "C" fn show_hidden_trampoline< 992 P: IsA<FileChooserWidget>, 993 F: Fn(&P) + 'static, 994 >( 995 this: *mut ffi::GtkFileChooserWidget, 996 f: glib::ffi::gpointer, 997 ) { 998 let f: &F = &*(f as *const F); 999 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) 1000 } 1001 unsafe { 1002 let f: Box_<F> = Box_::new(f); 1003 connect_raw( 1004 self.as_ptr() as *mut _, 1005 b"show-hidden\0".as_ptr() as *const _, 1006 Some(transmute::<_, unsafe extern "C" fn()>( 1007 show_hidden_trampoline::<Self, F> as *const (), 1008 )), 1009 Box_::into_raw(f), 1010 ) 1011 } 1012 } 1013 emit_show_hidden(&self)1014 fn emit_show_hidden(&self) { 1015 let _ = unsafe { 1016 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 1017 .emit_by_name("show-hidden", &[]) 1018 .unwrap() 1019 }; 1020 } 1021 connect_up_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1022 fn connect_up_folder<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1023 unsafe extern "C" fn up_folder_trampoline< 1024 P: IsA<FileChooserWidget>, 1025 F: Fn(&P) + 'static, 1026 >( 1027 this: *mut ffi::GtkFileChooserWidget, 1028 f: glib::ffi::gpointer, 1029 ) { 1030 let f: &F = &*(f as *const F); 1031 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) 1032 } 1033 unsafe { 1034 let f: Box_<F> = Box_::new(f); 1035 connect_raw( 1036 self.as_ptr() as *mut _, 1037 b"up-folder\0".as_ptr() as *const _, 1038 Some(transmute::<_, unsafe extern "C" fn()>( 1039 up_folder_trampoline::<Self, F> as *const (), 1040 )), 1041 Box_::into_raw(f), 1042 ) 1043 } 1044 } 1045 emit_up_folder(&self)1046 fn emit_up_folder(&self) { 1047 let _ = unsafe { 1048 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 1049 .emit_by_name("up-folder", &[]) 1050 .unwrap() 1051 }; 1052 } 1053 connect_search_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1054 fn connect_search_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1055 unsafe extern "C" fn notify_search_mode_trampoline< 1056 P: IsA<FileChooserWidget>, 1057 F: Fn(&P) + 'static, 1058 >( 1059 this: *mut ffi::GtkFileChooserWidget, 1060 _param_spec: glib::ffi::gpointer, 1061 f: glib::ffi::gpointer, 1062 ) { 1063 let f: &F = &*(f as *const F); 1064 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) 1065 } 1066 unsafe { 1067 let f: Box_<F> = Box_::new(f); 1068 connect_raw( 1069 self.as_ptr() as *mut _, 1070 b"notify::search-mode\0".as_ptr() as *const _, 1071 Some(transmute::<_, unsafe extern "C" fn()>( 1072 notify_search_mode_trampoline::<Self, F> as *const (), 1073 )), 1074 Box_::into_raw(f), 1075 ) 1076 } 1077 } 1078 connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1079 fn connect_subtitle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1080 unsafe extern "C" fn notify_subtitle_trampoline< 1081 P: IsA<FileChooserWidget>, 1082 F: Fn(&P) + 'static, 1083 >( 1084 this: *mut ffi::GtkFileChooserWidget, 1085 _param_spec: glib::ffi::gpointer, 1086 f: glib::ffi::gpointer, 1087 ) { 1088 let f: &F = &*(f as *const F); 1089 f(FileChooserWidget::from_glib_borrow(this).unsafe_cast_ref()) 1090 } 1091 unsafe { 1092 let f: Box_<F> = Box_::new(f); 1093 connect_raw( 1094 self.as_ptr() as *mut _, 1095 b"notify::subtitle\0".as_ptr() as *const _, 1096 Some(transmute::<_, unsafe extern "C" fn()>( 1097 notify_subtitle_trampoline::<Self, F> as *const (), 1098 )), 1099 Box_::into_raw(f), 1100 ) 1101 } 1102 } 1103 } 1104 1105 impl fmt::Display for FileChooserWidget { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1106 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 1107 f.write_str("FileChooserWidget") 1108 } 1109 } 1110