1use gdk;
6use gdk_pixbuf;
7use glib::object::Cast;
8use glib::translate::*;
9use glib::StaticType;
10use glib::ToValue;
11use gtk_sys;
12use std::fmt;
13use Align;
14use Application;
15use Bin;
16use Buildable;
17use Container;
18use Dialog;
19use RecentChooser;
20use ResizeMode;
21use Widget;
22use Window;
23use WindowPosition;
24use WindowType;
25
26glib_wrapper! {
27 pub struct RecentChooserDialog(Object<gtk_sys::GtkRecentChooserDialog, gtk_sys::GtkRecentChooserDialogClass, RecentChooserDialogClass>) @extends Dialog, Window, Bin, Container, Widget, @implements Buildable, RecentChooser;
28
29 match fn {
30 get_type => || gtk_sys::gtk_recent_chooser_dialog_get_type(),
31 }
32}
33
34impl RecentChooserDialog {
35 }
43
44pub struct RecentChooserDialogBuilder {
45 use_header_bar: Option<i32>,
46 accept_focus: Option<bool>,
47 application: Option<Application>,
48 attached_to: Option<Widget>,
49 decorated: Option<bool>,
50 default_height: Option<i32>,
51 default_width: Option<i32>,
52 deletable: Option<bool>,
53 destroy_with_parent: Option<bool>,
54 focus_on_map: Option<bool>,
55 focus_visible: Option<bool>,
56 gravity: Option<gdk::Gravity>,
57 hide_titlebar_when_maximized: Option<bool>,
58 icon: Option<gdk_pixbuf::Pixbuf>,
59 icon_name: Option<String>,
60 mnemonics_visible: Option<bool>,
61 modal: Option<bool>,
62 resizable: Option<bool>,
63 role: Option<String>,
64 screen: Option<gdk::Screen>,
65 skip_pager_hint: Option<bool>,
66 skip_taskbar_hint: Option<bool>,
67 startup_id: Option<String>,
68 title: Option<String>,
69 transient_for: Option<Window>,
70 type_: Option<WindowType>,
71 type_hint: Option<gdk::WindowTypeHint>,
72 urgency_hint: Option<bool>,
73 window_position: Option<WindowPosition>,
74 border_width: Option<u32>,
75 child: Option<Widget>,
76 resize_mode: Option<ResizeMode>,
77 app_paintable: Option<bool>,
78 can_default: Option<bool>,
79 can_focus: Option<bool>,
80 events: Option<gdk::EventMask>,
81 expand: Option<bool>,
82 #[cfg(any(feature = "v3_20", feature = "dox"))]
83 focus_on_click: Option<bool>,
84 halign: Option<Align>,
85 has_default: Option<bool>,
86 has_focus: Option<bool>,
87 has_tooltip: Option<bool>,
88 height_request: Option<i32>,
89 hexpand: Option<bool>,
90 hexpand_set: Option<bool>,
91 is_focus: Option<bool>,
92 margin: Option<i32>,
93 margin_bottom: Option<i32>,
94 margin_end: Option<i32>,
95 margin_start: Option<i32>,
96 margin_top: Option<i32>,
97 name: Option<String>,
98 no_show_all: Option<bool>,
99 opacity: Option<f64>,
100 parent: Option<Container>,
101 receives_default: Option<bool>,
102 sensitive: Option<bool>,
103 tooltip_markup: Option<String>,
105 tooltip_text: Option<String>,
106 valign: Option<Align>,
107 vexpand: Option<bool>,
108 vexpand_set: Option<bool>,
109 visible: Option<bool>,
110 width_request: Option<i32>,
111}
112
113impl RecentChooserDialogBuilder {
114 pub fn new() -> Self {
115 Self {
116 use_header_bar: None,
117 accept_focus: None,
118 application: None,
119 attached_to: None,
120 decorated: None,
121 default_height: None,
122 default_width: None,
123 deletable: None,
124 destroy_with_parent: None,
125 focus_on_map: None,
126 focus_visible: None,
127 gravity: None,
128 hide_titlebar_when_maximized: None,
129 icon: None,
130 icon_name: None,
131 mnemonics_visible: None,
132 modal: None,
133 resizable: None,
134 role: None,
135 screen: None,
136 skip_pager_hint: None,
137 skip_taskbar_hint: None,
138 startup_id: None,
139 title: None,
140 transient_for: None,
141 type_: None,
142 type_hint: None,
143 urgency_hint: None,
144 window_position: None,
145 border_width: None,
146 child: None,
147 resize_mode: None,
148 app_paintable: None,
149 can_default: None,
150 can_focus: None,
151 events: None,
152 expand: None,
153 #[cfg(any(feature = "v3_20", feature = "dox"))]
154 focus_on_click: None,
155 halign: None,
156 has_default: None,
157 has_focus: None,
158 has_tooltip: None,
159 height_request: None,
160 hexpand: None,
161 hexpand_set: None,
162 is_focus: None,
163 margin: None,
164 margin_bottom: None,
165 margin_end: None,
166 margin_start: None,
167 margin_top: None,
168 name: None,
169 no_show_all: None,
170 opacity: None,
171 parent: None,
172 receives_default: None,
173 sensitive: None,
174 tooltip_markup: None,
175 tooltip_text: None,
176 valign: None,
177 vexpand: None,
178 vexpand_set: None,
179 visible: None,
180 width_request: None,
181 }
182 }
183
184 pub fn build(self) -> RecentChooserDialog {
185 let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
186 if let Some(ref use_header_bar) = self.use_header_bar {
187 properties.push(("use-header-bar", use_header_bar));
188 }
189 if let Some(ref accept_focus) = self.accept_focus {
190 properties.push(("accept-focus", accept_focus));
191 }
192 if let Some(ref application) = self.application {
193 properties.push(("application", application));
194 }
195 if let Some(ref attached_to) = self.attached_to {
196 properties.push(("attached-to", attached_to));
197 }
198 if let Some(ref decorated) = self.decorated {
199 properties.push(("decorated", decorated));
200 }
201 if let Some(ref default_height) = self.default_height {
202 properties.push(("default-height", default_height));
203 }
204 if let Some(ref default_width) = self.default_width {
205 properties.push(("default-width", default_width));
206 }
207 if let Some(ref deletable) = self.deletable {
208 properties.push(("deletable", deletable));
209 }
210 if let Some(ref destroy_with_parent) = self.destroy_with_parent {
211 properties.push(("destroy-with-parent", destroy_with_parent));
212 }
213 if let Some(ref focus_on_map) = self.focus_on_map {
214 properties.push(("focus-on-map", focus_on_map));
215 }
216 if let Some(ref focus_visible) = self.focus_visible {
217 properties.push(("focus-visible", focus_visible));
218 }
219 if let Some(ref gravity) = self.gravity {
220 properties.push(("gravity", gravity));
221 }
222 if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized {
223 properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized));
224 }
225 if let Some(ref icon) = self.icon {
226 properties.push(("icon", icon));
227 }
228 if let Some(ref icon_name) = self.icon_name {
229 properties.push(("icon-name", icon_name));
230 }
231 if let Some(ref mnemonics_visible) = self.mnemonics_visible {
232 properties.push(("mnemonics-visible", mnemonics_visible));
233 }
234 if let Some(ref modal) = self.modal {
235 properties.push(("modal", modal));
236 }
237 if let Some(ref resizable) = self.resizable {
238 properties.push(("resizable", resizable));
239 }
240 if let Some(ref role) = self.role {
241 properties.push(("role", role));
242 }
243 if let Some(ref screen) = self.screen {
244 properties.push(("screen", screen));
245 }
246 if let Some(ref skip_pager_hint) = self.skip_pager_hint {
247 properties.push(("skip-pager-hint", skip_pager_hint));
248 }
249 if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint {
250 properties.push(("skip-taskbar-hint", skip_taskbar_hint));
251 }
252 if let Some(ref startup_id) = self.startup_id {
253 properties.push(("startup-id", startup_id));
254 }
255 if let Some(ref title) = self.title {
256 properties.push(("title", title));
257 }
258 if let Some(ref transient_for) = self.transient_for {
259 properties.push(("transient-for", transient_for));
260 }
261 if let Some(ref type_) = self.type_ {
262 properties.push(("type", type_));
263 }
264 if let Some(ref type_hint) = self.type_hint {
265 properties.push(("type-hint", type_hint));
266 }
267 if let Some(ref urgency_hint) = self.urgency_hint {
268 properties.push(("urgency-hint", urgency_hint));
269 }
270 if let Some(ref window_position) = self.window_position {
271 properties.push(("window-position", window_position));
272 }
273 if let Some(ref border_width) = self.border_width {
274 properties.push(("border-width", border_width));
275 }
276 if let Some(ref child) = self.child {
277 properties.push(("child", child));
278 }
279 if let Some(ref resize_mode) = self.resize_mode {
280 properties.push(("resize-mode", resize_mode));
281 }
282 if let Some(ref app_paintable) = self.app_paintable {
283 properties.push(("app-paintable", app_paintable));
284 }
285 if let Some(ref can_default) = self.can_default {
286 properties.push(("can-default", can_default));
287 }
288 if let Some(ref can_focus) = self.can_focus {
289 properties.push(("can-focus", can_focus));
290 }
291 if let Some(ref events) = self.events {
292 properties.push(("events", events));
293 }
294 if let Some(ref expand) = self.expand {
295 properties.push(("expand", expand));
296 }
297 #[cfg(any(feature = "v3_20", feature = "dox"))]
298 {
299 if let Some(ref focus_on_click) = self.focus_on_click {
300 properties.push(("focus-on-click", focus_on_click));
301 }
302 }
303 if let Some(ref halign) = self.halign {
304 properties.push(("halign", halign));
305 }
306 if let Some(ref has_default) = self.has_default {
307 properties.push(("has-default", has_default));
308 }
309 if let Some(ref has_focus) = self.has_focus {
310 properties.push(("has-focus", has_focus));
311 }
312 if let Some(ref has_tooltip) = self.has_tooltip {
313 properties.push(("has-tooltip", has_tooltip));
314 }
315 if let Some(ref height_request) = self.height_request {
316 properties.push(("height-request", height_request));
317 }
318 if let Some(ref hexpand) = self.hexpand {
319 properties.push(("hexpand", hexpand));
320 }
321 if let Some(ref hexpand_set) = self.hexpand_set {
322 properties.push(("hexpand-set", hexpand_set));
323 }
324 if let Some(ref is_focus) = self.is_focus {
325 properties.push(("is-focus", is_focus));
326 }
327 if let Some(ref margin) = self.margin {
328 properties.push(("margin", margin));
329 }
330 if let Some(ref margin_bottom) = self.margin_bottom {
331 properties.push(("margin-bottom", margin_bottom));
332 }
333 if let Some(ref margin_end) = self.margin_end {
334 properties.push(("margin-end", margin_end));
335 }
336 if let Some(ref margin_start) = self.margin_start {
337 properties.push(("margin-start", margin_start));
338 }
339 if let Some(ref margin_top) = self.margin_top {
340 properties.push(("margin-top", margin_top));
341 }
342 if let Some(ref name) = self.name {
343 properties.push(("name", name));
344 }
345 if let Some(ref no_show_all) = self.no_show_all {
346 properties.push(("no-show-all", no_show_all));
347 }
348 if let Some(ref opacity) = self.opacity {
349 properties.push(("opacity", opacity));
350 }
351 if let Some(ref parent) = self.parent {
352 properties.push(("parent", parent));
353 }
354 if let Some(ref receives_default) = self.receives_default {
355 properties.push(("receives-default", receives_default));
356 }
357 if let Some(ref sensitive) = self.sensitive {
358 properties.push(("sensitive", sensitive));
359 }
360 if let Some(ref tooltip_markup) = self.tooltip_markup {
361 properties.push(("tooltip-markup", tooltip_markup));
362 }
363 if let Some(ref tooltip_text) = self.tooltip_text {
364 properties.push(("tooltip-text", tooltip_text));
365 }
366 if let Some(ref valign) = self.valign {
367 properties.push(("valign", valign));
368 }
369 if let Some(ref vexpand) = self.vexpand {
370 properties.push(("vexpand", vexpand));
371 }
372 if let Some(ref vexpand_set) = self.vexpand_set {
373 properties.push(("vexpand-set", vexpand_set));
374 }
375 if let Some(ref visible) = self.visible {
376 properties.push(("visible", visible));
377 }
378 if let Some(ref width_request) = self.width_request {
379 properties.push(("width-request", width_request));
380 }
381 glib::Object::new(RecentChooserDialog::static_type(), &properties)
382 .expect("object new")
383 .downcast()
384 .expect("downcast")
385 }
386
387 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
392 pub fn accept_focus(mut self, accept_focus: bool) -> Self {
393 self.accept_focus = Some(accept_focus);
394 self
395 }
396
397 pub fn application(mut self, application: &Application) -> Self {
398 self.application = Some(application.clone());
399 self
400 }
401
402 pub fn attached_to(mut self, attached_to: &Widget) -> Self {
403 self.attached_to = Some(attached_to.clone());
404 self
405 }
406
407 pub fn decorated(mut self, decorated: bool) -> Self {
408 self.decorated = Some(decorated);
409 self
410 }
411
412 pub fn default_height(mut self, default_height: i32) -> Self {
413 self.default_height = Some(default_height);
414 self
415 }
416
417 pub fn default_width(mut self, default_width: i32) -> Self {
418 self.default_width = Some(default_width);
419 self
420 }
421
422 pub fn deletable(mut self, deletable: bool) -> Self {
423 self.deletable = Some(deletable);
424 self
425 }
426
427 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
432 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
437 pub fn focus_visible(mut self, focus_visible: bool) -> Self {
438 self.focus_visible = Some(focus_visible);
439 self
440 }
441
442 pub fn gravity(mut self, gravity: gdk::Gravity) -> Self {
443 self.gravity = Some(gravity);
444 self
445 }
446
447 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
452 pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self {
453 self.icon = Some(icon.clone());
454 self
455 }
456
457 pub fn icon_name(mut self, icon_name: &str) -> Self {
458 self.icon_name = Some(icon_name.to_string());
459 self
460 }
461
462 pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self {
463 self.mnemonics_visible = Some(mnemonics_visible);
464 self
465 }
466
467 pub fn modal(mut self, modal: bool) -> Self {
468 self.modal = Some(modal);
469 self
470 }
471
472 pub fn resizable(mut self, resizable: bool) -> Self {
473 self.resizable = Some(resizable);
474 self
475 }
476
477 pub fn role(mut self, role: &str) -> Self {
478 self.role = Some(role.to_string());
479 self
480 }
481
482 pub fn screen(mut self, screen: &gdk::Screen) -> Self {
483 self.screen = Some(screen.clone());
484 self
485 }
486
487 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
492 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
497 pub fn startup_id(mut self, startup_id: &str) -> Self {
498 self.startup_id = Some(startup_id.to_string());
499 self
500 }
501
502 pub fn title(mut self, title: &str) -> Self {
503 self.title = Some(title.to_string());
504 self
505 }
506
507 pub fn transient_for(mut self, transient_for: &Window) -> Self {
508 self.transient_for = Some(transient_for.clone());
509 self
510 }
511
512 pub fn type_(mut self, type_: WindowType) -> Self {
513 self.type_ = Some(type_);
514 self
515 }
516
517 pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self {
518 self.type_hint = Some(type_hint);
519 self
520 }
521
522 pub fn urgency_hint(mut self, urgency_hint: bool) -> Self {
523 self.urgency_hint = Some(urgency_hint);
524 self
525 }
526
527 pub fn window_position(mut self, window_position: WindowPosition) -> Self {
528 self.window_position = Some(window_position);
529 self
530 }
531
532 pub fn border_width(mut self, border_width: u32) -> Self {
533 self.border_width = Some(border_width);
534 self
535 }
536
537 pub fn child(mut self, child: &Widget) -> Self {
538 self.child = Some(child.clone());
539 self
540 }
541
542 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
543 self.resize_mode = Some(resize_mode);
544 self
545 }
546
547 pub fn app_paintable(mut self, app_paintable: bool) -> Self {
548 self.app_paintable = Some(app_paintable);
549 self
550 }
551
552 pub fn can_default(mut self, can_default: bool) -> Self {
553 self.can_default = Some(can_default);
554 self
555 }
556
557 pub fn can_focus(mut self, can_focus: bool) -> Self {
558 self.can_focus = Some(can_focus);
559 self
560 }
561
562 pub fn events(mut self, events: gdk::EventMask) -> Self {
563 self.events = Some(events);
564 self
565 }
566
567 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 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
574 self.focus_on_click = Some(focus_on_click);
575 self
576 }
577
578 pub fn halign(mut self, halign: Align) -> Self {
579 self.halign = Some(halign);
580 self
581 }
582
583 pub fn has_default(mut self, has_default: bool) -> Self {
584 self.has_default = Some(has_default);
585 self
586 }
587
588 pub fn has_focus(mut self, has_focus: bool) -> Self {
589 self.has_focus = Some(has_focus);
590 self
591 }
592
593 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
594 self.has_tooltip = Some(has_tooltip);
595 self
596 }
597
598 pub fn height_request(mut self, height_request: i32) -> Self {
599 self.height_request = Some(height_request);
600 self
601 }
602
603 pub fn hexpand(mut self, hexpand: bool) -> Self {
604 self.hexpand = Some(hexpand);
605 self
606 }
607
608 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
609 self.hexpand_set = Some(hexpand_set);
610 self
611 }
612
613 pub fn is_focus(mut self, is_focus: bool) -> Self {
614 self.is_focus = Some(is_focus);
615 self
616 }
617
618 pub fn margin(mut self, margin: i32) -> Self {
619 self.margin = Some(margin);
620 self
621 }
622
623 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
624 self.margin_bottom = Some(margin_bottom);
625 self
626 }
627
628 pub fn margin_end(mut self, margin_end: i32) -> Self {
629 self.margin_end = Some(margin_end);
630 self
631 }
632
633 pub fn margin_start(mut self, margin_start: i32) -> Self {
634 self.margin_start = Some(margin_start);
635 self
636 }
637
638 pub fn margin_top(mut self, margin_top: i32) -> Self {
639 self.margin_top = Some(margin_top);
640 self
641 }
642
643 pub fn name(mut self, name: &str) -> Self {
644 self.name = Some(name.to_string());
645 self
646 }
647
648 pub fn no_show_all(mut self, no_show_all: bool) -> Self {
649 self.no_show_all = Some(no_show_all);
650 self
651 }
652
653 pub fn opacity(mut self, opacity: f64) -> Self {
654 self.opacity = Some(opacity);
655 self
656 }
657
658 pub fn parent(mut self, parent: &Container) -> Self {
659 self.parent = Some(parent.clone());
660 self
661 }
662
663 pub fn receives_default(mut self, receives_default: bool) -> Self {
664 self.receives_default = Some(receives_default);
665 self
666 }
667
668 pub fn sensitive(mut self, sensitive: bool) -> Self {
669 self.sensitive = Some(sensitive);
670 self
671 }
672
673 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
674 self.tooltip_markup = Some(tooltip_markup.to_string());
675 self
676 }
677
678 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
679 self.tooltip_text = Some(tooltip_text.to_string());
680 self
681 }
682
683 pub fn valign(mut self, valign: Align) -> Self {
684 self.valign = Some(valign);
685 self
686 }
687
688 pub fn vexpand(mut self, vexpand: bool) -> Self {
689 self.vexpand = Some(vexpand);
690 self
691 }
692
693 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
694 self.vexpand_set = Some(vexpand_set);
695 self
696 }
697
698 pub fn visible(mut self, visible: bool) -> Self {
699 self.visible = Some(visible);
700 self
701 }
702
703 pub fn width_request(mut self, width_request: i32) -> Self {
704 self.width_request = Some(width_request);
705 self
706 }
707}
708
709pub const NONE_RECENT_CHOOSER_DIALOG: Option<&RecentChooserDialog> = None;
710
711impl fmt::Display for RecentChooserDialog {
712 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
713 write!(f, "RecentChooserDialog")
714 }
715}