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