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 gdk; 6 use gio; 7 use glib::object::Cast; 8 use glib::object::IsA; 9 use glib::signal::connect_raw; 10 use glib::signal::SignalHandlerId; 11 use glib::translate::*; 12 use glib::GString; 13 use glib::StaticType; 14 use glib::ToValue; 15 use glib_sys; 16 use gtk_sys; 17 use libc; 18 use std::boxed::Box as Box_; 19 use std::fmt; 20 use std::mem::transmute; 21 use Align; 22 use AppChooser; 23 use Bin; 24 use Buildable; 25 use CellArea; 26 use CellEditable; 27 use CellLayout; 28 use ComboBox; 29 use Container; 30 use ResizeMode; 31 use SensitivityType; 32 use TreeModel; 33 use Widget; 34 35 glib_wrapper! { 36 pub struct AppChooserButton(Object<gtk_sys::GtkAppChooserButton, gtk_sys::GtkAppChooserButtonClass, AppChooserButtonClass>) @extends ComboBox, Bin, Container, Widget, @implements Buildable, CellEditable, CellLayout, AppChooser; 37 38 match fn { 39 get_type => || gtk_sys::gtk_app_chooser_button_get_type(), 40 } 41 } 42 43 impl AppChooserButton { new(content_type: &str) -> AppChooserButton44 pub fn new(content_type: &str) -> AppChooserButton { 45 assert_initialized_main_thread!(); 46 unsafe { 47 Widget::from_glib_none(gtk_sys::gtk_app_chooser_button_new( 48 content_type.to_glib_none().0, 49 )) 50 .unsafe_cast() 51 } 52 } 53 } 54 55 #[derive(Clone, Default)] 56 pub struct AppChooserButtonBuilder { 57 heading: Option<String>, 58 show_default_item: Option<bool>, 59 show_dialog_item: Option<bool>, 60 active: Option<i32>, 61 active_id: Option<String>, 62 button_sensitivity: Option<SensitivityType>, 63 cell_area: Option<CellArea>, 64 column_span_column: Option<i32>, 65 entry_text_column: Option<i32>, 66 has_entry: Option<bool>, 67 has_frame: Option<bool>, 68 id_column: Option<i32>, 69 model: Option<TreeModel>, 70 popup_fixed_width: Option<bool>, 71 row_span_column: Option<i32>, 72 wrap_width: Option<i32>, 73 border_width: Option<u32>, 74 child: Option<Widget>, 75 resize_mode: Option<ResizeMode>, 76 app_paintable: Option<bool>, 77 can_default: Option<bool>, 78 can_focus: Option<bool>, 79 events: Option<gdk::EventMask>, 80 expand: Option<bool>, 81 #[cfg(any(feature = "v3_20", feature = "dox"))] 82 focus_on_click: Option<bool>, 83 halign: Option<Align>, 84 has_default: Option<bool>, 85 has_focus: Option<bool>, 86 has_tooltip: Option<bool>, 87 height_request: Option<i32>, 88 hexpand: Option<bool>, 89 hexpand_set: Option<bool>, 90 is_focus: Option<bool>, 91 margin: Option<i32>, 92 margin_bottom: Option<i32>, 93 margin_end: Option<i32>, 94 margin_start: Option<i32>, 95 margin_top: Option<i32>, 96 name: Option<String>, 97 no_show_all: Option<bool>, 98 opacity: Option<f64>, 99 parent: Option<Container>, 100 receives_default: Option<bool>, 101 sensitive: Option<bool>, 102 tooltip_markup: Option<String>, 103 tooltip_text: Option<String>, 104 valign: Option<Align>, 105 vexpand: Option<bool>, 106 vexpand_set: Option<bool>, 107 visible: Option<bool>, 108 width_request: Option<i32>, 109 editing_canceled: Option<bool>, 110 content_type: Option<String>, 111 } 112 113 impl AppChooserButtonBuilder { new() -> Self114 pub fn new() -> Self { 115 Self::default() 116 } 117 build(self) -> AppChooserButton118 pub fn build(self) -> AppChooserButton { 119 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 120 if let Some(ref heading) = self.heading { 121 properties.push(("heading", heading)); 122 } 123 if let Some(ref show_default_item) = self.show_default_item { 124 properties.push(("show-default-item", show_default_item)); 125 } 126 if let Some(ref show_dialog_item) = self.show_dialog_item { 127 properties.push(("show-dialog-item", show_dialog_item)); 128 } 129 if let Some(ref active) = self.active { 130 properties.push(("active", active)); 131 } 132 if let Some(ref active_id) = self.active_id { 133 properties.push(("active-id", active_id)); 134 } 135 if let Some(ref button_sensitivity) = self.button_sensitivity { 136 properties.push(("button-sensitivity", button_sensitivity)); 137 } 138 if let Some(ref cell_area) = self.cell_area { 139 properties.push(("cell-area", cell_area)); 140 } 141 if let Some(ref column_span_column) = self.column_span_column { 142 properties.push(("column-span-column", column_span_column)); 143 } 144 if let Some(ref entry_text_column) = self.entry_text_column { 145 properties.push(("entry-text-column", entry_text_column)); 146 } 147 if let Some(ref has_entry) = self.has_entry { 148 properties.push(("has-entry", has_entry)); 149 } 150 if let Some(ref has_frame) = self.has_frame { 151 properties.push(("has-frame", has_frame)); 152 } 153 if let Some(ref id_column) = self.id_column { 154 properties.push(("id-column", id_column)); 155 } 156 if let Some(ref model) = self.model { 157 properties.push(("model", model)); 158 } 159 if let Some(ref popup_fixed_width) = self.popup_fixed_width { 160 properties.push(("popup-fixed-width", popup_fixed_width)); 161 } 162 if let Some(ref row_span_column) = self.row_span_column { 163 properties.push(("row-span-column", row_span_column)); 164 } 165 if let Some(ref wrap_width) = self.wrap_width { 166 properties.push(("wrap-width", wrap_width)); 167 } 168 if let Some(ref border_width) = self.border_width { 169 properties.push(("border-width", border_width)); 170 } 171 if let Some(ref child) = self.child { 172 properties.push(("child", child)); 173 } 174 if let Some(ref resize_mode) = self.resize_mode { 175 properties.push(("resize-mode", resize_mode)); 176 } 177 if let Some(ref app_paintable) = self.app_paintable { 178 properties.push(("app-paintable", app_paintable)); 179 } 180 if let Some(ref can_default) = self.can_default { 181 properties.push(("can-default", can_default)); 182 } 183 if let Some(ref can_focus) = self.can_focus { 184 properties.push(("can-focus", can_focus)); 185 } 186 if let Some(ref events) = self.events { 187 properties.push(("events", events)); 188 } 189 if let Some(ref expand) = self.expand { 190 properties.push(("expand", expand)); 191 } 192 #[cfg(any(feature = "v3_20", feature = "dox"))] 193 { 194 if let Some(ref focus_on_click) = self.focus_on_click { 195 properties.push(("focus-on-click", focus_on_click)); 196 } 197 } 198 if let Some(ref halign) = self.halign { 199 properties.push(("halign", halign)); 200 } 201 if let Some(ref has_default) = self.has_default { 202 properties.push(("has-default", has_default)); 203 } 204 if let Some(ref has_focus) = self.has_focus { 205 properties.push(("has-focus", has_focus)); 206 } 207 if let Some(ref has_tooltip) = self.has_tooltip { 208 properties.push(("has-tooltip", has_tooltip)); 209 } 210 if let Some(ref height_request) = self.height_request { 211 properties.push(("height-request", height_request)); 212 } 213 if let Some(ref hexpand) = self.hexpand { 214 properties.push(("hexpand", hexpand)); 215 } 216 if let Some(ref hexpand_set) = self.hexpand_set { 217 properties.push(("hexpand-set", hexpand_set)); 218 } 219 if let Some(ref is_focus) = self.is_focus { 220 properties.push(("is-focus", is_focus)); 221 } 222 if let Some(ref margin) = self.margin { 223 properties.push(("margin", margin)); 224 } 225 if let Some(ref margin_bottom) = self.margin_bottom { 226 properties.push(("margin-bottom", margin_bottom)); 227 } 228 if let Some(ref margin_end) = self.margin_end { 229 properties.push(("margin-end", margin_end)); 230 } 231 if let Some(ref margin_start) = self.margin_start { 232 properties.push(("margin-start", margin_start)); 233 } 234 if let Some(ref margin_top) = self.margin_top { 235 properties.push(("margin-top", margin_top)); 236 } 237 if let Some(ref name) = self.name { 238 properties.push(("name", name)); 239 } 240 if let Some(ref no_show_all) = self.no_show_all { 241 properties.push(("no-show-all", no_show_all)); 242 } 243 if let Some(ref opacity) = self.opacity { 244 properties.push(("opacity", opacity)); 245 } 246 if let Some(ref parent) = self.parent { 247 properties.push(("parent", parent)); 248 } 249 if let Some(ref receives_default) = self.receives_default { 250 properties.push(("receives-default", receives_default)); 251 } 252 if let Some(ref sensitive) = self.sensitive { 253 properties.push(("sensitive", sensitive)); 254 } 255 if let Some(ref tooltip_markup) = self.tooltip_markup { 256 properties.push(("tooltip-markup", tooltip_markup)); 257 } 258 if let Some(ref tooltip_text) = self.tooltip_text { 259 properties.push(("tooltip-text", tooltip_text)); 260 } 261 if let Some(ref valign) = self.valign { 262 properties.push(("valign", valign)); 263 } 264 if let Some(ref vexpand) = self.vexpand { 265 properties.push(("vexpand", vexpand)); 266 } 267 if let Some(ref vexpand_set) = self.vexpand_set { 268 properties.push(("vexpand-set", vexpand_set)); 269 } 270 if let Some(ref visible) = self.visible { 271 properties.push(("visible", visible)); 272 } 273 if let Some(ref width_request) = self.width_request { 274 properties.push(("width-request", width_request)); 275 } 276 if let Some(ref editing_canceled) = self.editing_canceled { 277 properties.push(("editing-canceled", editing_canceled)); 278 } 279 if let Some(ref content_type) = self.content_type { 280 properties.push(("content-type", content_type)); 281 } 282 glib::Object::new(AppChooserButton::static_type(), &properties) 283 .expect("object new") 284 .downcast() 285 .expect("downcast") 286 } 287 heading(mut self, heading: &str) -> Self288 pub fn heading(mut self, heading: &str) -> Self { 289 self.heading = Some(heading.to_string()); 290 self 291 } 292 show_default_item(mut self, show_default_item: bool) -> Self293 pub fn show_default_item(mut self, show_default_item: bool) -> Self { 294 self.show_default_item = Some(show_default_item); 295 self 296 } 297 show_dialog_item(mut self, show_dialog_item: bool) -> Self298 pub fn show_dialog_item(mut self, show_dialog_item: bool) -> Self { 299 self.show_dialog_item = Some(show_dialog_item); 300 self 301 } 302 active(mut self, active: i32) -> Self303 pub fn active(mut self, active: i32) -> Self { 304 self.active = Some(active); 305 self 306 } 307 active_id(mut self, active_id: &str) -> Self308 pub fn active_id(mut self, active_id: &str) -> Self { 309 self.active_id = Some(active_id.to_string()); 310 self 311 } 312 button_sensitivity(mut self, button_sensitivity: SensitivityType) -> Self313 pub fn button_sensitivity(mut self, button_sensitivity: SensitivityType) -> Self { 314 self.button_sensitivity = Some(button_sensitivity); 315 self 316 } 317 cell_area<P: IsA<CellArea>>(mut self, cell_area: &P) -> Self318 pub fn cell_area<P: IsA<CellArea>>(mut self, cell_area: &P) -> Self { 319 self.cell_area = Some(cell_area.clone().upcast()); 320 self 321 } 322 column_span_column(mut self, column_span_column: i32) -> Self323 pub fn column_span_column(mut self, column_span_column: i32) -> Self { 324 self.column_span_column = Some(column_span_column); 325 self 326 } 327 entry_text_column(mut self, entry_text_column: i32) -> Self328 pub fn entry_text_column(mut self, entry_text_column: i32) -> Self { 329 self.entry_text_column = Some(entry_text_column); 330 self 331 } 332 has_entry(mut self, has_entry: bool) -> Self333 pub fn has_entry(mut self, has_entry: bool) -> Self { 334 self.has_entry = Some(has_entry); 335 self 336 } 337 has_frame(mut self, has_frame: bool) -> Self338 pub fn has_frame(mut self, has_frame: bool) -> Self { 339 self.has_frame = Some(has_frame); 340 self 341 } 342 id_column(mut self, id_column: i32) -> Self343 pub fn id_column(mut self, id_column: i32) -> Self { 344 self.id_column = Some(id_column); 345 self 346 } 347 model<P: IsA<TreeModel>>(mut self, model: &P) -> Self348 pub fn model<P: IsA<TreeModel>>(mut self, model: &P) -> Self { 349 self.model = Some(model.clone().upcast()); 350 self 351 } 352 popup_fixed_width(mut self, popup_fixed_width: bool) -> Self353 pub fn popup_fixed_width(mut self, popup_fixed_width: bool) -> Self { 354 self.popup_fixed_width = Some(popup_fixed_width); 355 self 356 } 357 row_span_column(mut self, row_span_column: i32) -> Self358 pub fn row_span_column(mut self, row_span_column: i32) -> Self { 359 self.row_span_column = Some(row_span_column); 360 self 361 } 362 wrap_width(mut self, wrap_width: i32) -> Self363 pub fn wrap_width(mut self, wrap_width: i32) -> Self { 364 self.wrap_width = Some(wrap_width); 365 self 366 } 367 border_width(mut self, border_width: u32) -> Self368 pub fn border_width(mut self, border_width: u32) -> Self { 369 self.border_width = Some(border_width); 370 self 371 } 372 child<P: IsA<Widget>>(mut self, child: &P) -> Self373 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 374 self.child = Some(child.clone().upcast()); 375 self 376 } 377 resize_mode(mut self, resize_mode: ResizeMode) -> Self378 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 379 self.resize_mode = Some(resize_mode); 380 self 381 } 382 app_paintable(mut self, app_paintable: bool) -> Self383 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 384 self.app_paintable = Some(app_paintable); 385 self 386 } 387 can_default(mut self, can_default: bool) -> Self388 pub fn can_default(mut self, can_default: bool) -> Self { 389 self.can_default = Some(can_default); 390 self 391 } 392 can_focus(mut self, can_focus: bool) -> Self393 pub fn can_focus(mut self, can_focus: bool) -> Self { 394 self.can_focus = Some(can_focus); 395 self 396 } 397 events(mut self, events: gdk::EventMask) -> Self398 pub fn events(mut self, events: gdk::EventMask) -> Self { 399 self.events = Some(events); 400 self 401 } 402 expand(mut self, expand: bool) -> Self403 pub fn expand(mut self, expand: bool) -> Self { 404 self.expand = Some(expand); 405 self 406 } 407 408 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self409 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 410 self.focus_on_click = Some(focus_on_click); 411 self 412 } 413 halign(mut self, halign: Align) -> Self414 pub fn halign(mut self, halign: Align) -> Self { 415 self.halign = Some(halign); 416 self 417 } 418 has_default(mut self, has_default: bool) -> Self419 pub fn has_default(mut self, has_default: bool) -> Self { 420 self.has_default = Some(has_default); 421 self 422 } 423 has_focus(mut self, has_focus: bool) -> Self424 pub fn has_focus(mut self, has_focus: bool) -> Self { 425 self.has_focus = Some(has_focus); 426 self 427 } 428 has_tooltip(mut self, has_tooltip: bool) -> Self429 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 430 self.has_tooltip = Some(has_tooltip); 431 self 432 } 433 height_request(mut self, height_request: i32) -> Self434 pub fn height_request(mut self, height_request: i32) -> Self { 435 self.height_request = Some(height_request); 436 self 437 } 438 hexpand(mut self, hexpand: bool) -> Self439 pub fn hexpand(mut self, hexpand: bool) -> Self { 440 self.hexpand = Some(hexpand); 441 self 442 } 443 hexpand_set(mut self, hexpand_set: bool) -> Self444 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 445 self.hexpand_set = Some(hexpand_set); 446 self 447 } 448 is_focus(mut self, is_focus: bool) -> Self449 pub fn is_focus(mut self, is_focus: bool) -> Self { 450 self.is_focus = Some(is_focus); 451 self 452 } 453 margin(mut self, margin: i32) -> Self454 pub fn margin(mut self, margin: i32) -> Self { 455 self.margin = Some(margin); 456 self 457 } 458 margin_bottom(mut self, margin_bottom: i32) -> Self459 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 460 self.margin_bottom = Some(margin_bottom); 461 self 462 } 463 margin_end(mut self, margin_end: i32) -> Self464 pub fn margin_end(mut self, margin_end: i32) -> Self { 465 self.margin_end = Some(margin_end); 466 self 467 } 468 margin_start(mut self, margin_start: i32) -> Self469 pub fn margin_start(mut self, margin_start: i32) -> Self { 470 self.margin_start = Some(margin_start); 471 self 472 } 473 margin_top(mut self, margin_top: i32) -> Self474 pub fn margin_top(mut self, margin_top: i32) -> Self { 475 self.margin_top = Some(margin_top); 476 self 477 } 478 name(mut self, name: &str) -> Self479 pub fn name(mut self, name: &str) -> Self { 480 self.name = Some(name.to_string()); 481 self 482 } 483 no_show_all(mut self, no_show_all: bool) -> Self484 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 485 self.no_show_all = Some(no_show_all); 486 self 487 } 488 opacity(mut self, opacity: f64) -> Self489 pub fn opacity(mut self, opacity: f64) -> Self { 490 self.opacity = Some(opacity); 491 self 492 } 493 parent<P: IsA<Container>>(mut self, parent: &P) -> Self494 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 495 self.parent = Some(parent.clone().upcast()); 496 self 497 } 498 receives_default(mut self, receives_default: bool) -> Self499 pub fn receives_default(mut self, receives_default: bool) -> Self { 500 self.receives_default = Some(receives_default); 501 self 502 } 503 sensitive(mut self, sensitive: bool) -> Self504 pub fn sensitive(mut self, sensitive: bool) -> Self { 505 self.sensitive = Some(sensitive); 506 self 507 } 508 tooltip_markup(mut self, tooltip_markup: &str) -> Self509 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 510 self.tooltip_markup = Some(tooltip_markup.to_string()); 511 self 512 } 513 tooltip_text(mut self, tooltip_text: &str) -> Self514 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 515 self.tooltip_text = Some(tooltip_text.to_string()); 516 self 517 } 518 valign(mut self, valign: Align) -> Self519 pub fn valign(mut self, valign: Align) -> Self { 520 self.valign = Some(valign); 521 self 522 } 523 vexpand(mut self, vexpand: bool) -> Self524 pub fn vexpand(mut self, vexpand: bool) -> Self { 525 self.vexpand = Some(vexpand); 526 self 527 } 528 vexpand_set(mut self, vexpand_set: bool) -> Self529 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 530 self.vexpand_set = Some(vexpand_set); 531 self 532 } 533 visible(mut self, visible: bool) -> Self534 pub fn visible(mut self, visible: bool) -> Self { 535 self.visible = Some(visible); 536 self 537 } 538 width_request(mut self, width_request: i32) -> Self539 pub fn width_request(mut self, width_request: i32) -> Self { 540 self.width_request = Some(width_request); 541 self 542 } 543 editing_canceled(mut self, editing_canceled: bool) -> Self544 pub fn editing_canceled(mut self, editing_canceled: bool) -> Self { 545 self.editing_canceled = Some(editing_canceled); 546 self 547 } 548 content_type(mut self, content_type: &str) -> Self549 pub fn content_type(mut self, content_type: &str) -> Self { 550 self.content_type = Some(content_type.to_string()); 551 self 552 } 553 } 554 555 pub const NONE_APP_CHOOSER_BUTTON: Option<&AppChooserButton> = None; 556 557 pub trait AppChooserButtonExt: 'static { append_custom_item<P: IsA<gio::Icon>>(&self, name: &str, label: &str, icon: &P)558 fn append_custom_item<P: IsA<gio::Icon>>(&self, name: &str, label: &str, icon: &P); 559 append_separator(&self)560 fn append_separator(&self); 561 get_heading(&self) -> Option<GString>562 fn get_heading(&self) -> Option<GString>; 563 get_show_default_item(&self) -> bool564 fn get_show_default_item(&self) -> bool; 565 get_show_dialog_item(&self) -> bool566 fn get_show_dialog_item(&self) -> bool; 567 set_active_custom_item(&self, name: &str)568 fn set_active_custom_item(&self, name: &str); 569 set_heading(&self, heading: &str)570 fn set_heading(&self, heading: &str); 571 set_show_default_item(&self, setting: bool)572 fn set_show_default_item(&self, setting: bool); 573 set_show_dialog_item(&self, setting: bool)574 fn set_show_dialog_item(&self, setting: bool); 575 connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId576 fn connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId; 577 connect_property_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId578 fn connect_property_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 579 connect_property_show_default_item_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId580 fn connect_property_show_default_item_notify<F: Fn(&Self) + 'static>( 581 &self, 582 f: F, 583 ) -> SignalHandlerId; 584 connect_property_show_dialog_item_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId585 fn connect_property_show_dialog_item_notify<F: Fn(&Self) + 'static>( 586 &self, 587 f: F, 588 ) -> SignalHandlerId; 589 } 590 591 impl<O: IsA<AppChooserButton>> AppChooserButtonExt for O { append_custom_item<P: IsA<gio::Icon>>(&self, name: &str, label: &str, icon: &P)592 fn append_custom_item<P: IsA<gio::Icon>>(&self, name: &str, label: &str, icon: &P) { 593 unsafe { 594 gtk_sys::gtk_app_chooser_button_append_custom_item( 595 self.as_ref().to_glib_none().0, 596 name.to_glib_none().0, 597 label.to_glib_none().0, 598 icon.as_ref().to_glib_none().0, 599 ); 600 } 601 } 602 append_separator(&self)603 fn append_separator(&self) { 604 unsafe { 605 gtk_sys::gtk_app_chooser_button_append_separator(self.as_ref().to_glib_none().0); 606 } 607 } 608 get_heading(&self) -> Option<GString>609 fn get_heading(&self) -> Option<GString> { 610 unsafe { 611 from_glib_none(gtk_sys::gtk_app_chooser_button_get_heading( 612 self.as_ref().to_glib_none().0, 613 )) 614 } 615 } 616 get_show_default_item(&self) -> bool617 fn get_show_default_item(&self) -> bool { 618 unsafe { 619 from_glib(gtk_sys::gtk_app_chooser_button_get_show_default_item( 620 self.as_ref().to_glib_none().0, 621 )) 622 } 623 } 624 get_show_dialog_item(&self) -> bool625 fn get_show_dialog_item(&self) -> bool { 626 unsafe { 627 from_glib(gtk_sys::gtk_app_chooser_button_get_show_dialog_item( 628 self.as_ref().to_glib_none().0, 629 )) 630 } 631 } 632 set_active_custom_item(&self, name: &str)633 fn set_active_custom_item(&self, name: &str) { 634 unsafe { 635 gtk_sys::gtk_app_chooser_button_set_active_custom_item( 636 self.as_ref().to_glib_none().0, 637 name.to_glib_none().0, 638 ); 639 } 640 } 641 set_heading(&self, heading: &str)642 fn set_heading(&self, heading: &str) { 643 unsafe { 644 gtk_sys::gtk_app_chooser_button_set_heading( 645 self.as_ref().to_glib_none().0, 646 heading.to_glib_none().0, 647 ); 648 } 649 } 650 set_show_default_item(&self, setting: bool)651 fn set_show_default_item(&self, setting: bool) { 652 unsafe { 653 gtk_sys::gtk_app_chooser_button_set_show_default_item( 654 self.as_ref().to_glib_none().0, 655 setting.to_glib(), 656 ); 657 } 658 } 659 set_show_dialog_item(&self, setting: bool)660 fn set_show_dialog_item(&self, setting: bool) { 661 unsafe { 662 gtk_sys::gtk_app_chooser_button_set_show_dialog_item( 663 self.as_ref().to_glib_none().0, 664 setting.to_glib(), 665 ); 666 } 667 } 668 connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId669 fn connect_custom_item_activated<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId { 670 unsafe extern "C" fn custom_item_activated_trampoline<P, F: Fn(&P, &str) + 'static>( 671 this: *mut gtk_sys::GtkAppChooserButton, 672 item_name: *mut libc::c_char, 673 f: glib_sys::gpointer, 674 ) where 675 P: IsA<AppChooserButton>, 676 { 677 let f: &F = &*(f as *const F); 678 f( 679 &AppChooserButton::from_glib_borrow(this).unsafe_cast(), 680 &GString::from_glib_borrow(item_name), 681 ) 682 } 683 unsafe { 684 let f: Box_<F> = Box_::new(f); 685 connect_raw( 686 self.as_ptr() as *mut _, 687 b"custom-item-activated\0".as_ptr() as *const _, 688 Some(transmute( 689 custom_item_activated_trampoline::<Self, F> as usize, 690 )), 691 Box_::into_raw(f), 692 ) 693 } 694 } 695 connect_property_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId696 fn connect_property_heading_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 697 unsafe extern "C" fn notify_heading_trampoline<P, F: Fn(&P) + 'static>( 698 this: *mut gtk_sys::GtkAppChooserButton, 699 _param_spec: glib_sys::gpointer, 700 f: glib_sys::gpointer, 701 ) where 702 P: IsA<AppChooserButton>, 703 { 704 let f: &F = &*(f as *const F); 705 f(&AppChooserButton::from_glib_borrow(this).unsafe_cast()) 706 } 707 unsafe { 708 let f: Box_<F> = Box_::new(f); 709 connect_raw( 710 self.as_ptr() as *mut _, 711 b"notify::heading\0".as_ptr() as *const _, 712 Some(transmute(notify_heading_trampoline::<Self, F> as usize)), 713 Box_::into_raw(f), 714 ) 715 } 716 } 717 connect_property_show_default_item_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId718 fn connect_property_show_default_item_notify<F: Fn(&Self) + 'static>( 719 &self, 720 f: F, 721 ) -> SignalHandlerId { 722 unsafe extern "C" fn notify_show_default_item_trampoline<P, F: Fn(&P) + 'static>( 723 this: *mut gtk_sys::GtkAppChooserButton, 724 _param_spec: glib_sys::gpointer, 725 f: glib_sys::gpointer, 726 ) where 727 P: IsA<AppChooserButton>, 728 { 729 let f: &F = &*(f as *const F); 730 f(&AppChooserButton::from_glib_borrow(this).unsafe_cast()) 731 } 732 unsafe { 733 let f: Box_<F> = Box_::new(f); 734 connect_raw( 735 self.as_ptr() as *mut _, 736 b"notify::show-default-item\0".as_ptr() as *const _, 737 Some(transmute( 738 notify_show_default_item_trampoline::<Self, F> as usize, 739 )), 740 Box_::into_raw(f), 741 ) 742 } 743 } 744 connect_property_show_dialog_item_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId745 fn connect_property_show_dialog_item_notify<F: Fn(&Self) + 'static>( 746 &self, 747 f: F, 748 ) -> SignalHandlerId { 749 unsafe extern "C" fn notify_show_dialog_item_trampoline<P, F: Fn(&P) + 'static>( 750 this: *mut gtk_sys::GtkAppChooserButton, 751 _param_spec: glib_sys::gpointer, 752 f: glib_sys::gpointer, 753 ) where 754 P: IsA<AppChooserButton>, 755 { 756 let f: &F = &*(f as *const F); 757 f(&AppChooserButton::from_glib_borrow(this).unsafe_cast()) 758 } 759 unsafe { 760 let f: Box_<F> = Box_::new(f); 761 connect_raw( 762 self.as_ptr() as *mut _, 763 b"notify::show-dialog-item\0".as_ptr() as *const _, 764 Some(transmute( 765 notify_show_dialog_item_trampoline::<Self, F> as usize, 766 )), 767 Box_::into_raw(f), 768 ) 769 } 770 } 771 } 772 773 impl fmt::Display for AppChooserButton { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result774 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 775 write!(f, "AppChooserButton") 776 } 777 } 778