1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use crate::Align; 6 use crate::Application; 7 use crate::Bin; 8 use crate::Buildable; 9 use crate::Container; 10 use crate::ResizeMode; 11 use crate::Widget; 12 use crate::Window; 13 use crate::WindowPosition; 14 use crate::WindowType; 15 use glib::object::Cast; 16 use glib::object::IsA; 17 use glib::object::ObjectExt; 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 = "GtkShortcutsWindow")] 29 pub struct ShortcutsWindow(Object<ffi::GtkShortcutsWindow, ffi::GtkShortcutsWindowClass>) @extends Window, Bin, Container, Widget, @implements Buildable; 30 31 match fn { 32 type_ => || ffi::gtk_shortcuts_window_get_type(), 33 } 34 } 35 36 impl ShortcutsWindow { 37 // rustdoc-stripper-ignore-next 38 /// Creates a new builder-pattern struct instance to construct [`ShortcutsWindow`] objects. 39 /// 40 /// This method returns an instance of [`ShortcutsWindowBuilder`] which can be used to create [`ShortcutsWindow`] objects. builder() -> ShortcutsWindowBuilder41 pub fn builder() -> ShortcutsWindowBuilder { 42 ShortcutsWindowBuilder::default() 43 } 44 } 45 46 #[derive(Clone, Default)] 47 // rustdoc-stripper-ignore-next 48 /// A [builder-pattern] type to construct [`ShortcutsWindow`] objects. 49 /// 50 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 51 pub struct ShortcutsWindowBuilder { 52 section_name: Option<String>, 53 view_name: Option<String>, 54 accept_focus: Option<bool>, 55 application: Option<Application>, 56 attached_to: Option<Widget>, 57 decorated: Option<bool>, 58 default_height: Option<i32>, 59 default_width: Option<i32>, 60 deletable: Option<bool>, 61 destroy_with_parent: Option<bool>, 62 focus_on_map: Option<bool>, 63 focus_visible: Option<bool>, 64 gravity: Option<gdk::Gravity>, 65 hide_titlebar_when_maximized: Option<bool>, 66 icon: Option<gdk_pixbuf::Pixbuf>, 67 icon_name: Option<String>, 68 mnemonics_visible: Option<bool>, 69 modal: Option<bool>, 70 resizable: Option<bool>, 71 role: Option<String>, 72 screen: Option<gdk::Screen>, 73 skip_pager_hint: Option<bool>, 74 skip_taskbar_hint: Option<bool>, 75 startup_id: Option<String>, 76 title: Option<String>, 77 transient_for: Option<Window>, 78 type_: Option<WindowType>, 79 type_hint: Option<gdk::WindowTypeHint>, 80 urgency_hint: Option<bool>, 81 window_position: Option<WindowPosition>, 82 border_width: Option<u32>, 83 child: Option<Widget>, 84 resize_mode: Option<ResizeMode>, 85 app_paintable: Option<bool>, 86 can_default: Option<bool>, 87 can_focus: Option<bool>, 88 events: Option<gdk::EventMask>, 89 expand: Option<bool>, 90 #[cfg(any(feature = "v3_20", feature = "dox"))] 91 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 92 focus_on_click: Option<bool>, 93 halign: Option<Align>, 94 has_default: Option<bool>, 95 has_focus: Option<bool>, 96 has_tooltip: Option<bool>, 97 height_request: Option<i32>, 98 hexpand: Option<bool>, 99 hexpand_set: Option<bool>, 100 is_focus: Option<bool>, 101 margin: Option<i32>, 102 margin_bottom: Option<i32>, 103 margin_end: Option<i32>, 104 margin_start: Option<i32>, 105 margin_top: Option<i32>, 106 name: Option<String>, 107 no_show_all: Option<bool>, 108 opacity: Option<f64>, 109 parent: Option<Container>, 110 receives_default: Option<bool>, 111 sensitive: Option<bool>, 112 tooltip_markup: Option<String>, 113 tooltip_text: Option<String>, 114 valign: Option<Align>, 115 vexpand: Option<bool>, 116 vexpand_set: Option<bool>, 117 visible: Option<bool>, 118 width_request: Option<i32>, 119 } 120 121 impl ShortcutsWindowBuilder { 122 // rustdoc-stripper-ignore-next 123 /// Create a new [`ShortcutsWindowBuilder`]. new() -> Self124 pub fn new() -> Self { 125 Self::default() 126 } 127 128 // rustdoc-stripper-ignore-next 129 /// Build the [`ShortcutsWindow`]. build(self) -> ShortcutsWindow130 pub fn build(self) -> ShortcutsWindow { 131 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 132 if let Some(ref section_name) = self.section_name { 133 properties.push(("section-name", section_name)); 134 } 135 if let Some(ref view_name) = self.view_name { 136 properties.push(("view-name", view_name)); 137 } 138 if let Some(ref accept_focus) = self.accept_focus { 139 properties.push(("accept-focus", accept_focus)); 140 } 141 if let Some(ref application) = self.application { 142 properties.push(("application", application)); 143 } 144 if let Some(ref attached_to) = self.attached_to { 145 properties.push(("attached-to", attached_to)); 146 } 147 if let Some(ref decorated) = self.decorated { 148 properties.push(("decorated", decorated)); 149 } 150 if let Some(ref default_height) = self.default_height { 151 properties.push(("default-height", default_height)); 152 } 153 if let Some(ref default_width) = self.default_width { 154 properties.push(("default-width", default_width)); 155 } 156 if let Some(ref deletable) = self.deletable { 157 properties.push(("deletable", deletable)); 158 } 159 if let Some(ref destroy_with_parent) = self.destroy_with_parent { 160 properties.push(("destroy-with-parent", destroy_with_parent)); 161 } 162 if let Some(ref focus_on_map) = self.focus_on_map { 163 properties.push(("focus-on-map", focus_on_map)); 164 } 165 if let Some(ref focus_visible) = self.focus_visible { 166 properties.push(("focus-visible", focus_visible)); 167 } 168 if let Some(ref gravity) = self.gravity { 169 properties.push(("gravity", gravity)); 170 } 171 if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized { 172 properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized)); 173 } 174 if let Some(ref icon) = self.icon { 175 properties.push(("icon", icon)); 176 } 177 if let Some(ref icon_name) = self.icon_name { 178 properties.push(("icon-name", icon_name)); 179 } 180 if let Some(ref mnemonics_visible) = self.mnemonics_visible { 181 properties.push(("mnemonics-visible", mnemonics_visible)); 182 } 183 if let Some(ref modal) = self.modal { 184 properties.push(("modal", modal)); 185 } 186 if let Some(ref resizable) = self.resizable { 187 properties.push(("resizable", resizable)); 188 } 189 if let Some(ref role) = self.role { 190 properties.push(("role", role)); 191 } 192 if let Some(ref screen) = self.screen { 193 properties.push(("screen", screen)); 194 } 195 if let Some(ref skip_pager_hint) = self.skip_pager_hint { 196 properties.push(("skip-pager-hint", skip_pager_hint)); 197 } 198 if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint { 199 properties.push(("skip-taskbar-hint", skip_taskbar_hint)); 200 } 201 if let Some(ref startup_id) = self.startup_id { 202 properties.push(("startup-id", startup_id)); 203 } 204 if let Some(ref title) = self.title { 205 properties.push(("title", title)); 206 } 207 if let Some(ref transient_for) = self.transient_for { 208 properties.push(("transient-for", transient_for)); 209 } 210 if let Some(ref type_) = self.type_ { 211 properties.push(("type", type_)); 212 } 213 if let Some(ref type_hint) = self.type_hint { 214 properties.push(("type-hint", type_hint)); 215 } 216 if let Some(ref urgency_hint) = self.urgency_hint { 217 properties.push(("urgency-hint", urgency_hint)); 218 } 219 if let Some(ref window_position) = self.window_position { 220 properties.push(("window-position", window_position)); 221 } 222 if let Some(ref border_width) = self.border_width { 223 properties.push(("border-width", border_width)); 224 } 225 if let Some(ref child) = self.child { 226 properties.push(("child", child)); 227 } 228 if let Some(ref resize_mode) = self.resize_mode { 229 properties.push(("resize-mode", resize_mode)); 230 } 231 if let Some(ref app_paintable) = self.app_paintable { 232 properties.push(("app-paintable", app_paintable)); 233 } 234 if let Some(ref can_default) = self.can_default { 235 properties.push(("can-default", can_default)); 236 } 237 if let Some(ref can_focus) = self.can_focus { 238 properties.push(("can-focus", can_focus)); 239 } 240 if let Some(ref events) = self.events { 241 properties.push(("events", events)); 242 } 243 if let Some(ref expand) = self.expand { 244 properties.push(("expand", expand)); 245 } 246 #[cfg(any(feature = "v3_20", feature = "dox"))] 247 if let Some(ref focus_on_click) = self.focus_on_click { 248 properties.push(("focus-on-click", focus_on_click)); 249 } 250 if let Some(ref halign) = self.halign { 251 properties.push(("halign", halign)); 252 } 253 if let Some(ref has_default) = self.has_default { 254 properties.push(("has-default", has_default)); 255 } 256 if let Some(ref has_focus) = self.has_focus { 257 properties.push(("has-focus", has_focus)); 258 } 259 if let Some(ref has_tooltip) = self.has_tooltip { 260 properties.push(("has-tooltip", has_tooltip)); 261 } 262 if let Some(ref height_request) = self.height_request { 263 properties.push(("height-request", height_request)); 264 } 265 if let Some(ref hexpand) = self.hexpand { 266 properties.push(("hexpand", hexpand)); 267 } 268 if let Some(ref hexpand_set) = self.hexpand_set { 269 properties.push(("hexpand-set", hexpand_set)); 270 } 271 if let Some(ref is_focus) = self.is_focus { 272 properties.push(("is-focus", is_focus)); 273 } 274 if let Some(ref margin) = self.margin { 275 properties.push(("margin", margin)); 276 } 277 if let Some(ref margin_bottom) = self.margin_bottom { 278 properties.push(("margin-bottom", margin_bottom)); 279 } 280 if let Some(ref margin_end) = self.margin_end { 281 properties.push(("margin-end", margin_end)); 282 } 283 if let Some(ref margin_start) = self.margin_start { 284 properties.push(("margin-start", margin_start)); 285 } 286 if let Some(ref margin_top) = self.margin_top { 287 properties.push(("margin-top", margin_top)); 288 } 289 if let Some(ref name) = self.name { 290 properties.push(("name", name)); 291 } 292 if let Some(ref no_show_all) = self.no_show_all { 293 properties.push(("no-show-all", no_show_all)); 294 } 295 if let Some(ref opacity) = self.opacity { 296 properties.push(("opacity", opacity)); 297 } 298 if let Some(ref parent) = self.parent { 299 properties.push(("parent", parent)); 300 } 301 if let Some(ref receives_default) = self.receives_default { 302 properties.push(("receives-default", receives_default)); 303 } 304 if let Some(ref sensitive) = self.sensitive { 305 properties.push(("sensitive", sensitive)); 306 } 307 if let Some(ref tooltip_markup) = self.tooltip_markup { 308 properties.push(("tooltip-markup", tooltip_markup)); 309 } 310 if let Some(ref tooltip_text) = self.tooltip_text { 311 properties.push(("tooltip-text", tooltip_text)); 312 } 313 if let Some(ref valign) = self.valign { 314 properties.push(("valign", valign)); 315 } 316 if let Some(ref vexpand) = self.vexpand { 317 properties.push(("vexpand", vexpand)); 318 } 319 if let Some(ref vexpand_set) = self.vexpand_set { 320 properties.push(("vexpand-set", vexpand_set)); 321 } 322 if let Some(ref visible) = self.visible { 323 properties.push(("visible", visible)); 324 } 325 if let Some(ref width_request) = self.width_request { 326 properties.push(("width-request", width_request)); 327 } 328 glib::Object::new::<ShortcutsWindow>(&properties) 329 .expect("Failed to create an instance of ShortcutsWindow") 330 } 331 section_name(mut self, section_name: &str) -> Self332 pub fn section_name(mut self, section_name: &str) -> Self { 333 self.section_name = Some(section_name.to_string()); 334 self 335 } 336 view_name(mut self, view_name: &str) -> Self337 pub fn view_name(mut self, view_name: &str) -> Self { 338 self.view_name = Some(view_name.to_string()); 339 self 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_SHORTCUTS_WINDOW: Option<&ShortcutsWindow> = None; 661 662 pub trait ShortcutsWindowExt: 'static { 663 #[doc(alias = "section-name")] section_name(&self) -> Option<glib::GString>664 fn section_name(&self) -> Option<glib::GString>; 665 666 #[doc(alias = "section-name")] set_section_name(&self, section_name: Option<&str>)667 fn set_section_name(&self, section_name: Option<&str>); 668 669 #[doc(alias = "view-name")] view_name(&self) -> Option<glib::GString>670 fn view_name(&self) -> Option<glib::GString>; 671 672 #[doc(alias = "view-name")] set_view_name(&self, view_name: Option<&str>)673 fn set_view_name(&self, view_name: Option<&str>); 674 675 #[doc(alias = "close")] connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId676 fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 677 emit_close(&self)678 fn emit_close(&self); 679 680 #[doc(alias = "search")] connect_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId681 fn connect_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 682 emit_search(&self)683 fn emit_search(&self); 684 685 #[doc(alias = "section-name")] connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId686 fn connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 687 688 #[doc(alias = "view-name")] connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId689 fn connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 690 } 691 692 impl<O: IsA<ShortcutsWindow>> ShortcutsWindowExt for O { section_name(&self) -> Option<glib::GString>693 fn section_name(&self) -> Option<glib::GString> { 694 unsafe { 695 let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type()); 696 glib::gobject_ffi::g_object_get_property( 697 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 698 b"section-name\0".as_ptr() as *const _, 699 value.to_glib_none_mut().0, 700 ); 701 value 702 .get() 703 .expect("Return Value for property `section-name` getter") 704 } 705 } 706 set_section_name(&self, section_name: Option<&str>)707 fn set_section_name(&self, section_name: Option<&str>) { 708 unsafe { 709 glib::gobject_ffi::g_object_set_property( 710 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 711 b"section-name\0".as_ptr() as *const _, 712 section_name.to_value().to_glib_none().0, 713 ); 714 } 715 } 716 view_name(&self) -> Option<glib::GString>717 fn view_name(&self) -> Option<glib::GString> { 718 unsafe { 719 let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type()); 720 glib::gobject_ffi::g_object_get_property( 721 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 722 b"view-name\0".as_ptr() as *const _, 723 value.to_glib_none_mut().0, 724 ); 725 value 726 .get() 727 .expect("Return Value for property `view-name` getter") 728 } 729 } 730 set_view_name(&self, view_name: Option<&str>)731 fn set_view_name(&self, view_name: Option<&str>) { 732 unsafe { 733 glib::gobject_ffi::g_object_set_property( 734 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 735 b"view-name\0".as_ptr() as *const _, 736 view_name.to_value().to_glib_none().0, 737 ); 738 } 739 } 740 connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId741 fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 742 unsafe extern "C" fn close_trampoline<P: IsA<ShortcutsWindow>, F: Fn(&P) + 'static>( 743 this: *mut ffi::GtkShortcutsWindow, 744 f: glib::ffi::gpointer, 745 ) { 746 let f: &F = &*(f as *const F); 747 f(ShortcutsWindow::from_glib_borrow(this).unsafe_cast_ref()) 748 } 749 unsafe { 750 let f: Box_<F> = Box_::new(f); 751 connect_raw( 752 self.as_ptr() as *mut _, 753 b"close\0".as_ptr() as *const _, 754 Some(transmute::<_, unsafe extern "C" fn()>( 755 close_trampoline::<Self, F> as *const (), 756 )), 757 Box_::into_raw(f), 758 ) 759 } 760 } 761 emit_close(&self)762 fn emit_close(&self) { 763 let _ = unsafe { 764 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 765 .emit_by_name("close", &[]) 766 .unwrap() 767 }; 768 } 769 connect_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId770 fn connect_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 771 unsafe extern "C" fn search_trampoline<P: IsA<ShortcutsWindow>, F: Fn(&P) + 'static>( 772 this: *mut ffi::GtkShortcutsWindow, 773 f: glib::ffi::gpointer, 774 ) { 775 let f: &F = &*(f as *const F); 776 f(ShortcutsWindow::from_glib_borrow(this).unsafe_cast_ref()) 777 } 778 unsafe { 779 let f: Box_<F> = Box_::new(f); 780 connect_raw( 781 self.as_ptr() as *mut _, 782 b"search\0".as_ptr() as *const _, 783 Some(transmute::<_, unsafe extern "C" fn()>( 784 search_trampoline::<Self, F> as *const (), 785 )), 786 Box_::into_raw(f), 787 ) 788 } 789 } 790 emit_search(&self)791 fn emit_search(&self) { 792 let _ = unsafe { 793 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 794 .emit_by_name("search", &[]) 795 .unwrap() 796 }; 797 } 798 connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId799 fn connect_section_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 800 unsafe extern "C" fn notify_section_name_trampoline< 801 P: IsA<ShortcutsWindow>, 802 F: Fn(&P) + 'static, 803 >( 804 this: *mut ffi::GtkShortcutsWindow, 805 _param_spec: glib::ffi::gpointer, 806 f: glib::ffi::gpointer, 807 ) { 808 let f: &F = &*(f as *const F); 809 f(ShortcutsWindow::from_glib_borrow(this).unsafe_cast_ref()) 810 } 811 unsafe { 812 let f: Box_<F> = Box_::new(f); 813 connect_raw( 814 self.as_ptr() as *mut _, 815 b"notify::section-name\0".as_ptr() as *const _, 816 Some(transmute::<_, unsafe extern "C" fn()>( 817 notify_section_name_trampoline::<Self, F> as *const (), 818 )), 819 Box_::into_raw(f), 820 ) 821 } 822 } 823 connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId824 fn connect_view_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 825 unsafe extern "C" fn notify_view_name_trampoline< 826 P: IsA<ShortcutsWindow>, 827 F: Fn(&P) + 'static, 828 >( 829 this: *mut ffi::GtkShortcutsWindow, 830 _param_spec: glib::ffi::gpointer, 831 f: glib::ffi::gpointer, 832 ) { 833 let f: &F = &*(f as *const F); 834 f(ShortcutsWindow::from_glib_borrow(this).unsafe_cast_ref()) 835 } 836 unsafe { 837 let f: Box_<F> = Box_::new(f); 838 connect_raw( 839 self.as_ptr() as *mut _, 840 b"notify::view-name\0".as_ptr() as *const _, 841 Some(transmute::<_, unsafe extern "C" fn()>( 842 notify_view_name_trampoline::<Self, F> as *const (), 843 )), 844 Box_::into_raw(f), 845 ) 846 } 847 } 848 } 849 850 impl fmt::Display for ShortcutsWindow { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result851 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 852 f.write_str("ShortcutsWindow") 853 } 854 } 855