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::AccelGroup; 6 use crate::Align; 7 use crate::Buildable; 8 use crate::Container; 9 use crate::Menu; 10 use crate::MenuShell; 11 use crate::RecentChooser; 12 use crate::RecentFilter; 13 use crate::RecentManager; 14 use crate::RecentSortType; 15 use crate::ResizeMode; 16 use crate::Widget; 17 use glib::object::Cast; 18 use glib::object::IsA; 19 use glib::signal::connect_raw; 20 use glib::signal::SignalHandlerId; 21 use glib::translate::*; 22 use glib::StaticType; 23 use glib::ToValue; 24 use std::boxed::Box as Box_; 25 use std::fmt; 26 use std::mem::transmute; 27 28 glib::wrapper! { 29 #[doc(alias = "GtkRecentChooserMenu")] 30 pub struct RecentChooserMenu(Object<ffi::GtkRecentChooserMenu, ffi::GtkRecentChooserMenuClass>) @extends Menu, MenuShell, Container, Widget, @implements Buildable, RecentChooser; 31 32 match fn { 33 type_ => || ffi::gtk_recent_chooser_menu_get_type(), 34 } 35 } 36 37 impl RecentChooserMenu { 38 #[doc(alias = "gtk_recent_chooser_menu_new")] new() -> RecentChooserMenu39 pub fn new() -> RecentChooserMenu { 40 assert_initialized_main_thread!(); 41 unsafe { Widget::from_glib_none(ffi::gtk_recent_chooser_menu_new()).unsafe_cast() } 42 } 43 44 #[doc(alias = "gtk_recent_chooser_menu_new_for_manager")] 45 #[doc(alias = "new_for_manager")] for_manager<P: IsA<RecentManager>>(manager: &P) -> RecentChooserMenu46 pub fn for_manager<P: IsA<RecentManager>>(manager: &P) -> RecentChooserMenu { 47 skip_assert_initialized!(); 48 unsafe { 49 Widget::from_glib_none(ffi::gtk_recent_chooser_menu_new_for_manager( 50 manager.as_ref().to_glib_none().0, 51 )) 52 .unsafe_cast() 53 } 54 } 55 56 // rustdoc-stripper-ignore-next 57 /// Creates a new builder-pattern struct instance to construct [`RecentChooserMenu`] objects. 58 /// 59 /// This method returns an instance of [`RecentChooserMenuBuilder`] which can be used to create [`RecentChooserMenu`] objects. builder() -> RecentChooserMenuBuilder60 pub fn builder() -> RecentChooserMenuBuilder { 61 RecentChooserMenuBuilder::default() 62 } 63 } 64 65 impl Default for RecentChooserMenu { default() -> Self66 fn default() -> Self { 67 Self::new() 68 } 69 } 70 71 #[derive(Clone, Default)] 72 // rustdoc-stripper-ignore-next 73 /// A [builder-pattern] type to construct [`RecentChooserMenu`] objects. 74 /// 75 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 76 pub struct RecentChooserMenuBuilder { 77 show_numbers: Option<bool>, 78 accel_group: Option<AccelGroup>, 79 accel_path: Option<String>, 80 active: Option<i32>, 81 #[cfg(any(feature = "v3_22", feature = "dox"))] 82 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 83 anchor_hints: Option<gdk::AnchorHints>, 84 attach_widget: Option<Widget>, 85 #[cfg(any(feature = "v3_22", feature = "dox"))] 86 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 87 menu_type_hint: Option<gdk::WindowTypeHint>, 88 monitor: Option<i32>, 89 #[cfg(any(feature = "v3_22", feature = "dox"))] 90 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 91 rect_anchor_dx: Option<i32>, 92 #[cfg(any(feature = "v3_22", feature = "dox"))] 93 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] 94 rect_anchor_dy: Option<i32>, 95 reserve_toggle_size: Option<bool>, 96 take_focus: Option<bool>, 97 border_width: Option<u32>, 98 child: Option<Widget>, 99 resize_mode: Option<ResizeMode>, 100 app_paintable: Option<bool>, 101 can_default: Option<bool>, 102 can_focus: Option<bool>, 103 events: Option<gdk::EventMask>, 104 expand: Option<bool>, 105 #[cfg(any(feature = "v3_20", feature = "dox"))] 106 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 107 focus_on_click: Option<bool>, 108 halign: Option<Align>, 109 has_default: Option<bool>, 110 has_focus: Option<bool>, 111 has_tooltip: Option<bool>, 112 height_request: Option<i32>, 113 hexpand: Option<bool>, 114 hexpand_set: Option<bool>, 115 is_focus: Option<bool>, 116 margin: Option<i32>, 117 margin_bottom: Option<i32>, 118 margin_end: Option<i32>, 119 margin_start: Option<i32>, 120 margin_top: Option<i32>, 121 name: Option<String>, 122 no_show_all: Option<bool>, 123 opacity: Option<f64>, 124 parent: Option<Container>, 125 receives_default: Option<bool>, 126 sensitive: Option<bool>, 127 tooltip_markup: Option<String>, 128 tooltip_text: Option<String>, 129 valign: Option<Align>, 130 vexpand: Option<bool>, 131 vexpand_set: Option<bool>, 132 visible: Option<bool>, 133 width_request: Option<i32>, 134 filter: Option<RecentFilter>, 135 limit: Option<i32>, 136 local_only: Option<bool>, 137 recent_manager: Option<RecentManager>, 138 select_multiple: Option<bool>, 139 show_icons: Option<bool>, 140 show_not_found: Option<bool>, 141 show_private: Option<bool>, 142 show_tips: Option<bool>, 143 sort_type: Option<RecentSortType>, 144 } 145 146 impl RecentChooserMenuBuilder { 147 // rustdoc-stripper-ignore-next 148 /// Create a new [`RecentChooserMenuBuilder`]. new() -> Self149 pub fn new() -> Self { 150 Self::default() 151 } 152 153 // rustdoc-stripper-ignore-next 154 /// Build the [`RecentChooserMenu`]. build(self) -> RecentChooserMenu155 pub fn build(self) -> RecentChooserMenu { 156 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 157 if let Some(ref show_numbers) = self.show_numbers { 158 properties.push(("show-numbers", show_numbers)); 159 } 160 if let Some(ref accel_group) = self.accel_group { 161 properties.push(("accel-group", accel_group)); 162 } 163 if let Some(ref accel_path) = self.accel_path { 164 properties.push(("accel-path", accel_path)); 165 } 166 if let Some(ref active) = self.active { 167 properties.push(("active", active)); 168 } 169 #[cfg(any(feature = "v3_22", feature = "dox"))] 170 if let Some(ref anchor_hints) = self.anchor_hints { 171 properties.push(("anchor-hints", anchor_hints)); 172 } 173 if let Some(ref attach_widget) = self.attach_widget { 174 properties.push(("attach-widget", attach_widget)); 175 } 176 #[cfg(any(feature = "v3_22", feature = "dox"))] 177 if let Some(ref menu_type_hint) = self.menu_type_hint { 178 properties.push(("menu-type-hint", menu_type_hint)); 179 } 180 if let Some(ref monitor) = self.monitor { 181 properties.push(("monitor", monitor)); 182 } 183 #[cfg(any(feature = "v3_22", feature = "dox"))] 184 if let Some(ref rect_anchor_dx) = self.rect_anchor_dx { 185 properties.push(("rect-anchor-dx", rect_anchor_dx)); 186 } 187 #[cfg(any(feature = "v3_22", feature = "dox"))] 188 if let Some(ref rect_anchor_dy) = self.rect_anchor_dy { 189 properties.push(("rect-anchor-dy", rect_anchor_dy)); 190 } 191 if let Some(ref reserve_toggle_size) = self.reserve_toggle_size { 192 properties.push(("reserve-toggle-size", reserve_toggle_size)); 193 } 194 if let Some(ref take_focus) = self.take_focus { 195 properties.push(("take-focus", take_focus)); 196 } 197 if let Some(ref border_width) = self.border_width { 198 properties.push(("border-width", border_width)); 199 } 200 if let Some(ref child) = self.child { 201 properties.push(("child", child)); 202 } 203 if let Some(ref resize_mode) = self.resize_mode { 204 properties.push(("resize-mode", resize_mode)); 205 } 206 if let Some(ref app_paintable) = self.app_paintable { 207 properties.push(("app-paintable", app_paintable)); 208 } 209 if let Some(ref can_default) = self.can_default { 210 properties.push(("can-default", can_default)); 211 } 212 if let Some(ref can_focus) = self.can_focus { 213 properties.push(("can-focus", can_focus)); 214 } 215 if let Some(ref events) = self.events { 216 properties.push(("events", events)); 217 } 218 if let Some(ref expand) = self.expand { 219 properties.push(("expand", expand)); 220 } 221 #[cfg(any(feature = "v3_20", feature = "dox"))] 222 if let Some(ref focus_on_click) = self.focus_on_click { 223 properties.push(("focus-on-click", focus_on_click)); 224 } 225 if let Some(ref halign) = self.halign { 226 properties.push(("halign", halign)); 227 } 228 if let Some(ref has_default) = self.has_default { 229 properties.push(("has-default", has_default)); 230 } 231 if let Some(ref has_focus) = self.has_focus { 232 properties.push(("has-focus", has_focus)); 233 } 234 if let Some(ref has_tooltip) = self.has_tooltip { 235 properties.push(("has-tooltip", has_tooltip)); 236 } 237 if let Some(ref height_request) = self.height_request { 238 properties.push(("height-request", height_request)); 239 } 240 if let Some(ref hexpand) = self.hexpand { 241 properties.push(("hexpand", hexpand)); 242 } 243 if let Some(ref hexpand_set) = self.hexpand_set { 244 properties.push(("hexpand-set", hexpand_set)); 245 } 246 if let Some(ref is_focus) = self.is_focus { 247 properties.push(("is-focus", is_focus)); 248 } 249 if let Some(ref margin) = self.margin { 250 properties.push(("margin", margin)); 251 } 252 if let Some(ref margin_bottom) = self.margin_bottom { 253 properties.push(("margin-bottom", margin_bottom)); 254 } 255 if let Some(ref margin_end) = self.margin_end { 256 properties.push(("margin-end", margin_end)); 257 } 258 if let Some(ref margin_start) = self.margin_start { 259 properties.push(("margin-start", margin_start)); 260 } 261 if let Some(ref margin_top) = self.margin_top { 262 properties.push(("margin-top", margin_top)); 263 } 264 if let Some(ref name) = self.name { 265 properties.push(("name", name)); 266 } 267 if let Some(ref no_show_all) = self.no_show_all { 268 properties.push(("no-show-all", no_show_all)); 269 } 270 if let Some(ref opacity) = self.opacity { 271 properties.push(("opacity", opacity)); 272 } 273 if let Some(ref parent) = self.parent { 274 properties.push(("parent", parent)); 275 } 276 if let Some(ref receives_default) = self.receives_default { 277 properties.push(("receives-default", receives_default)); 278 } 279 if let Some(ref sensitive) = self.sensitive { 280 properties.push(("sensitive", sensitive)); 281 } 282 if let Some(ref tooltip_markup) = self.tooltip_markup { 283 properties.push(("tooltip-markup", tooltip_markup)); 284 } 285 if let Some(ref tooltip_text) = self.tooltip_text { 286 properties.push(("tooltip-text", tooltip_text)); 287 } 288 if let Some(ref valign) = self.valign { 289 properties.push(("valign", valign)); 290 } 291 if let Some(ref vexpand) = self.vexpand { 292 properties.push(("vexpand", vexpand)); 293 } 294 if let Some(ref vexpand_set) = self.vexpand_set { 295 properties.push(("vexpand-set", vexpand_set)); 296 } 297 if let Some(ref visible) = self.visible { 298 properties.push(("visible", visible)); 299 } 300 if let Some(ref width_request) = self.width_request { 301 properties.push(("width-request", width_request)); 302 } 303 if let Some(ref filter) = self.filter { 304 properties.push(("filter", filter)); 305 } 306 if let Some(ref limit) = self.limit { 307 properties.push(("limit", limit)); 308 } 309 if let Some(ref local_only) = self.local_only { 310 properties.push(("local-only", local_only)); 311 } 312 if let Some(ref recent_manager) = self.recent_manager { 313 properties.push(("recent-manager", recent_manager)); 314 } 315 if let Some(ref select_multiple) = self.select_multiple { 316 properties.push(("select-multiple", select_multiple)); 317 } 318 if let Some(ref show_icons) = self.show_icons { 319 properties.push(("show-icons", show_icons)); 320 } 321 if let Some(ref show_not_found) = self.show_not_found { 322 properties.push(("show-not-found", show_not_found)); 323 } 324 if let Some(ref show_private) = self.show_private { 325 properties.push(("show-private", show_private)); 326 } 327 if let Some(ref show_tips) = self.show_tips { 328 properties.push(("show-tips", show_tips)); 329 } 330 if let Some(ref sort_type) = self.sort_type { 331 properties.push(("sort-type", sort_type)); 332 } 333 glib::Object::new::<RecentChooserMenu>(&properties) 334 .expect("Failed to create an instance of RecentChooserMenu") 335 } 336 show_numbers(mut self, show_numbers: bool) -> Self337 pub fn show_numbers(mut self, show_numbers: bool) -> Self { 338 self.show_numbers = Some(show_numbers); 339 self 340 } 341 accel_group<P: IsA<AccelGroup>>(mut self, accel_group: &P) -> Self342 pub fn accel_group<P: IsA<AccelGroup>>(mut self, accel_group: &P) -> Self { 343 self.accel_group = Some(accel_group.clone().upcast()); 344 self 345 } 346 accel_path(mut self, accel_path: &str) -> Self347 pub fn accel_path(mut self, accel_path: &str) -> Self { 348 self.accel_path = Some(accel_path.to_string()); 349 self 350 } 351 active(mut self, active: i32) -> Self352 pub fn active(mut self, active: i32) -> Self { 353 self.active = Some(active); 354 self 355 } 356 357 #[cfg(any(feature = "v3_22", feature = "dox"))] 358 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] anchor_hints(mut self, anchor_hints: gdk::AnchorHints) -> Self359 pub fn anchor_hints(mut self, anchor_hints: gdk::AnchorHints) -> Self { 360 self.anchor_hints = Some(anchor_hints); 361 self 362 } 363 attach_widget<P: IsA<Widget>>(mut self, attach_widget: &P) -> Self364 pub fn attach_widget<P: IsA<Widget>>(mut self, attach_widget: &P) -> Self { 365 self.attach_widget = Some(attach_widget.clone().upcast()); 366 self 367 } 368 369 #[cfg(any(feature = "v3_22", feature = "dox"))] 370 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] menu_type_hint(mut self, menu_type_hint: gdk::WindowTypeHint) -> Self371 pub fn menu_type_hint(mut self, menu_type_hint: gdk::WindowTypeHint) -> Self { 372 self.menu_type_hint = Some(menu_type_hint); 373 self 374 } 375 monitor(mut self, monitor: i32) -> Self376 pub fn monitor(mut self, monitor: i32) -> Self { 377 self.monitor = Some(monitor); 378 self 379 } 380 381 #[cfg(any(feature = "v3_22", feature = "dox"))] 382 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] rect_anchor_dx(mut self, rect_anchor_dx: i32) -> Self383 pub fn rect_anchor_dx(mut self, rect_anchor_dx: i32) -> Self { 384 self.rect_anchor_dx = Some(rect_anchor_dx); 385 self 386 } 387 388 #[cfg(any(feature = "v3_22", feature = "dox"))] 389 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_22")))] rect_anchor_dy(mut self, rect_anchor_dy: i32) -> Self390 pub fn rect_anchor_dy(mut self, rect_anchor_dy: i32) -> Self { 391 self.rect_anchor_dy = Some(rect_anchor_dy); 392 self 393 } 394 reserve_toggle_size(mut self, reserve_toggle_size: bool) -> Self395 pub fn reserve_toggle_size(mut self, reserve_toggle_size: bool) -> Self { 396 self.reserve_toggle_size = Some(reserve_toggle_size); 397 self 398 } 399 take_focus(mut self, take_focus: bool) -> Self400 pub fn take_focus(mut self, take_focus: bool) -> Self { 401 self.take_focus = Some(take_focus); 402 self 403 } 404 border_width(mut self, border_width: u32) -> Self405 pub fn border_width(mut self, border_width: u32) -> Self { 406 self.border_width = Some(border_width); 407 self 408 } 409 child<P: IsA<Widget>>(mut self, child: &P) -> Self410 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 411 self.child = Some(child.clone().upcast()); 412 self 413 } 414 resize_mode(mut self, resize_mode: ResizeMode) -> Self415 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 416 self.resize_mode = Some(resize_mode); 417 self 418 } 419 app_paintable(mut self, app_paintable: bool) -> Self420 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 421 self.app_paintable = Some(app_paintable); 422 self 423 } 424 can_default(mut self, can_default: bool) -> Self425 pub fn can_default(mut self, can_default: bool) -> Self { 426 self.can_default = Some(can_default); 427 self 428 } 429 can_focus(mut self, can_focus: bool) -> Self430 pub fn can_focus(mut self, can_focus: bool) -> Self { 431 self.can_focus = Some(can_focus); 432 self 433 } 434 events(mut self, events: gdk::EventMask) -> Self435 pub fn events(mut self, events: gdk::EventMask) -> Self { 436 self.events = Some(events); 437 self 438 } 439 expand(mut self, expand: bool) -> Self440 pub fn expand(mut self, expand: bool) -> Self { 441 self.expand = Some(expand); 442 self 443 } 444 445 #[cfg(any(feature = "v3_20", feature = "dox"))] 446 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self447 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 448 self.focus_on_click = Some(focus_on_click); 449 self 450 } 451 halign(mut self, halign: Align) -> Self452 pub fn halign(mut self, halign: Align) -> Self { 453 self.halign = Some(halign); 454 self 455 } 456 has_default(mut self, has_default: bool) -> Self457 pub fn has_default(mut self, has_default: bool) -> Self { 458 self.has_default = Some(has_default); 459 self 460 } 461 has_focus(mut self, has_focus: bool) -> Self462 pub fn has_focus(mut self, has_focus: bool) -> Self { 463 self.has_focus = Some(has_focus); 464 self 465 } 466 has_tooltip(mut self, has_tooltip: bool) -> Self467 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 468 self.has_tooltip = Some(has_tooltip); 469 self 470 } 471 height_request(mut self, height_request: i32) -> Self472 pub fn height_request(mut self, height_request: i32) -> Self { 473 self.height_request = Some(height_request); 474 self 475 } 476 hexpand(mut self, hexpand: bool) -> Self477 pub fn hexpand(mut self, hexpand: bool) -> Self { 478 self.hexpand = Some(hexpand); 479 self 480 } 481 hexpand_set(mut self, hexpand_set: bool) -> Self482 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 483 self.hexpand_set = Some(hexpand_set); 484 self 485 } 486 is_focus(mut self, is_focus: bool) -> Self487 pub fn is_focus(mut self, is_focus: bool) -> Self { 488 self.is_focus = Some(is_focus); 489 self 490 } 491 margin(mut self, margin: i32) -> Self492 pub fn margin(mut self, margin: i32) -> Self { 493 self.margin = Some(margin); 494 self 495 } 496 margin_bottom(mut self, margin_bottom: i32) -> Self497 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 498 self.margin_bottom = Some(margin_bottom); 499 self 500 } 501 margin_end(mut self, margin_end: i32) -> Self502 pub fn margin_end(mut self, margin_end: i32) -> Self { 503 self.margin_end = Some(margin_end); 504 self 505 } 506 margin_start(mut self, margin_start: i32) -> Self507 pub fn margin_start(mut self, margin_start: i32) -> Self { 508 self.margin_start = Some(margin_start); 509 self 510 } 511 margin_top(mut self, margin_top: i32) -> Self512 pub fn margin_top(mut self, margin_top: i32) -> Self { 513 self.margin_top = Some(margin_top); 514 self 515 } 516 name(mut self, name: &str) -> Self517 pub fn name(mut self, name: &str) -> Self { 518 self.name = Some(name.to_string()); 519 self 520 } 521 no_show_all(mut self, no_show_all: bool) -> Self522 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 523 self.no_show_all = Some(no_show_all); 524 self 525 } 526 opacity(mut self, opacity: f64) -> Self527 pub fn opacity(mut self, opacity: f64) -> Self { 528 self.opacity = Some(opacity); 529 self 530 } 531 parent<P: IsA<Container>>(mut self, parent: &P) -> Self532 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 533 self.parent = Some(parent.clone().upcast()); 534 self 535 } 536 receives_default(mut self, receives_default: bool) -> Self537 pub fn receives_default(mut self, receives_default: bool) -> Self { 538 self.receives_default = Some(receives_default); 539 self 540 } 541 sensitive(mut self, sensitive: bool) -> Self542 pub fn sensitive(mut self, sensitive: bool) -> Self { 543 self.sensitive = Some(sensitive); 544 self 545 } 546 tooltip_markup(mut self, tooltip_markup: &str) -> Self547 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 548 self.tooltip_markup = Some(tooltip_markup.to_string()); 549 self 550 } 551 tooltip_text(mut self, tooltip_text: &str) -> Self552 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 553 self.tooltip_text = Some(tooltip_text.to_string()); 554 self 555 } 556 valign(mut self, valign: Align) -> Self557 pub fn valign(mut self, valign: Align) -> Self { 558 self.valign = Some(valign); 559 self 560 } 561 vexpand(mut self, vexpand: bool) -> Self562 pub fn vexpand(mut self, vexpand: bool) -> Self { 563 self.vexpand = Some(vexpand); 564 self 565 } 566 vexpand_set(mut self, vexpand_set: bool) -> Self567 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 568 self.vexpand_set = Some(vexpand_set); 569 self 570 } 571 visible(mut self, visible: bool) -> Self572 pub fn visible(mut self, visible: bool) -> Self { 573 self.visible = Some(visible); 574 self 575 } 576 width_request(mut self, width_request: i32) -> Self577 pub fn width_request(mut self, width_request: i32) -> Self { 578 self.width_request = Some(width_request); 579 self 580 } 581 filter(mut self, filter: &RecentFilter) -> Self582 pub fn filter(mut self, filter: &RecentFilter) -> Self { 583 self.filter = Some(filter.clone()); 584 self 585 } 586 limit(mut self, limit: i32) -> Self587 pub fn limit(mut self, limit: i32) -> Self { 588 self.limit = Some(limit); 589 self 590 } 591 local_only(mut self, local_only: bool) -> Self592 pub fn local_only(mut self, local_only: bool) -> Self { 593 self.local_only = Some(local_only); 594 self 595 } 596 recent_manager<P: IsA<RecentManager>>(mut self, recent_manager: &P) -> Self597 pub fn recent_manager<P: IsA<RecentManager>>(mut self, recent_manager: &P) -> Self { 598 self.recent_manager = Some(recent_manager.clone().upcast()); 599 self 600 } 601 select_multiple(mut self, select_multiple: bool) -> Self602 pub fn select_multiple(mut self, select_multiple: bool) -> Self { 603 self.select_multiple = Some(select_multiple); 604 self 605 } 606 show_icons(mut self, show_icons: bool) -> Self607 pub fn show_icons(mut self, show_icons: bool) -> Self { 608 self.show_icons = Some(show_icons); 609 self 610 } 611 show_not_found(mut self, show_not_found: bool) -> Self612 pub fn show_not_found(mut self, show_not_found: bool) -> Self { 613 self.show_not_found = Some(show_not_found); 614 self 615 } 616 show_private(mut self, show_private: bool) -> Self617 pub fn show_private(mut self, show_private: bool) -> Self { 618 self.show_private = Some(show_private); 619 self 620 } 621 show_tips(mut self, show_tips: bool) -> Self622 pub fn show_tips(mut self, show_tips: bool) -> Self { 623 self.show_tips = Some(show_tips); 624 self 625 } 626 sort_type(mut self, sort_type: RecentSortType) -> Self627 pub fn sort_type(mut self, sort_type: RecentSortType) -> Self { 628 self.sort_type = Some(sort_type); 629 self 630 } 631 } 632 633 pub const NONE_RECENT_CHOOSER_MENU: Option<&RecentChooserMenu> = None; 634 635 pub trait RecentChooserMenuExt: 'static { 636 #[doc(alias = "gtk_recent_chooser_menu_get_show_numbers")] 637 #[doc(alias = "get_show_numbers")] shows_numbers(&self) -> bool638 fn shows_numbers(&self) -> bool; 639 640 #[doc(alias = "gtk_recent_chooser_menu_set_show_numbers")] set_show_numbers(&self, show_numbers: bool)641 fn set_show_numbers(&self, show_numbers: bool); 642 643 #[doc(alias = "show-numbers")] connect_show_numbers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId644 fn connect_show_numbers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 645 } 646 647 impl<O: IsA<RecentChooserMenu>> RecentChooserMenuExt for O { shows_numbers(&self) -> bool648 fn shows_numbers(&self) -> bool { 649 unsafe { 650 from_glib(ffi::gtk_recent_chooser_menu_get_show_numbers( 651 self.as_ref().to_glib_none().0, 652 )) 653 } 654 } 655 set_show_numbers(&self, show_numbers: bool)656 fn set_show_numbers(&self, show_numbers: bool) { 657 unsafe { 658 ffi::gtk_recent_chooser_menu_set_show_numbers( 659 self.as_ref().to_glib_none().0, 660 show_numbers.into_glib(), 661 ); 662 } 663 } 664 connect_show_numbers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId665 fn connect_show_numbers_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 666 unsafe extern "C" fn notify_show_numbers_trampoline< 667 P: IsA<RecentChooserMenu>, 668 F: Fn(&P) + 'static, 669 >( 670 this: *mut ffi::GtkRecentChooserMenu, 671 _param_spec: glib::ffi::gpointer, 672 f: glib::ffi::gpointer, 673 ) { 674 let f: &F = &*(f as *const F); 675 f(RecentChooserMenu::from_glib_borrow(this).unsafe_cast_ref()) 676 } 677 unsafe { 678 let f: Box_<F> = Box_::new(f); 679 connect_raw( 680 self.as_ptr() as *mut _, 681 b"notify::show-numbers\0".as_ptr() as *const _, 682 Some(transmute::<_, unsafe extern "C" fn()>( 683 notify_show_numbers_trampoline::<Self, F> as *const (), 684 )), 685 Box_::into_raw(f), 686 ) 687 } 688 } 689 } 690 691 impl fmt::Display for RecentChooserMenu { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result692 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 693 f.write_str("RecentChooserMenu") 694 } 695 } 696