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::AppChooser; 7 use crate::Application; 8 use crate::Bin; 9 use crate::Buildable; 10 use crate::Container; 11 use crate::Dialog; 12 use crate::DialogFlags; 13 use crate::ResizeMode; 14 use crate::Widget; 15 use crate::Window; 16 use crate::WindowPosition; 17 use crate::WindowType; 18 use glib::object::Cast; 19 use glib::object::IsA; 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 = "GtkAppChooserDialog")] 31 pub struct AppChooserDialog(Object<ffi::GtkAppChooserDialog, ffi::GtkAppChooserDialogClass>) @extends Dialog, Window, Bin, Container, Widget, @implements Buildable, AppChooser; 32 33 match fn { 34 type_ => || ffi::gtk_app_chooser_dialog_get_type(), 35 } 36 } 37 38 impl AppChooserDialog { 39 #[doc(alias = "gtk_app_chooser_dialog_new")] new<P: IsA<Window>, Q: IsA<gio::File>>( parent: Option<&P>, flags: DialogFlags, file: &Q, ) -> AppChooserDialog40 pub fn new<P: IsA<Window>, Q: IsA<gio::File>>( 41 parent: Option<&P>, 42 flags: DialogFlags, 43 file: &Q, 44 ) -> AppChooserDialog { 45 assert_initialized_main_thread!(); 46 unsafe { 47 Widget::from_glib_none(ffi::gtk_app_chooser_dialog_new( 48 parent.map(|p| p.as_ref()).to_glib_none().0, 49 flags.into_glib(), 50 file.as_ref().to_glib_none().0, 51 )) 52 .unsafe_cast() 53 } 54 } 55 56 #[doc(alias = "gtk_app_chooser_dialog_new_for_content_type")] 57 #[doc(alias = "new_for_content_type")] for_content_type<P: IsA<Window>>( parent: Option<&P>, flags: DialogFlags, content_type: &str, ) -> AppChooserDialog58 pub fn for_content_type<P: IsA<Window>>( 59 parent: Option<&P>, 60 flags: DialogFlags, 61 content_type: &str, 62 ) -> AppChooserDialog { 63 assert_initialized_main_thread!(); 64 unsafe { 65 Widget::from_glib_none(ffi::gtk_app_chooser_dialog_new_for_content_type( 66 parent.map(|p| p.as_ref()).to_glib_none().0, 67 flags.into_glib(), 68 content_type.to_glib_none().0, 69 )) 70 .unsafe_cast() 71 } 72 } 73 74 // rustdoc-stripper-ignore-next 75 /// Creates a new builder-pattern struct instance to construct [`AppChooserDialog`] objects. 76 /// 77 /// This method returns an instance of [`AppChooserDialogBuilder`] which can be used to create [`AppChooserDialog`] objects. builder() -> AppChooserDialogBuilder78 pub fn builder() -> AppChooserDialogBuilder { 79 AppChooserDialogBuilder::default() 80 } 81 } 82 83 #[derive(Clone, Default)] 84 // rustdoc-stripper-ignore-next 85 /// A [builder-pattern] type to construct [`AppChooserDialog`] objects. 86 /// 87 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 88 pub struct AppChooserDialogBuilder { 89 gfile: Option<gio::File>, 90 heading: Option<String>, 91 use_header_bar: Option<i32>, 92 accept_focus: Option<bool>, 93 application: Option<Application>, 94 attached_to: Option<Widget>, 95 decorated: Option<bool>, 96 default_height: Option<i32>, 97 default_width: Option<i32>, 98 deletable: Option<bool>, 99 destroy_with_parent: Option<bool>, 100 focus_on_map: Option<bool>, 101 focus_visible: Option<bool>, 102 gravity: Option<gdk::Gravity>, 103 hide_titlebar_when_maximized: Option<bool>, 104 icon: Option<gdk_pixbuf::Pixbuf>, 105 icon_name: Option<String>, 106 mnemonics_visible: Option<bool>, 107 modal: Option<bool>, 108 resizable: Option<bool>, 109 role: Option<String>, 110 screen: Option<gdk::Screen>, 111 skip_pager_hint: Option<bool>, 112 skip_taskbar_hint: Option<bool>, 113 startup_id: Option<String>, 114 title: Option<String>, 115 transient_for: Option<Window>, 116 type_: Option<WindowType>, 117 type_hint: Option<gdk::WindowTypeHint>, 118 urgency_hint: Option<bool>, 119 window_position: Option<WindowPosition>, 120 border_width: Option<u32>, 121 child: Option<Widget>, 122 resize_mode: Option<ResizeMode>, 123 app_paintable: Option<bool>, 124 can_default: Option<bool>, 125 can_focus: Option<bool>, 126 events: Option<gdk::EventMask>, 127 expand: Option<bool>, 128 #[cfg(any(feature = "v3_20", feature = "dox"))] 129 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 130 focus_on_click: Option<bool>, 131 halign: Option<Align>, 132 has_default: Option<bool>, 133 has_focus: Option<bool>, 134 has_tooltip: Option<bool>, 135 height_request: Option<i32>, 136 hexpand: Option<bool>, 137 hexpand_set: Option<bool>, 138 is_focus: Option<bool>, 139 margin: Option<i32>, 140 margin_bottom: Option<i32>, 141 margin_end: Option<i32>, 142 margin_start: Option<i32>, 143 margin_top: Option<i32>, 144 name: Option<String>, 145 no_show_all: Option<bool>, 146 opacity: Option<f64>, 147 parent: Option<Container>, 148 receives_default: Option<bool>, 149 sensitive: Option<bool>, 150 tooltip_markup: Option<String>, 151 tooltip_text: Option<String>, 152 valign: Option<Align>, 153 vexpand: Option<bool>, 154 vexpand_set: Option<bool>, 155 visible: Option<bool>, 156 width_request: Option<i32>, 157 content_type: Option<String>, 158 } 159 160 impl AppChooserDialogBuilder { 161 // rustdoc-stripper-ignore-next 162 /// Create a new [`AppChooserDialogBuilder`]. new() -> Self163 pub fn new() -> Self { 164 Self::default() 165 } 166 167 // rustdoc-stripper-ignore-next 168 /// Build the [`AppChooserDialog`]. build(self) -> AppChooserDialog169 pub fn build(self) -> AppChooserDialog { 170 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 171 if let Some(ref gfile) = self.gfile { 172 properties.push(("gfile", gfile)); 173 } 174 if let Some(ref heading) = self.heading { 175 properties.push(("heading", heading)); 176 } 177 if let Some(ref use_header_bar) = self.use_header_bar { 178 properties.push(("use-header-bar", use_header_bar)); 179 } 180 if let Some(ref accept_focus) = self.accept_focus { 181 properties.push(("accept-focus", accept_focus)); 182 } 183 if let Some(ref application) = self.application { 184 properties.push(("application", application)); 185 } 186 if let Some(ref attached_to) = self.attached_to { 187 properties.push(("attached-to", attached_to)); 188 } 189 if let Some(ref decorated) = self.decorated { 190 properties.push(("decorated", decorated)); 191 } 192 if let Some(ref default_height) = self.default_height { 193 properties.push(("default-height", default_height)); 194 } 195 if let Some(ref default_width) = self.default_width { 196 properties.push(("default-width", default_width)); 197 } 198 if let Some(ref deletable) = self.deletable { 199 properties.push(("deletable", deletable)); 200 } 201 if let Some(ref destroy_with_parent) = self.destroy_with_parent { 202 properties.push(("destroy-with-parent", destroy_with_parent)); 203 } 204 if let Some(ref focus_on_map) = self.focus_on_map { 205 properties.push(("focus-on-map", focus_on_map)); 206 } 207 if let Some(ref focus_visible) = self.focus_visible { 208 properties.push(("focus-visible", focus_visible)); 209 } 210 if let Some(ref gravity) = self.gravity { 211 properties.push(("gravity", gravity)); 212 } 213 if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized { 214 properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized)); 215 } 216 if let Some(ref icon) = self.icon { 217 properties.push(("icon", icon)); 218 } 219 if let Some(ref icon_name) = self.icon_name { 220 properties.push(("icon-name", icon_name)); 221 } 222 if let Some(ref mnemonics_visible) = self.mnemonics_visible { 223 properties.push(("mnemonics-visible", mnemonics_visible)); 224 } 225 if let Some(ref modal) = self.modal { 226 properties.push(("modal", modal)); 227 } 228 if let Some(ref resizable) = self.resizable { 229 properties.push(("resizable", resizable)); 230 } 231 if let Some(ref role) = self.role { 232 properties.push(("role", role)); 233 } 234 if let Some(ref screen) = self.screen { 235 properties.push(("screen", screen)); 236 } 237 if let Some(ref skip_pager_hint) = self.skip_pager_hint { 238 properties.push(("skip-pager-hint", skip_pager_hint)); 239 } 240 if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint { 241 properties.push(("skip-taskbar-hint", skip_taskbar_hint)); 242 } 243 if let Some(ref startup_id) = self.startup_id { 244 properties.push(("startup-id", startup_id)); 245 } 246 if let Some(ref title) = self.title { 247 properties.push(("title", title)); 248 } 249 if let Some(ref transient_for) = self.transient_for { 250 properties.push(("transient-for", transient_for)); 251 } 252 if let Some(ref type_) = self.type_ { 253 properties.push(("type", type_)); 254 } 255 if let Some(ref type_hint) = self.type_hint { 256 properties.push(("type-hint", type_hint)); 257 } 258 if let Some(ref urgency_hint) = self.urgency_hint { 259 properties.push(("urgency-hint", urgency_hint)); 260 } 261 if let Some(ref window_position) = self.window_position { 262 properties.push(("window-position", window_position)); 263 } 264 if let Some(ref border_width) = self.border_width { 265 properties.push(("border-width", border_width)); 266 } 267 if let Some(ref child) = self.child { 268 properties.push(("child", child)); 269 } 270 if let Some(ref resize_mode) = self.resize_mode { 271 properties.push(("resize-mode", resize_mode)); 272 } 273 if let Some(ref app_paintable) = self.app_paintable { 274 properties.push(("app-paintable", app_paintable)); 275 } 276 if let Some(ref can_default) = self.can_default { 277 properties.push(("can-default", can_default)); 278 } 279 if let Some(ref can_focus) = self.can_focus { 280 properties.push(("can-focus", can_focus)); 281 } 282 if let Some(ref events) = self.events { 283 properties.push(("events", events)); 284 } 285 if let Some(ref expand) = self.expand { 286 properties.push(("expand", expand)); 287 } 288 #[cfg(any(feature = "v3_20", feature = "dox"))] 289 if let Some(ref focus_on_click) = self.focus_on_click { 290 properties.push(("focus-on-click", focus_on_click)); 291 } 292 if let Some(ref halign) = self.halign { 293 properties.push(("halign", halign)); 294 } 295 if let Some(ref has_default) = self.has_default { 296 properties.push(("has-default", has_default)); 297 } 298 if let Some(ref has_focus) = self.has_focus { 299 properties.push(("has-focus", has_focus)); 300 } 301 if let Some(ref has_tooltip) = self.has_tooltip { 302 properties.push(("has-tooltip", has_tooltip)); 303 } 304 if let Some(ref height_request) = self.height_request { 305 properties.push(("height-request", height_request)); 306 } 307 if let Some(ref hexpand) = self.hexpand { 308 properties.push(("hexpand", hexpand)); 309 } 310 if let Some(ref hexpand_set) = self.hexpand_set { 311 properties.push(("hexpand-set", hexpand_set)); 312 } 313 if let Some(ref is_focus) = self.is_focus { 314 properties.push(("is-focus", is_focus)); 315 } 316 if let Some(ref margin) = self.margin { 317 properties.push(("margin", margin)); 318 } 319 if let Some(ref margin_bottom) = self.margin_bottom { 320 properties.push(("margin-bottom", margin_bottom)); 321 } 322 if let Some(ref margin_end) = self.margin_end { 323 properties.push(("margin-end", margin_end)); 324 } 325 if let Some(ref margin_start) = self.margin_start { 326 properties.push(("margin-start", margin_start)); 327 } 328 if let Some(ref margin_top) = self.margin_top { 329 properties.push(("margin-top", margin_top)); 330 } 331 if let Some(ref name) = self.name { 332 properties.push(("name", name)); 333 } 334 if let Some(ref no_show_all) = self.no_show_all { 335 properties.push(("no-show-all", no_show_all)); 336 } 337 if let Some(ref opacity) = self.opacity { 338 properties.push(("opacity", opacity)); 339 } 340 if let Some(ref parent) = self.parent { 341 properties.push(("parent", parent)); 342 } 343 if let Some(ref receives_default) = self.receives_default { 344 properties.push(("receives-default", receives_default)); 345 } 346 if let Some(ref sensitive) = self.sensitive { 347 properties.push(("sensitive", sensitive)); 348 } 349 if let Some(ref tooltip_markup) = self.tooltip_markup { 350 properties.push(("tooltip-markup", tooltip_markup)); 351 } 352 if let Some(ref tooltip_text) = self.tooltip_text { 353 properties.push(("tooltip-text", tooltip_text)); 354 } 355 if let Some(ref valign) = self.valign { 356 properties.push(("valign", valign)); 357 } 358 if let Some(ref vexpand) = self.vexpand { 359 properties.push(("vexpand", vexpand)); 360 } 361 if let Some(ref vexpand_set) = self.vexpand_set { 362 properties.push(("vexpand-set", vexpand_set)); 363 } 364 if let Some(ref visible) = self.visible { 365 properties.push(("visible", visible)); 366 } 367 if let Some(ref width_request) = self.width_request { 368 properties.push(("width-request", width_request)); 369 } 370 if let Some(ref content_type) = self.content_type { 371 properties.push(("content-type", content_type)); 372 } 373 glib::Object::new::<AppChooserDialog>(&properties) 374 .expect("Failed to create an instance of AppChooserDialog") 375 } 376 gfile<P: IsA<gio::File>>(mut self, gfile: &P) -> Self377 pub fn gfile<P: IsA<gio::File>>(mut self, gfile: &P) -> Self { 378 self.gfile = Some(gfile.clone().upcast()); 379 self 380 } 381 heading(mut self, heading: &str) -> Self382 pub fn heading(mut self, heading: &str) -> Self { 383 self.heading = Some(heading.to_string()); 384 self 385 } 386 use_header_bar(mut self, use_header_bar: i32) -> Self387 pub fn use_header_bar(mut self, use_header_bar: i32) -> Self { 388 self.use_header_bar = Some(use_header_bar); 389 self 390 } 391 accept_focus(mut self, accept_focus: bool) -> Self392 pub fn accept_focus(mut self, accept_focus: bool) -> Self { 393 self.accept_focus = Some(accept_focus); 394 self 395 } 396 application<P: IsA<Application>>(mut self, application: &P) -> Self397 pub fn application<P: IsA<Application>>(mut self, application: &P) -> Self { 398 self.application = Some(application.clone().upcast()); 399 self 400 } 401 attached_to<P: IsA<Widget>>(mut self, attached_to: &P) -> Self402 pub fn attached_to<P: IsA<Widget>>(mut self, attached_to: &P) -> Self { 403 self.attached_to = Some(attached_to.clone().upcast()); 404 self 405 } 406 decorated(mut self, decorated: bool) -> Self407 pub fn decorated(mut self, decorated: bool) -> Self { 408 self.decorated = Some(decorated); 409 self 410 } 411 default_height(mut self, default_height: i32) -> Self412 pub fn default_height(mut self, default_height: i32) -> Self { 413 self.default_height = Some(default_height); 414 self 415 } 416 default_width(mut self, default_width: i32) -> Self417 pub fn default_width(mut self, default_width: i32) -> Self { 418 self.default_width = Some(default_width); 419 self 420 } 421 deletable(mut self, deletable: bool) -> Self422 pub fn deletable(mut self, deletable: bool) -> Self { 423 self.deletable = Some(deletable); 424 self 425 } 426 destroy_with_parent(mut self, destroy_with_parent: bool) -> Self427 pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self { 428 self.destroy_with_parent = Some(destroy_with_parent); 429 self 430 } 431 focus_on_map(mut self, focus_on_map: bool) -> Self432 pub fn focus_on_map(mut self, focus_on_map: bool) -> Self { 433 self.focus_on_map = Some(focus_on_map); 434 self 435 } 436 focus_visible(mut self, focus_visible: bool) -> Self437 pub fn focus_visible(mut self, focus_visible: bool) -> Self { 438 self.focus_visible = Some(focus_visible); 439 self 440 } 441 gravity(mut self, gravity: gdk::Gravity) -> Self442 pub fn gravity(mut self, gravity: gdk::Gravity) -> Self { 443 self.gravity = Some(gravity); 444 self 445 } 446 hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self447 pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self { 448 self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized); 449 self 450 } 451 icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self452 pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self { 453 self.icon = Some(icon.clone()); 454 self 455 } 456 icon_name(mut self, icon_name: &str) -> Self457 pub fn icon_name(mut self, icon_name: &str) -> Self { 458 self.icon_name = Some(icon_name.to_string()); 459 self 460 } 461 mnemonics_visible(mut self, mnemonics_visible: bool) -> Self462 pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self { 463 self.mnemonics_visible = Some(mnemonics_visible); 464 self 465 } 466 modal(mut self, modal: bool) -> Self467 pub fn modal(mut self, modal: bool) -> Self { 468 self.modal = Some(modal); 469 self 470 } 471 resizable(mut self, resizable: bool) -> Self472 pub fn resizable(mut self, resizable: bool) -> Self { 473 self.resizable = Some(resizable); 474 self 475 } 476 role(mut self, role: &str) -> Self477 pub fn role(mut self, role: &str) -> Self { 478 self.role = Some(role.to_string()); 479 self 480 } 481 screen(mut self, screen: &gdk::Screen) -> Self482 pub fn screen(mut self, screen: &gdk::Screen) -> Self { 483 self.screen = Some(screen.clone()); 484 self 485 } 486 skip_pager_hint(mut self, skip_pager_hint: bool) -> Self487 pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self { 488 self.skip_pager_hint = Some(skip_pager_hint); 489 self 490 } 491 skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self492 pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self { 493 self.skip_taskbar_hint = Some(skip_taskbar_hint); 494 self 495 } 496 startup_id(mut self, startup_id: &str) -> Self497 pub fn startup_id(mut self, startup_id: &str) -> Self { 498 self.startup_id = Some(startup_id.to_string()); 499 self 500 } 501 title(mut self, title: &str) -> Self502 pub fn title(mut self, title: &str) -> Self { 503 self.title = Some(title.to_string()); 504 self 505 } 506 transient_for<P: IsA<Window>>(mut self, transient_for: &P) -> Self507 pub fn transient_for<P: IsA<Window>>(mut self, transient_for: &P) -> Self { 508 self.transient_for = Some(transient_for.clone().upcast()); 509 self 510 } 511 type_(mut self, type_: WindowType) -> Self512 pub fn type_(mut self, type_: WindowType) -> Self { 513 self.type_ = Some(type_); 514 self 515 } 516 type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self517 pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self { 518 self.type_hint = Some(type_hint); 519 self 520 } 521 urgency_hint(mut self, urgency_hint: bool) -> Self522 pub fn urgency_hint(mut self, urgency_hint: bool) -> Self { 523 self.urgency_hint = Some(urgency_hint); 524 self 525 } 526 window_position(mut self, window_position: WindowPosition) -> Self527 pub fn window_position(mut self, window_position: WindowPosition) -> Self { 528 self.window_position = Some(window_position); 529 self 530 } 531 border_width(mut self, border_width: u32) -> Self532 pub fn border_width(mut self, border_width: u32) -> Self { 533 self.border_width = Some(border_width); 534 self 535 } 536 child<P: IsA<Widget>>(mut self, child: &P) -> Self537 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 538 self.child = Some(child.clone().upcast()); 539 self 540 } 541 resize_mode(mut self, resize_mode: ResizeMode) -> Self542 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 543 self.resize_mode = Some(resize_mode); 544 self 545 } 546 app_paintable(mut self, app_paintable: bool) -> Self547 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 548 self.app_paintable = Some(app_paintable); 549 self 550 } 551 can_default(mut self, can_default: bool) -> Self552 pub fn can_default(mut self, can_default: bool) -> Self { 553 self.can_default = Some(can_default); 554 self 555 } 556 can_focus(mut self, can_focus: bool) -> Self557 pub fn can_focus(mut self, can_focus: bool) -> Self { 558 self.can_focus = Some(can_focus); 559 self 560 } 561 events(mut self, events: gdk::EventMask) -> Self562 pub fn events(mut self, events: gdk::EventMask) -> Self { 563 self.events = Some(events); 564 self 565 } 566 expand(mut self, expand: bool) -> Self567 pub fn expand(mut self, expand: bool) -> Self { 568 self.expand = Some(expand); 569 self 570 } 571 572 #[cfg(any(feature = "v3_20", feature = "dox"))] 573 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self574 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 575 self.focus_on_click = Some(focus_on_click); 576 self 577 } 578 halign(mut self, halign: Align) -> Self579 pub fn halign(mut self, halign: Align) -> Self { 580 self.halign = Some(halign); 581 self 582 } 583 has_default(mut self, has_default: bool) -> Self584 pub fn has_default(mut self, has_default: bool) -> Self { 585 self.has_default = Some(has_default); 586 self 587 } 588 has_focus(mut self, has_focus: bool) -> Self589 pub fn has_focus(mut self, has_focus: bool) -> Self { 590 self.has_focus = Some(has_focus); 591 self 592 } 593 has_tooltip(mut self, has_tooltip: bool) -> Self594 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 595 self.has_tooltip = Some(has_tooltip); 596 self 597 } 598 height_request(mut self, height_request: i32) -> Self599 pub fn height_request(mut self, height_request: i32) -> Self { 600 self.height_request = Some(height_request); 601 self 602 } 603 hexpand(mut self, hexpand: bool) -> Self604 pub fn hexpand(mut self, hexpand: bool) -> Self { 605 self.hexpand = Some(hexpand); 606 self 607 } 608 hexpand_set(mut self, hexpand_set: bool) -> Self609 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 610 self.hexpand_set = Some(hexpand_set); 611 self 612 } 613 is_focus(mut self, is_focus: bool) -> Self614 pub fn is_focus(mut self, is_focus: bool) -> Self { 615 self.is_focus = Some(is_focus); 616 self 617 } 618 margin(mut self, margin: i32) -> Self619 pub fn margin(mut self, margin: i32) -> Self { 620 self.margin = Some(margin); 621 self 622 } 623 margin_bottom(mut self, margin_bottom: i32) -> Self624 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 625 self.margin_bottom = Some(margin_bottom); 626 self 627 } 628 margin_end(mut self, margin_end: i32) -> Self629 pub fn margin_end(mut self, margin_end: i32) -> Self { 630 self.margin_end = Some(margin_end); 631 self 632 } 633 margin_start(mut self, margin_start: i32) -> Self634 pub fn margin_start(mut self, margin_start: i32) -> Self { 635 self.margin_start = Some(margin_start); 636 self 637 } 638 margin_top(mut self, margin_top: i32) -> Self639 pub fn margin_top(mut self, margin_top: i32) -> Self { 640 self.margin_top = Some(margin_top); 641 self 642 } 643 name(mut self, name: &str) -> Self644 pub fn name(mut self, name: &str) -> Self { 645 self.name = Some(name.to_string()); 646 self 647 } 648 no_show_all(mut self, no_show_all: bool) -> Self649 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 650 self.no_show_all = Some(no_show_all); 651 self 652 } 653 opacity(mut self, opacity: f64) -> Self654 pub fn opacity(mut self, opacity: f64) -> Self { 655 self.opacity = Some(opacity); 656 self 657 } 658 parent<P: IsA<Container>>(mut self, parent: &P) -> Self659 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 660 self.parent = Some(parent.clone().upcast()); 661 self 662 } 663 receives_default(mut self, receives_default: bool) -> Self664 pub fn receives_default(mut self, receives_default: bool) -> Self { 665 self.receives_default = Some(receives_default); 666 self 667 } 668 sensitive(mut self, sensitive: bool) -> Self669 pub fn sensitive(mut self, sensitive: bool) -> Self { 670 self.sensitive = Some(sensitive); 671 self 672 } 673 tooltip_markup(mut self, tooltip_markup: &str) -> Self674 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 675 self.tooltip_markup = Some(tooltip_markup.to_string()); 676 self 677 } 678 tooltip_text(mut self, tooltip_text: &str) -> Self679 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 680 self.tooltip_text = Some(tooltip_text.to_string()); 681 self 682 } 683 valign(mut self, valign: Align) -> Self684 pub fn valign(mut self, valign: Align) -> Self { 685 self.valign = Some(valign); 686 self 687 } 688 vexpand(mut self, vexpand: bool) -> Self689 pub fn vexpand(mut self, vexpand: bool) -> Self { 690 self.vexpand = Some(vexpand); 691 self 692 } 693 vexpand_set(mut self, vexpand_set: bool) -> Self694 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 695 self.vexpand_set = Some(vexpand_set); 696 self 697 } 698 visible(mut self, visible: bool) -> Self699 pub fn visible(mut self, visible: bool) -> Self { 700 self.visible = Some(visible); 701 self 702 } 703 width_request(mut self, width_request: i32) -> Self704 pub fn width_request(mut self, width_request: i32) -> Self { 705 self.width_request = Some(width_request); 706 self 707 } 708 content_type(mut self, content_type: &str) -> Self709 pub fn content_type(mut self, content_type: &str) -> Self { 710 self.content_type = Some(content_type.to_string()); 711 self 712 } 713 } 714 715 pub const NONE_APP_CHOOSER_DIALOG: Option<&AppChooserDialog> = None; 716 717 pub trait AppChooserDialogExt: 'static { 718 #[doc(alias = "gtk_app_chooser_dialog_get_heading")] 719 #[doc(alias = "get_heading")] heading(&self) -> Option<glib::GString>720 fn heading(&self) -> Option<glib::GString>; 721 722 #[doc(alias = "gtk_app_chooser_dialog_get_widget")] 723 #[doc(alias = "get_widget")] widget(&self) -> Widget724 fn widget(&self) -> Widget; 725 726 #[doc(alias = "gtk_app_chooser_dialog_set_heading")] set_heading(&self, heading: &str)727 fn set_heading(&self, heading: &str); 728 gfile(&self) -> Option<gio::File>729 fn gfile(&self) -> Option<gio::File>; 730 731 #[doc(alias = "heading")] connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId732 fn connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 733 } 734 735 impl<O: IsA<AppChooserDialog>> AppChooserDialogExt for O { heading(&self) -> Option<glib::GString>736 fn heading(&self) -> Option<glib::GString> { 737 unsafe { 738 from_glib_none(ffi::gtk_app_chooser_dialog_get_heading( 739 self.as_ref().to_glib_none().0, 740 )) 741 } 742 } 743 widget(&self) -> Widget744 fn widget(&self) -> Widget { 745 unsafe { 746 from_glib_none(ffi::gtk_app_chooser_dialog_get_widget( 747 self.as_ref().to_glib_none().0, 748 )) 749 } 750 } 751 set_heading(&self, heading: &str)752 fn set_heading(&self, heading: &str) { 753 unsafe { 754 ffi::gtk_app_chooser_dialog_set_heading( 755 self.as_ref().to_glib_none().0, 756 heading.to_glib_none().0, 757 ); 758 } 759 } 760 gfile(&self) -> Option<gio::File>761 fn gfile(&self) -> Option<gio::File> { 762 unsafe { 763 let mut value = glib::Value::from_type(<gio::File as StaticType>::static_type()); 764 glib::gobject_ffi::g_object_get_property( 765 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 766 b"gfile\0".as_ptr() as *const _, 767 value.to_glib_none_mut().0, 768 ); 769 value 770 .get() 771 .expect("Return Value for property `gfile` getter") 772 } 773 } 774 connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId775 fn connect_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 776 unsafe extern "C" fn notify_heading_trampoline< 777 P: IsA<AppChooserDialog>, 778 F: Fn(&P) + 'static, 779 >( 780 this: *mut ffi::GtkAppChooserDialog, 781 _param_spec: glib::ffi::gpointer, 782 f: glib::ffi::gpointer, 783 ) { 784 let f: &F = &*(f as *const F); 785 f(AppChooserDialog::from_glib_borrow(this).unsafe_cast_ref()) 786 } 787 unsafe { 788 let f: Box_<F> = Box_::new(f); 789 connect_raw( 790 self.as_ptr() as *mut _, 791 b"notify::heading\0".as_ptr() as *const _, 792 Some(transmute::<_, unsafe extern "C" fn()>( 793 notify_heading_trampoline::<Self, F> as *const (), 794 )), 795 Box_::into_raw(f), 796 ) 797 } 798 } 799 } 800 801 impl fmt::Display for AppChooserDialog { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result802 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 803 f.write_str("AppChooserDialog") 804 } 805 } 806