gtk/auto/message_dialog.rs
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
5use crate::{
6 Align, Application, Bin, Buildable, ButtonsType, Container, Dialog, MessageType, ResizeMode,
7 Widget, Window, WindowPosition, WindowType, ffi,
8};
9use glib::{
10 prelude::*,
11 signal::{SignalHandlerId, connect_raw},
12 translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17 ///
18 /// GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
19 /// dialog = gtk_message_dialog_new (parent_window,
20 /// flags,
21 /// GTK_MESSAGE_ERROR,
22 /// GTK_BUTTONS_CLOSE,
23 /// "Error reading “`s`”: `s`",
24 /// filename,
25 /// g_strerror (errno));
26 ///
27 /// // Destroy the dialog when the user responds to it
28 /// // (e.g. clicks a button)
29 ///
30 /// g_signal_connect_swapped (dialog, "response",
31 /// G_CALLBACK (gtk_widget_destroy),
32 /// dialog);
33 /// ]|
34 ///
35 /// # GtkMessageDialog as GtkBuildable
36 ///
37 /// The GtkMessageDialog implementation of the GtkBuildable interface exposes
38 /// the message area as an internal child with the name “message_area”.
39 ///
40 /// ## Properties
41 ///
42 ///
43 /// #### `buttons`
44 /// Writable | Construct Only
45 ///
46 ///
47 /// #### `image`
48 /// The image for this dialog.
49 ///
50 /// Readable | Writable
51 ///
52 ///
53 /// #### `message-area`
54 /// The [`Box`][crate::Box] that corresponds to the message area of this dialog. See
55 /// [`MessageDialogExt::message_area()`][crate::prelude::MessageDialogExt::message_area()] for a detailed description of this
56 /// area.
57 ///
58 /// Readable
59 ///
60 ///
61 /// #### `message-type`
62 /// The type of the message.
63 ///
64 /// Readable | Writable | Construct
65 ///
66 ///
67 /// #### `secondary-text`
68 /// The secondary text of the message dialog.
69 ///
70 /// Readable | Writable
71 ///
72 ///
73 /// #### `secondary-use-markup`
74 /// [`true`] if the secondary text of the dialog includes Pango markup.
75 /// See `pango_parse_markup()`.
76 ///
77 /// Readable | Writable
78 ///
79 ///
80 /// #### `text`
81 /// The primary text of the message dialog. If the dialog has
82 /// a secondary text, this will appear as the title.
83 ///
84 /// Readable | Writable
85 ///
86 ///
87 /// #### `use-markup`
88 /// [`true`] if the primary text of the dialog includes Pango markup.
89 /// See `pango_parse_markup()`.
90 ///
91 /// Readable | Writable
92 /// <details><summary><h4>Dialog</h4></summary>
93 ///
94 ///
95 /// #### `use-header-bar`
96 /// [`true`] if the dialog uses a [`HeaderBar`][crate::HeaderBar] for action buttons
97 /// instead of the action-area.
98 ///
99 /// For technical reasons, this property is declared as an integer
100 /// property, but you should only set it to [`true`] or [`false`].
101 ///
102 /// Readable | Writable | Construct Only
103 /// </details>
104 /// <details><summary><h4>Window</h4></summary>
105 ///
106 ///
107 /// #### `accept-focus`
108 /// Whether the window should receive the input focus.
109 ///
110 /// Readable | Writable
111 ///
112 ///
113 /// #### `application`
114 /// The [`Application`][crate::Application] associated with the window.
115 ///
116 /// The application will be kept alive for at least as long as it
117 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
118 /// for a way to keep it alive without windows).
119 ///
120 /// Normally, the connection between the application and the window
121 /// will remain until the window is destroyed, but you can explicitly
122 /// remove it by setting the :application property to [`None`].
123 ///
124 /// Readable | Writable
125 ///
126 ///
127 /// #### `attached-to`
128 /// The widget to which this window is attached.
129 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
130 ///
131 /// Examples of places where specifying this relation is useful are
132 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
133 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
134 /// created by [`TreeView`][crate::TreeView].
135 ///
136 /// Readable | Writable | Construct
137 ///
138 ///
139 /// #### `decorated`
140 /// Whether the window should be decorated by the window manager.
141 ///
142 /// Readable | Writable
143 ///
144 ///
145 /// #### `default-height`
146 /// Readable | Writable
147 ///
148 ///
149 /// #### `default-width`
150 /// Readable | Writable
151 ///
152 ///
153 /// #### `deletable`
154 /// Whether the window frame should have a close button.
155 ///
156 /// Readable | Writable
157 ///
158 ///
159 /// #### `destroy-with-parent`
160 /// Readable | Writable
161 ///
162 ///
163 /// #### `focus-on-map`
164 /// Whether the window should receive the input focus when mapped.
165 ///
166 /// Readable | Writable
167 ///
168 ///
169 /// #### `focus-visible`
170 /// Whether 'focus rectangles' are currently visible in this window.
171 ///
172 /// This property is maintained by GTK+ based on user input
173 /// and should not be set by applications.
174 ///
175 /// Readable | Writable
176 ///
177 ///
178 /// #### `gravity`
179 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
180 /// more details about window gravity.
181 ///
182 /// Readable | Writable
183 ///
184 ///
185 /// #### `has-resize-grip`
186 /// Whether the window has a corner resize grip.
187 ///
188 /// Note that the resize grip is only shown if the window is
189 /// actually resizable and not maximized. Use
190 /// [`resize-grip-visible`][struct@crate::Window#resize-grip-visible] to find out if the resize
191 /// grip is currently shown.
192 ///
193 /// Readable | Writable
194 ///
195 ///
196 /// #### `has-toplevel-focus`
197 /// Readable
198 ///
199 ///
200 /// #### `hide-titlebar-when-maximized`
201 /// Whether the titlebar should be hidden during maximization.
202 ///
203 /// Readable | Writable
204 ///
205 ///
206 /// #### `icon`
207 /// Readable | Writable
208 ///
209 ///
210 /// #### `icon-name`
211 /// The :icon-name property specifies the name of the themed icon to
212 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
213 ///
214 /// Readable | Writable
215 ///
216 ///
217 /// #### `is-active`
218 /// Readable
219 ///
220 ///
221 /// #### `is-maximized`
222 /// Readable
223 ///
224 ///
225 /// #### `mnemonics-visible`
226 /// Whether mnemonics are currently visible in this window.
227 ///
228 /// This property is maintained by GTK+ based on user input,
229 /// and should not be set by applications.
230 ///
231 /// Readable | Writable
232 ///
233 ///
234 /// #### `modal`
235 /// Readable | Writable
236 ///
237 ///
238 /// #### `resizable`
239 /// Readable | Writable
240 ///
241 ///
242 /// #### `resize-grip-visible`
243 /// Whether a corner resize grip is currently shown.
244 ///
245 /// Readable
246 ///
247 ///
248 /// #### `role`
249 /// Readable | Writable
250 ///
251 ///
252 /// #### `screen`
253 /// Readable | Writable
254 ///
255 ///
256 /// #### `skip-pager-hint`
257 /// Readable | Writable
258 ///
259 ///
260 /// #### `skip-taskbar-hint`
261 /// Readable | Writable
262 ///
263 ///
264 /// #### `startup-id`
265 /// The :startup-id is a write-only property for setting window's
266 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
267 /// for more details.
268 ///
269 /// Writable
270 ///
271 ///
272 /// #### `title`
273 /// Readable | Writable
274 ///
275 ///
276 /// #### `transient-for`
277 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
278 /// more details about transient windows.
279 ///
280 /// Readable | Writable | Construct
281 ///
282 ///
283 /// #### `type`
284 /// Readable | Writable | Construct Only
285 ///
286 ///
287 /// #### `type-hint`
288 /// Readable | Writable
289 ///
290 ///
291 /// #### `urgency-hint`
292 /// Readable | Writable
293 ///
294 ///
295 /// #### `window-position`
296 /// Readable | Writable
297 /// </details>
298 /// <details><summary><h4>Container</h4></summary>
299 ///
300 ///
301 /// #### `border-width`
302 /// Readable | Writable
303 ///
304 ///
305 /// #### `child`
306 /// Writable
307 ///
308 ///
309 /// #### `resize-mode`
310 /// Readable | Writable
311 /// </details>
312 /// <details><summary><h4>Widget</h4></summary>
313 ///
314 ///
315 /// #### `app-paintable`
316 /// Readable | Writable
317 ///
318 ///
319 /// #### `can-default`
320 /// Readable | Writable
321 ///
322 ///
323 /// #### `can-focus`
324 /// Readable | Writable
325 ///
326 ///
327 /// #### `composite-child`
328 /// Readable
329 ///
330 ///
331 /// #### `double-buffered`
332 /// Whether the widget is double buffered.
333 ///
334 /// Readable | Writable
335 ///
336 ///
337 /// #### `events`
338 /// Readable | Writable
339 ///
340 ///
341 /// #### `expand`
342 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
343 ///
344 /// Readable | Writable
345 ///
346 ///
347 /// #### `focus-on-click`
348 /// Whether the widget should grab focus when it is clicked with the mouse.
349 ///
350 /// This property is only relevant for widgets that can take focus.
351 ///
352 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
353 /// GtkComboBox) implemented this property individually.
354 ///
355 /// Readable | Writable
356 ///
357 ///
358 /// #### `halign`
359 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
360 ///
361 /// Readable | Writable
362 ///
363 ///
364 /// #### `has-default`
365 /// Readable | Writable
366 ///
367 ///
368 /// #### `has-focus`
369 /// Readable | Writable
370 ///
371 ///
372 /// #### `has-tooltip`
373 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
374 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
375 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
376 /// whether it will provide a tooltip or not.
377 ///
378 /// Note that setting this property to [`true`] for the first time will change
379 /// the event masks of the GdkWindows of this widget to include leave-notify
380 /// and motion-notify events. This cannot and will not be undone when the
381 /// property is set to [`false`] again.
382 ///
383 /// Readable | Writable
384 ///
385 ///
386 /// #### `height-request`
387 /// Readable | Writable
388 ///
389 ///
390 /// #### `hexpand`
391 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
392 ///
393 /// Readable | Writable
394 ///
395 ///
396 /// #### `hexpand-set`
397 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
398 ///
399 /// Readable | Writable
400 ///
401 ///
402 /// #### `is-focus`
403 /// Readable | Writable
404 ///
405 ///
406 /// #### `margin`
407 /// Sets all four sides' margin at once. If read, returns max
408 /// margin on any side.
409 ///
410 /// Readable | Writable
411 ///
412 ///
413 /// #### `margin-bottom`
414 /// Margin on bottom side of widget.
415 ///
416 /// This property adds margin outside of the widget's normal size
417 /// request, the margin will be added in addition to the size from
418 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
419 ///
420 /// Readable | Writable
421 ///
422 ///
423 /// #### `margin-end`
424 /// Margin on end of widget, horizontally. This property supports
425 /// left-to-right and right-to-left text directions.
426 ///
427 /// This property adds margin outside of the widget's normal size
428 /// request, the margin will be added in addition to the size from
429 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
430 ///
431 /// Readable | Writable
432 ///
433 ///
434 /// #### `margin-left`
435 /// Margin on left side of widget.
436 ///
437 /// This property adds margin outside of the widget's normal size
438 /// request, the margin will be added in addition to the size from
439 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
440 ///
441 /// Readable | Writable
442 ///
443 ///
444 /// #### `margin-right`
445 /// Margin on right side of widget.
446 ///
447 /// This property adds margin outside of the widget's normal size
448 /// request, the margin will be added in addition to the size from
449 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
450 ///
451 /// Readable | Writable
452 ///
453 ///
454 /// #### `margin-start`
455 /// Margin on start of widget, horizontally. This property supports
456 /// left-to-right and right-to-left text directions.
457 ///
458 /// This property adds margin outside of the widget's normal size
459 /// request, the margin will be added in addition to the size from
460 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
461 ///
462 /// Readable | Writable
463 ///
464 ///
465 /// #### `margin-top`
466 /// Margin on top side of widget.
467 ///
468 /// This property adds margin outside of the widget's normal size
469 /// request, the margin will be added in addition to the size from
470 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
471 ///
472 /// Readable | Writable
473 ///
474 ///
475 /// #### `name`
476 /// Readable | Writable
477 ///
478 ///
479 /// #### `no-show-all`
480 /// Readable | Writable
481 ///
482 ///
483 /// #### `opacity`
484 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
485 /// more details about window opacity.
486 ///
487 /// Before 3.8 this was only available in GtkWindow
488 ///
489 /// Readable | Writable
490 ///
491 ///
492 /// #### `parent`
493 /// Readable | Writable
494 ///
495 ///
496 /// #### `receives-default`
497 /// Readable | Writable
498 ///
499 ///
500 /// #### `scale-factor`
501 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
502 /// more details about widget scaling.
503 ///
504 /// Readable
505 ///
506 ///
507 /// #### `sensitive`
508 /// Readable | Writable
509 ///
510 ///
511 /// #### `style`
512 /// The style of the widget, which contains information about how it will look (colors, etc).
513 ///
514 /// Readable | Writable
515 ///
516 ///
517 /// #### `tooltip-markup`
518 /// Sets the text of tooltip to be the given string, which is marked up
519 /// with the [Pango text markup language][PangoMarkupFormat].
520 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
521 ///
522 /// This is a convenience property which will take care of getting the
523 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
524 /// will automatically be set to [`true`] and there will be taken care of
525 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
526 ///
527 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
528 /// are set, the last one wins.
529 ///
530 /// Readable | Writable
531 ///
532 ///
533 /// #### `tooltip-text`
534 /// Sets the text of tooltip to be the given string.
535 ///
536 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
537 ///
538 /// This is a convenience property which will take care of getting the
539 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
540 /// will automatically be set to [`true`] and there will be taken care of
541 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
542 ///
543 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
544 /// are set, the last one wins.
545 ///
546 /// Readable | Writable
547 ///
548 ///
549 /// #### `valign`
550 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
551 ///
552 /// Readable | Writable
553 ///
554 ///
555 /// #### `vexpand`
556 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
557 ///
558 /// Readable | Writable
559 ///
560 ///
561 /// #### `vexpand-set`
562 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
563 ///
564 /// Readable | Writable
565 ///
566 ///
567 /// #### `visible`
568 /// Readable | Writable
569 ///
570 ///
571 /// #### `width-request`
572 /// Readable | Writable
573 ///
574 ///
575 /// #### `window`
576 /// The widget's window if it is realized, [`None`] otherwise.
577 ///
578 /// Readable
579 /// </details>
580 ///
581 /// # Implements
582 ///
583 /// [`MessageDialogExt`][trait@crate::prelude::MessageDialogExt], [`DialogExt`][trait@crate::prelude::DialogExt], [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`DialogExtManual`][trait@crate::prelude::DialogExtManual], [`GtkWindowExtManual`][trait@crate::prelude::GtkWindowExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
584 #[doc(alias = "GtkMessageDialog")]
585 pub struct MessageDialog(Object<ffi::GtkMessageDialog, ffi::GtkMessageDialogClass>) @extends Dialog, Window, Bin, Container, Widget, @implements Buildable;
586
587 match fn {
588 type_ => || ffi::gtk_message_dialog_get_type(),
589 }
590}
591
592impl MessageDialog {
593 pub const NONE: Option<&'static MessageDialog> = None;
594
595 //#[doc(alias = "gtk_message_dialog_new")]
596 //pub fn new(parent: Option<&impl IsA<Window>>, flags: DialogFlags, type_: MessageType, buttons: ButtonsType, message_format: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> MessageDialog {
597 // unsafe { TODO: call ffi:gtk_message_dialog_new() }
598 //}
599
600 //#[doc(alias = "gtk_message_dialog_new_with_markup")]
601 //#[doc(alias = "new_with_markup")]
602 //pub fn with_markup(parent: Option<&impl IsA<Window>>, flags: DialogFlags, type_: MessageType, buttons: ButtonsType, message_format: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> MessageDialog {
603 // unsafe { TODO: call ffi:gtk_message_dialog_new_with_markup() }
604 //}
605
606 // rustdoc-stripper-ignore-next
607 /// Creates a new builder-pattern struct instance to construct [`MessageDialog`] objects.
608 ///
609 /// This method returns an instance of [`MessageDialogBuilder`](crate::builders::MessageDialogBuilder) which can be used to create [`MessageDialog`] objects.
610 pub fn builder() -> MessageDialogBuilder {
611 MessageDialogBuilder::new()
612 }
613}
614
615impl Default for MessageDialog {
616 fn default() -> Self {
617 glib::object::Object::new::<Self>()
618 }
619}
620
621// rustdoc-stripper-ignore-next
622/// A [builder-pattern] type to construct [`MessageDialog`] objects.
623///
624/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
625#[must_use = "The builder must be built to be used"]
626pub struct MessageDialogBuilder {
627 builder: glib::object::ObjectBuilder<'static, MessageDialog>,
628}
629
630impl MessageDialogBuilder {
631 fn new() -> Self {
632 Self {
633 builder: glib::object::Object::builder(),
634 }
635 }
636
637 pub fn buttons(self, buttons: ButtonsType) -> Self {
638 Self {
639 builder: self.builder.property("buttons", buttons),
640 }
641 }
642
643 /// The type of the message.
644 pub fn message_type(self, message_type: MessageType) -> Self {
645 Self {
646 builder: self.builder.property("message-type", message_type),
647 }
648 }
649
650 /// The secondary text of the message dialog.
651 pub fn secondary_text(self, secondary_text: impl Into<glib::GString>) -> Self {
652 Self {
653 builder: self
654 .builder
655 .property("secondary-text", secondary_text.into()),
656 }
657 }
658
659 /// [`true`] if the secondary text of the dialog includes Pango markup.
660 /// See `pango_parse_markup()`.
661 pub fn secondary_use_markup(self, secondary_use_markup: bool) -> Self {
662 Self {
663 builder: self
664 .builder
665 .property("secondary-use-markup", secondary_use_markup),
666 }
667 }
668
669 /// The primary text of the message dialog. If the dialog has
670 /// a secondary text, this will appear as the title.
671 pub fn text(self, text: impl Into<glib::GString>) -> Self {
672 Self {
673 builder: self.builder.property("text", text.into()),
674 }
675 }
676
677 /// [`true`] if the primary text of the dialog includes Pango markup.
678 /// See `pango_parse_markup()`.
679 pub fn use_markup(self, use_markup: bool) -> Self {
680 Self {
681 builder: self.builder.property("use-markup", use_markup),
682 }
683 }
684
685 /// [`true`] if the dialog uses a [`HeaderBar`][crate::HeaderBar] for action buttons
686 /// instead of the action-area.
687 ///
688 /// For technical reasons, this property is declared as an integer
689 /// property, but you should only set it to [`true`] or [`false`].
690 pub fn use_header_bar(self, use_header_bar: i32) -> Self {
691 Self {
692 builder: self.builder.property("use-header-bar", use_header_bar),
693 }
694 }
695
696 /// Whether the window should receive the input focus.
697 pub fn accept_focus(self, accept_focus: bool) -> Self {
698 Self {
699 builder: self.builder.property("accept-focus", accept_focus),
700 }
701 }
702
703 /// The [`Application`][crate::Application] associated with the window.
704 ///
705 /// The application will be kept alive for at least as long as it
706 /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
707 /// for a way to keep it alive without windows).
708 ///
709 /// Normally, the connection between the application and the window
710 /// will remain until the window is destroyed, but you can explicitly
711 /// remove it by setting the :application property to [`None`].
712 pub fn application(self, application: &impl IsA<Application>) -> Self {
713 Self {
714 builder: self
715 .builder
716 .property("application", application.clone().upcast()),
717 }
718 }
719
720 /// The widget to which this window is attached.
721 /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
722 ///
723 /// Examples of places where specifying this relation is useful are
724 /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
725 /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
726 /// created by [`TreeView`][crate::TreeView].
727 pub fn attached_to(self, attached_to: &impl IsA<Widget>) -> Self {
728 Self {
729 builder: self
730 .builder
731 .property("attached-to", attached_to.clone().upcast()),
732 }
733 }
734
735 /// Whether the window should be decorated by the window manager.
736 pub fn decorated(self, decorated: bool) -> Self {
737 Self {
738 builder: self.builder.property("decorated", decorated),
739 }
740 }
741
742 pub fn default_height(self, default_height: i32) -> Self {
743 Self {
744 builder: self.builder.property("default-height", default_height),
745 }
746 }
747
748 pub fn default_width(self, default_width: i32) -> Self {
749 Self {
750 builder: self.builder.property("default-width", default_width),
751 }
752 }
753
754 /// Whether the window frame should have a close button.
755 pub fn deletable(self, deletable: bool) -> Self {
756 Self {
757 builder: self.builder.property("deletable", deletable),
758 }
759 }
760
761 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
762 Self {
763 builder: self
764 .builder
765 .property("destroy-with-parent", destroy_with_parent),
766 }
767 }
768
769 /// Whether the window should receive the input focus when mapped.
770 pub fn focus_on_map(self, focus_on_map: bool) -> Self {
771 Self {
772 builder: self.builder.property("focus-on-map", focus_on_map),
773 }
774 }
775
776 /// Whether 'focus rectangles' are currently visible in this window.
777 ///
778 /// This property is maintained by GTK+ based on user input
779 /// and should not be set by applications.
780 pub fn focus_visible(self, focus_visible: bool) -> Self {
781 Self {
782 builder: self.builder.property("focus-visible", focus_visible),
783 }
784 }
785
786 /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
787 /// more details about window gravity.
788 pub fn gravity(self, gravity: gdk::Gravity) -> Self {
789 Self {
790 builder: self.builder.property("gravity", gravity),
791 }
792 }
793
794 /// Whether the titlebar should be hidden during maximization.
795 pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
796 Self {
797 builder: self
798 .builder
799 .property("hide-titlebar-when-maximized", hide_titlebar_when_maximized),
800 }
801 }
802
803 pub fn icon(self, icon: &gdk_pixbuf::Pixbuf) -> Self {
804 Self {
805 builder: self.builder.property("icon", icon.clone()),
806 }
807 }
808
809 /// The :icon-name property specifies the name of the themed icon to
810 /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
811 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
812 Self {
813 builder: self.builder.property("icon-name", icon_name.into()),
814 }
815 }
816
817 /// Whether mnemonics are currently visible in this window.
818 ///
819 /// This property is maintained by GTK+ based on user input,
820 /// and should not be set by applications.
821 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
822 Self {
823 builder: self
824 .builder
825 .property("mnemonics-visible", mnemonics_visible),
826 }
827 }
828
829 pub fn modal(self, modal: bool) -> Self {
830 Self {
831 builder: self.builder.property("modal", modal),
832 }
833 }
834
835 pub fn resizable(self, resizable: bool) -> Self {
836 Self {
837 builder: self.builder.property("resizable", resizable),
838 }
839 }
840
841 pub fn role(self, role: impl Into<glib::GString>) -> Self {
842 Self {
843 builder: self.builder.property("role", role.into()),
844 }
845 }
846
847 pub fn screen(self, screen: &gdk::Screen) -> Self {
848 Self {
849 builder: self.builder.property("screen", screen.clone()),
850 }
851 }
852
853 pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
854 Self {
855 builder: self.builder.property("skip-pager-hint", skip_pager_hint),
856 }
857 }
858
859 pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
860 Self {
861 builder: self
862 .builder
863 .property("skip-taskbar-hint", skip_taskbar_hint),
864 }
865 }
866
867 /// The :startup-id is a write-only property for setting window's
868 /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
869 /// for more details.
870 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
871 Self {
872 builder: self.builder.property("startup-id", startup_id.into()),
873 }
874 }
875
876 pub fn title(self, title: impl Into<glib::GString>) -> Self {
877 Self {
878 builder: self.builder.property("title", title.into()),
879 }
880 }
881
882 /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
883 /// more details about transient windows.
884 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
885 Self {
886 builder: self
887 .builder
888 .property("transient-for", transient_for.clone().upcast()),
889 }
890 }
891
892 pub fn type_(self, type_: WindowType) -> Self {
893 Self {
894 builder: self.builder.property("type", type_),
895 }
896 }
897
898 pub fn type_hint(self, type_hint: gdk::WindowTypeHint) -> Self {
899 Self {
900 builder: self.builder.property("type-hint", type_hint),
901 }
902 }
903
904 pub fn urgency_hint(self, urgency_hint: bool) -> Self {
905 Self {
906 builder: self.builder.property("urgency-hint", urgency_hint),
907 }
908 }
909
910 pub fn window_position(self, window_position: WindowPosition) -> Self {
911 Self {
912 builder: self.builder.property("window-position", window_position),
913 }
914 }
915
916 pub fn border_width(self, border_width: u32) -> Self {
917 Self {
918 builder: self.builder.property("border-width", border_width),
919 }
920 }
921
922 pub fn child(self, child: &impl IsA<Widget>) -> Self {
923 Self {
924 builder: self.builder.property("child", child.clone().upcast()),
925 }
926 }
927
928 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
929 Self {
930 builder: self.builder.property("resize-mode", resize_mode),
931 }
932 }
933
934 pub fn app_paintable(self, app_paintable: bool) -> Self {
935 Self {
936 builder: self.builder.property("app-paintable", app_paintable),
937 }
938 }
939
940 pub fn can_default(self, can_default: bool) -> Self {
941 Self {
942 builder: self.builder.property("can-default", can_default),
943 }
944 }
945
946 pub fn can_focus(self, can_focus: bool) -> Self {
947 Self {
948 builder: self.builder.property("can-focus", can_focus),
949 }
950 }
951
952 pub fn events(self, events: gdk::EventMask) -> Self {
953 Self {
954 builder: self.builder.property("events", events),
955 }
956 }
957
958 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
959 pub fn expand(self, expand: bool) -> Self {
960 Self {
961 builder: self.builder.property("expand", expand),
962 }
963 }
964
965 /// Whether the widget should grab focus when it is clicked with the mouse.
966 ///
967 /// This property is only relevant for widgets that can take focus.
968 ///
969 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
970 /// GtkComboBox) implemented this property individually.
971 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
972 Self {
973 builder: self.builder.property("focus-on-click", focus_on_click),
974 }
975 }
976
977 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
978 pub fn halign(self, halign: Align) -> Self {
979 Self {
980 builder: self.builder.property("halign", halign),
981 }
982 }
983
984 pub fn has_default(self, has_default: bool) -> Self {
985 Self {
986 builder: self.builder.property("has-default", has_default),
987 }
988 }
989
990 pub fn has_focus(self, has_focus: bool) -> Self {
991 Self {
992 builder: self.builder.property("has-focus", has_focus),
993 }
994 }
995
996 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
997 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
998 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
999 /// whether it will provide a tooltip or not.
1000 ///
1001 /// Note that setting this property to [`true`] for the first time will change
1002 /// the event masks of the GdkWindows of this widget to include leave-notify
1003 /// and motion-notify events. This cannot and will not be undone when the
1004 /// property is set to [`false`] again.
1005 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1006 Self {
1007 builder: self.builder.property("has-tooltip", has_tooltip),
1008 }
1009 }
1010
1011 pub fn height_request(self, height_request: i32) -> Self {
1012 Self {
1013 builder: self.builder.property("height-request", height_request),
1014 }
1015 }
1016
1017 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1018 pub fn hexpand(self, hexpand: bool) -> Self {
1019 Self {
1020 builder: self.builder.property("hexpand", hexpand),
1021 }
1022 }
1023
1024 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1025 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1026 Self {
1027 builder: self.builder.property("hexpand-set", hexpand_set),
1028 }
1029 }
1030
1031 pub fn is_focus(self, is_focus: bool) -> Self {
1032 Self {
1033 builder: self.builder.property("is-focus", is_focus),
1034 }
1035 }
1036
1037 /// Sets all four sides' margin at once. If read, returns max
1038 /// margin on any side.
1039 pub fn margin(self, margin: i32) -> Self {
1040 Self {
1041 builder: self.builder.property("margin", margin),
1042 }
1043 }
1044
1045 /// Margin on bottom side of widget.
1046 ///
1047 /// This property adds margin outside of the widget's normal size
1048 /// request, the margin will be added in addition to the size from
1049 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1050 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1051 Self {
1052 builder: self.builder.property("margin-bottom", margin_bottom),
1053 }
1054 }
1055
1056 /// Margin on end of widget, horizontally. This property supports
1057 /// left-to-right and right-to-left text directions.
1058 ///
1059 /// This property adds margin outside of the widget's normal size
1060 /// request, the margin will be added in addition to the size from
1061 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1062 pub fn margin_end(self, margin_end: i32) -> Self {
1063 Self {
1064 builder: self.builder.property("margin-end", margin_end),
1065 }
1066 }
1067
1068 /// Margin on start of widget, horizontally. This property supports
1069 /// left-to-right and right-to-left text directions.
1070 ///
1071 /// This property adds margin outside of the widget's normal size
1072 /// request, the margin will be added in addition to the size from
1073 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1074 pub fn margin_start(self, margin_start: i32) -> Self {
1075 Self {
1076 builder: self.builder.property("margin-start", margin_start),
1077 }
1078 }
1079
1080 /// Margin on top side of widget.
1081 ///
1082 /// This property adds margin outside of the widget's normal size
1083 /// request, the margin will be added in addition to the size from
1084 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1085 pub fn margin_top(self, margin_top: i32) -> Self {
1086 Self {
1087 builder: self.builder.property("margin-top", margin_top),
1088 }
1089 }
1090
1091 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1092 Self {
1093 builder: self.builder.property("name", name.into()),
1094 }
1095 }
1096
1097 pub fn no_show_all(self, no_show_all: bool) -> Self {
1098 Self {
1099 builder: self.builder.property("no-show-all", no_show_all),
1100 }
1101 }
1102
1103 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1104 /// more details about window opacity.
1105 ///
1106 /// Before 3.8 this was only available in GtkWindow
1107 pub fn opacity(self, opacity: f64) -> Self {
1108 Self {
1109 builder: self.builder.property("opacity", opacity),
1110 }
1111 }
1112
1113 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1114 Self {
1115 builder: self.builder.property("parent", parent.clone().upcast()),
1116 }
1117 }
1118
1119 pub fn receives_default(self, receives_default: bool) -> Self {
1120 Self {
1121 builder: self.builder.property("receives-default", receives_default),
1122 }
1123 }
1124
1125 pub fn sensitive(self, sensitive: bool) -> Self {
1126 Self {
1127 builder: self.builder.property("sensitive", sensitive),
1128 }
1129 }
1130
1131 /// Sets the text of tooltip to be the given string, which is marked up
1132 /// with the [Pango text markup language][PangoMarkupFormat].
1133 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1134 ///
1135 /// This is a convenience property which will take care of getting the
1136 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1137 /// will automatically be set to [`true`] and there will be taken care of
1138 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1139 ///
1140 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1141 /// are set, the last one wins.
1142 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1143 Self {
1144 builder: self
1145 .builder
1146 .property("tooltip-markup", tooltip_markup.into()),
1147 }
1148 }
1149
1150 /// Sets the text of tooltip to be the given string.
1151 ///
1152 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1153 ///
1154 /// This is a convenience property which will take care of getting the
1155 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1156 /// will automatically be set to [`true`] and there will be taken care of
1157 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1158 ///
1159 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1160 /// are set, the last one wins.
1161 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1162 Self {
1163 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1164 }
1165 }
1166
1167 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1168 pub fn valign(self, valign: Align) -> Self {
1169 Self {
1170 builder: self.builder.property("valign", valign),
1171 }
1172 }
1173
1174 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1175 pub fn vexpand(self, vexpand: bool) -> Self {
1176 Self {
1177 builder: self.builder.property("vexpand", vexpand),
1178 }
1179 }
1180
1181 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1182 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1183 Self {
1184 builder: self.builder.property("vexpand-set", vexpand_set),
1185 }
1186 }
1187
1188 pub fn visible(self, visible: bool) -> Self {
1189 Self {
1190 builder: self.builder.property("visible", visible),
1191 }
1192 }
1193
1194 pub fn width_request(self, width_request: i32) -> Self {
1195 Self {
1196 builder: self.builder.property("width-request", width_request),
1197 }
1198 }
1199
1200 // rustdoc-stripper-ignore-next
1201 /// Build the [`MessageDialog`].
1202 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1203 pub fn build(self) -> MessageDialog {
1204 assert_initialized_main_thread!();
1205 self.builder.build()
1206 }
1207}
1208
1209/// Trait containing all [`struct@MessageDialog`] methods.
1210///
1211/// # Implementors
1212///
1213/// [`MessageDialog`][struct@crate::MessageDialog]
1214pub trait MessageDialogExt: IsA<MessageDialog> + 'static {
1215 //#[doc(alias = "gtk_message_dialog_format_secondary_markup")]
1216 //fn format_secondary_markup(&self, message_format: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
1217 // unsafe { TODO: call ffi:gtk_message_dialog_format_secondary_markup() }
1218 //}
1219
1220 //#[doc(alias = "gtk_message_dialog_format_secondary_text")]
1221 //fn format_secondary_text(&self, message_format: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
1222 // unsafe { TODO: call ffi:gtk_message_dialog_format_secondary_text() }
1223 //}
1224
1225 /// Returns the message area of the dialog. This is the box where the
1226 /// dialog’s primary and secondary labels are packed. You can add your
1227 /// own extra content to that box and it will appear below those labels.
1228 /// See [`DialogExt::content_area()`][crate::prelude::DialogExt::content_area()] for the corresponding
1229 /// function in the parent [`Dialog`][crate::Dialog].
1230 ///
1231 /// # Returns
1232 ///
1233 /// A [`Box`][crate::Box] corresponding to the
1234 /// “message area” in the `self`.
1235 #[doc(alias = "gtk_message_dialog_get_message_area")]
1236 #[doc(alias = "get_message_area")]
1237 #[doc(alias = "message-area")]
1238 fn message_area(&self) -> Widget {
1239 unsafe {
1240 from_glib_none(ffi::gtk_message_dialog_get_message_area(
1241 self.as_ref().to_glib_none().0,
1242 ))
1243 }
1244 }
1245
1246 /// Sets the text of the message dialog to be `str`, which is marked
1247 /// up with the [Pango text markup language][PangoMarkupFormat].
1248 /// ## `str`
1249 /// markup string (see [Pango markup format][PangoMarkupFormat])
1250 #[doc(alias = "gtk_message_dialog_set_markup")]
1251 fn set_markup(&self, str: &str) {
1252 unsafe {
1253 ffi::gtk_message_dialog_set_markup(
1254 self.as_ref().to_glib_none().0,
1255 str.to_glib_none().0,
1256 );
1257 }
1258 }
1259
1260 /// The type of the message.
1261 #[doc(alias = "message-type")]
1262 fn message_type(&self) -> MessageType {
1263 ObjectExt::property(self.as_ref(), "message-type")
1264 }
1265
1266 /// The type of the message.
1267 #[doc(alias = "message-type")]
1268 fn set_message_type(&self, message_type: MessageType) {
1269 ObjectExt::set_property(self.as_ref(), "message-type", message_type)
1270 }
1271
1272 /// The secondary text of the message dialog.
1273 #[doc(alias = "secondary-text")]
1274 fn secondary_text(&self) -> Option<glib::GString> {
1275 ObjectExt::property(self.as_ref(), "secondary-text")
1276 }
1277
1278 /// The secondary text of the message dialog.
1279 #[doc(alias = "secondary-text")]
1280 fn set_secondary_text(&self, secondary_text: Option<&str>) {
1281 ObjectExt::set_property(self.as_ref(), "secondary-text", secondary_text)
1282 }
1283
1284 /// [`true`] if the secondary text of the dialog includes Pango markup.
1285 /// See `pango_parse_markup()`.
1286 #[doc(alias = "secondary-use-markup")]
1287 fn is_secondary_use_markup(&self) -> bool {
1288 ObjectExt::property(self.as_ref(), "secondary-use-markup")
1289 }
1290
1291 /// [`true`] if the secondary text of the dialog includes Pango markup.
1292 /// See `pango_parse_markup()`.
1293 #[doc(alias = "secondary-use-markup")]
1294 fn set_secondary_use_markup(&self, secondary_use_markup: bool) {
1295 ObjectExt::set_property(self.as_ref(), "secondary-use-markup", secondary_use_markup)
1296 }
1297
1298 /// The primary text of the message dialog. If the dialog has
1299 /// a secondary text, this will appear as the title.
1300 fn text(&self) -> Option<glib::GString> {
1301 ObjectExt::property(self.as_ref(), "text")
1302 }
1303
1304 /// The primary text of the message dialog. If the dialog has
1305 /// a secondary text, this will appear as the title.
1306 fn set_text(&self, text: Option<&str>) {
1307 ObjectExt::set_property(self.as_ref(), "text", text)
1308 }
1309
1310 /// [`true`] if the primary text of the dialog includes Pango markup.
1311 /// See `pango_parse_markup()`.
1312 #[doc(alias = "use-markup")]
1313 fn uses_markup(&self) -> bool {
1314 ObjectExt::property(self.as_ref(), "use-markup")
1315 }
1316
1317 /// [`true`] if the primary text of the dialog includes Pango markup.
1318 /// See `pango_parse_markup()`.
1319 #[doc(alias = "use-markup")]
1320 fn set_use_markup(&self, use_markup: bool) {
1321 ObjectExt::set_property(self.as_ref(), "use-markup", use_markup)
1322 }
1323
1324 #[doc(alias = "message-area")]
1325 fn connect_message_area_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1326 unsafe extern "C" fn notify_message_area_trampoline<
1327 P: IsA<MessageDialog>,
1328 F: Fn(&P) + 'static,
1329 >(
1330 this: *mut ffi::GtkMessageDialog,
1331 _param_spec: glib::ffi::gpointer,
1332 f: glib::ffi::gpointer,
1333 ) {
1334 unsafe {
1335 let f: &F = &*(f as *const F);
1336 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1337 }
1338 }
1339 unsafe {
1340 let f: Box_<F> = Box_::new(f);
1341 connect_raw(
1342 self.as_ptr() as *mut _,
1343 c"notify::message-area".as_ptr(),
1344 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1345 notify_message_area_trampoline::<Self, F> as *const (),
1346 )),
1347 Box_::into_raw(f),
1348 )
1349 }
1350 }
1351
1352 #[doc(alias = "message-type")]
1353 fn connect_message_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1354 unsafe extern "C" fn notify_message_type_trampoline<
1355 P: IsA<MessageDialog>,
1356 F: Fn(&P) + 'static,
1357 >(
1358 this: *mut ffi::GtkMessageDialog,
1359 _param_spec: glib::ffi::gpointer,
1360 f: glib::ffi::gpointer,
1361 ) {
1362 unsafe {
1363 let f: &F = &*(f as *const F);
1364 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1365 }
1366 }
1367 unsafe {
1368 let f: Box_<F> = Box_::new(f);
1369 connect_raw(
1370 self.as_ptr() as *mut _,
1371 c"notify::message-type".as_ptr(),
1372 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1373 notify_message_type_trampoline::<Self, F> as *const (),
1374 )),
1375 Box_::into_raw(f),
1376 )
1377 }
1378 }
1379
1380 #[doc(alias = "secondary-text")]
1381 fn connect_secondary_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1382 unsafe extern "C" fn notify_secondary_text_trampoline<
1383 P: IsA<MessageDialog>,
1384 F: Fn(&P) + 'static,
1385 >(
1386 this: *mut ffi::GtkMessageDialog,
1387 _param_spec: glib::ffi::gpointer,
1388 f: glib::ffi::gpointer,
1389 ) {
1390 unsafe {
1391 let f: &F = &*(f as *const F);
1392 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1393 }
1394 }
1395 unsafe {
1396 let f: Box_<F> = Box_::new(f);
1397 connect_raw(
1398 self.as_ptr() as *mut _,
1399 c"notify::secondary-text".as_ptr(),
1400 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1401 notify_secondary_text_trampoline::<Self, F> as *const (),
1402 )),
1403 Box_::into_raw(f),
1404 )
1405 }
1406 }
1407
1408 #[doc(alias = "secondary-use-markup")]
1409 fn connect_secondary_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1410 unsafe extern "C" fn notify_secondary_use_markup_trampoline<
1411 P: IsA<MessageDialog>,
1412 F: Fn(&P) + 'static,
1413 >(
1414 this: *mut ffi::GtkMessageDialog,
1415 _param_spec: glib::ffi::gpointer,
1416 f: glib::ffi::gpointer,
1417 ) {
1418 unsafe {
1419 let f: &F = &*(f as *const F);
1420 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1421 }
1422 }
1423 unsafe {
1424 let f: Box_<F> = Box_::new(f);
1425 connect_raw(
1426 self.as_ptr() as *mut _,
1427 c"notify::secondary-use-markup".as_ptr(),
1428 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1429 notify_secondary_use_markup_trampoline::<Self, F> as *const (),
1430 )),
1431 Box_::into_raw(f),
1432 )
1433 }
1434 }
1435
1436 #[doc(alias = "text")]
1437 fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1438 unsafe extern "C" fn notify_text_trampoline<P: IsA<MessageDialog>, F: Fn(&P) + 'static>(
1439 this: *mut ffi::GtkMessageDialog,
1440 _param_spec: glib::ffi::gpointer,
1441 f: glib::ffi::gpointer,
1442 ) {
1443 unsafe {
1444 let f: &F = &*(f as *const F);
1445 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1446 }
1447 }
1448 unsafe {
1449 let f: Box_<F> = Box_::new(f);
1450 connect_raw(
1451 self.as_ptr() as *mut _,
1452 c"notify::text".as_ptr(),
1453 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1454 notify_text_trampoline::<Self, F> as *const (),
1455 )),
1456 Box_::into_raw(f),
1457 )
1458 }
1459 }
1460
1461 #[doc(alias = "use-markup")]
1462 fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1463 unsafe extern "C" fn notify_use_markup_trampoline<
1464 P: IsA<MessageDialog>,
1465 F: Fn(&P) + 'static,
1466 >(
1467 this: *mut ffi::GtkMessageDialog,
1468 _param_spec: glib::ffi::gpointer,
1469 f: glib::ffi::gpointer,
1470 ) {
1471 unsafe {
1472 let f: &F = &*(f as *const F);
1473 f(MessageDialog::from_glib_borrow(this).unsafe_cast_ref())
1474 }
1475 }
1476 unsafe {
1477 let f: Box_<F> = Box_::new(f);
1478 connect_raw(
1479 self.as_ptr() as *mut _,
1480 c"notify::use-markup".as_ptr(),
1481 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1482 notify_use_markup_trampoline::<Self, F> as *const (),
1483 )),
1484 Box_::into_raw(f),
1485 )
1486 }
1487 }
1488}
1489
1490impl<O: IsA<MessageDialog>> MessageDialogExt for O {}