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::Buildable; 7 use crate::Container; 8 use crate::Orientable; 9 use crate::Orientation; 10 use crate::Widget; 11 use glib::object::Cast; 12 use glib::object::IsA; 13 use glib::signal::connect_raw; 14 use glib::signal::SignalHandlerId; 15 use glib::translate::*; 16 use glib::StaticType; 17 use glib::ToValue; 18 use std::boxed::Box as Box_; 19 use std::fmt; 20 use std::mem::transmute; 21 22 glib::wrapper! { 23 #[doc(alias = "GtkProgressBar")] 24 pub struct ProgressBar(Object<ffi::GtkProgressBar, ffi::GtkProgressBarClass>) @extends Widget, @implements Buildable, Orientable; 25 26 match fn { 27 type_ => || ffi::gtk_progress_bar_get_type(), 28 } 29 } 30 31 impl ProgressBar { 32 #[doc(alias = "gtk_progress_bar_new")] new() -> ProgressBar33 pub fn new() -> ProgressBar { 34 assert_initialized_main_thread!(); 35 unsafe { Widget::from_glib_none(ffi::gtk_progress_bar_new()).unsafe_cast() } 36 } 37 38 // rustdoc-stripper-ignore-next 39 /// Creates a new builder-pattern struct instance to construct [`ProgressBar`] objects. 40 /// 41 /// This method returns an instance of [`ProgressBarBuilder`] which can be used to create [`ProgressBar`] objects. builder() -> ProgressBarBuilder42 pub fn builder() -> ProgressBarBuilder { 43 ProgressBarBuilder::default() 44 } 45 } 46 47 impl Default for ProgressBar { default() -> Self48 fn default() -> Self { 49 Self::new() 50 } 51 } 52 53 #[derive(Clone, Default)] 54 // rustdoc-stripper-ignore-next 55 /// A [builder-pattern] type to construct [`ProgressBar`] objects. 56 /// 57 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 58 pub struct ProgressBarBuilder { 59 ellipsize: Option<pango::EllipsizeMode>, 60 fraction: Option<f64>, 61 inverted: Option<bool>, 62 pulse_step: Option<f64>, 63 show_text: Option<bool>, 64 text: Option<String>, 65 app_paintable: Option<bool>, 66 can_default: Option<bool>, 67 can_focus: Option<bool>, 68 events: Option<gdk::EventMask>, 69 expand: Option<bool>, 70 #[cfg(any(feature = "v3_20", feature = "dox"))] 71 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 72 focus_on_click: Option<bool>, 73 halign: Option<Align>, 74 has_default: Option<bool>, 75 has_focus: Option<bool>, 76 has_tooltip: Option<bool>, 77 height_request: Option<i32>, 78 hexpand: Option<bool>, 79 hexpand_set: Option<bool>, 80 is_focus: Option<bool>, 81 margin: Option<i32>, 82 margin_bottom: Option<i32>, 83 margin_end: Option<i32>, 84 margin_start: Option<i32>, 85 margin_top: Option<i32>, 86 name: Option<String>, 87 no_show_all: Option<bool>, 88 opacity: Option<f64>, 89 parent: Option<Container>, 90 receives_default: Option<bool>, 91 sensitive: Option<bool>, 92 tooltip_markup: Option<String>, 93 tooltip_text: Option<String>, 94 valign: Option<Align>, 95 vexpand: Option<bool>, 96 vexpand_set: Option<bool>, 97 visible: Option<bool>, 98 width_request: Option<i32>, 99 orientation: Option<Orientation>, 100 } 101 102 impl ProgressBarBuilder { 103 // rustdoc-stripper-ignore-next 104 /// Create a new [`ProgressBarBuilder`]. new() -> Self105 pub fn new() -> Self { 106 Self::default() 107 } 108 109 // rustdoc-stripper-ignore-next 110 /// Build the [`ProgressBar`]. build(self) -> ProgressBar111 pub fn build(self) -> ProgressBar { 112 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 113 if let Some(ref ellipsize) = self.ellipsize { 114 properties.push(("ellipsize", ellipsize)); 115 } 116 if let Some(ref fraction) = self.fraction { 117 properties.push(("fraction", fraction)); 118 } 119 if let Some(ref inverted) = self.inverted { 120 properties.push(("inverted", inverted)); 121 } 122 if let Some(ref pulse_step) = self.pulse_step { 123 properties.push(("pulse-step", pulse_step)); 124 } 125 if let Some(ref show_text) = self.show_text { 126 properties.push(("show-text", show_text)); 127 } 128 if let Some(ref text) = self.text { 129 properties.push(("text", text)); 130 } 131 if let Some(ref app_paintable) = self.app_paintable { 132 properties.push(("app-paintable", app_paintable)); 133 } 134 if let Some(ref can_default) = self.can_default { 135 properties.push(("can-default", can_default)); 136 } 137 if let Some(ref can_focus) = self.can_focus { 138 properties.push(("can-focus", can_focus)); 139 } 140 if let Some(ref events) = self.events { 141 properties.push(("events", events)); 142 } 143 if let Some(ref expand) = self.expand { 144 properties.push(("expand", expand)); 145 } 146 #[cfg(any(feature = "v3_20", feature = "dox"))] 147 if let Some(ref focus_on_click) = self.focus_on_click { 148 properties.push(("focus-on-click", focus_on_click)); 149 } 150 if let Some(ref halign) = self.halign { 151 properties.push(("halign", halign)); 152 } 153 if let Some(ref has_default) = self.has_default { 154 properties.push(("has-default", has_default)); 155 } 156 if let Some(ref has_focus) = self.has_focus { 157 properties.push(("has-focus", has_focus)); 158 } 159 if let Some(ref has_tooltip) = self.has_tooltip { 160 properties.push(("has-tooltip", has_tooltip)); 161 } 162 if let Some(ref height_request) = self.height_request { 163 properties.push(("height-request", height_request)); 164 } 165 if let Some(ref hexpand) = self.hexpand { 166 properties.push(("hexpand", hexpand)); 167 } 168 if let Some(ref hexpand_set) = self.hexpand_set { 169 properties.push(("hexpand-set", hexpand_set)); 170 } 171 if let Some(ref is_focus) = self.is_focus { 172 properties.push(("is-focus", is_focus)); 173 } 174 if let Some(ref margin) = self.margin { 175 properties.push(("margin", margin)); 176 } 177 if let Some(ref margin_bottom) = self.margin_bottom { 178 properties.push(("margin-bottom", margin_bottom)); 179 } 180 if let Some(ref margin_end) = self.margin_end { 181 properties.push(("margin-end", margin_end)); 182 } 183 if let Some(ref margin_start) = self.margin_start { 184 properties.push(("margin-start", margin_start)); 185 } 186 if let Some(ref margin_top) = self.margin_top { 187 properties.push(("margin-top", margin_top)); 188 } 189 if let Some(ref name) = self.name { 190 properties.push(("name", name)); 191 } 192 if let Some(ref no_show_all) = self.no_show_all { 193 properties.push(("no-show-all", no_show_all)); 194 } 195 if let Some(ref opacity) = self.opacity { 196 properties.push(("opacity", opacity)); 197 } 198 if let Some(ref parent) = self.parent { 199 properties.push(("parent", parent)); 200 } 201 if let Some(ref receives_default) = self.receives_default { 202 properties.push(("receives-default", receives_default)); 203 } 204 if let Some(ref sensitive) = self.sensitive { 205 properties.push(("sensitive", sensitive)); 206 } 207 if let Some(ref tooltip_markup) = self.tooltip_markup { 208 properties.push(("tooltip-markup", tooltip_markup)); 209 } 210 if let Some(ref tooltip_text) = self.tooltip_text { 211 properties.push(("tooltip-text", tooltip_text)); 212 } 213 if let Some(ref valign) = self.valign { 214 properties.push(("valign", valign)); 215 } 216 if let Some(ref vexpand) = self.vexpand { 217 properties.push(("vexpand", vexpand)); 218 } 219 if let Some(ref vexpand_set) = self.vexpand_set { 220 properties.push(("vexpand-set", vexpand_set)); 221 } 222 if let Some(ref visible) = self.visible { 223 properties.push(("visible", visible)); 224 } 225 if let Some(ref width_request) = self.width_request { 226 properties.push(("width-request", width_request)); 227 } 228 if let Some(ref orientation) = self.orientation { 229 properties.push(("orientation", orientation)); 230 } 231 glib::Object::new::<ProgressBar>(&properties) 232 .expect("Failed to create an instance of ProgressBar") 233 } 234 ellipsize(mut self, ellipsize: pango::EllipsizeMode) -> Self235 pub fn ellipsize(mut self, ellipsize: pango::EllipsizeMode) -> Self { 236 self.ellipsize = Some(ellipsize); 237 self 238 } 239 fraction(mut self, fraction: f64) -> Self240 pub fn fraction(mut self, fraction: f64) -> Self { 241 self.fraction = Some(fraction); 242 self 243 } 244 inverted(mut self, inverted: bool) -> Self245 pub fn inverted(mut self, inverted: bool) -> Self { 246 self.inverted = Some(inverted); 247 self 248 } 249 pulse_step(mut self, pulse_step: f64) -> Self250 pub fn pulse_step(mut self, pulse_step: f64) -> Self { 251 self.pulse_step = Some(pulse_step); 252 self 253 } 254 show_text(mut self, show_text: bool) -> Self255 pub fn show_text(mut self, show_text: bool) -> Self { 256 self.show_text = Some(show_text); 257 self 258 } 259 text(mut self, text: &str) -> Self260 pub fn text(mut self, text: &str) -> Self { 261 self.text = Some(text.to_string()); 262 self 263 } 264 app_paintable(mut self, app_paintable: bool) -> Self265 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 266 self.app_paintable = Some(app_paintable); 267 self 268 } 269 can_default(mut self, can_default: bool) -> Self270 pub fn can_default(mut self, can_default: bool) -> Self { 271 self.can_default = Some(can_default); 272 self 273 } 274 can_focus(mut self, can_focus: bool) -> Self275 pub fn can_focus(mut self, can_focus: bool) -> Self { 276 self.can_focus = Some(can_focus); 277 self 278 } 279 events(mut self, events: gdk::EventMask) -> Self280 pub fn events(mut self, events: gdk::EventMask) -> Self { 281 self.events = Some(events); 282 self 283 } 284 expand(mut self, expand: bool) -> Self285 pub fn expand(mut self, expand: bool) -> Self { 286 self.expand = Some(expand); 287 self 288 } 289 290 #[cfg(any(feature = "v3_20", feature = "dox"))] 291 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self292 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 293 self.focus_on_click = Some(focus_on_click); 294 self 295 } 296 halign(mut self, halign: Align) -> Self297 pub fn halign(mut self, halign: Align) -> Self { 298 self.halign = Some(halign); 299 self 300 } 301 has_default(mut self, has_default: bool) -> Self302 pub fn has_default(mut self, has_default: bool) -> Self { 303 self.has_default = Some(has_default); 304 self 305 } 306 has_focus(mut self, has_focus: bool) -> Self307 pub fn has_focus(mut self, has_focus: bool) -> Self { 308 self.has_focus = Some(has_focus); 309 self 310 } 311 has_tooltip(mut self, has_tooltip: bool) -> Self312 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 313 self.has_tooltip = Some(has_tooltip); 314 self 315 } 316 height_request(mut self, height_request: i32) -> Self317 pub fn height_request(mut self, height_request: i32) -> Self { 318 self.height_request = Some(height_request); 319 self 320 } 321 hexpand(mut self, hexpand: bool) -> Self322 pub fn hexpand(mut self, hexpand: bool) -> Self { 323 self.hexpand = Some(hexpand); 324 self 325 } 326 hexpand_set(mut self, hexpand_set: bool) -> Self327 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 328 self.hexpand_set = Some(hexpand_set); 329 self 330 } 331 is_focus(mut self, is_focus: bool) -> Self332 pub fn is_focus(mut self, is_focus: bool) -> Self { 333 self.is_focus = Some(is_focus); 334 self 335 } 336 margin(mut self, margin: i32) -> Self337 pub fn margin(mut self, margin: i32) -> Self { 338 self.margin = Some(margin); 339 self 340 } 341 margin_bottom(mut self, margin_bottom: i32) -> Self342 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 343 self.margin_bottom = Some(margin_bottom); 344 self 345 } 346 margin_end(mut self, margin_end: i32) -> Self347 pub fn margin_end(mut self, margin_end: i32) -> Self { 348 self.margin_end = Some(margin_end); 349 self 350 } 351 margin_start(mut self, margin_start: i32) -> Self352 pub fn margin_start(mut self, margin_start: i32) -> Self { 353 self.margin_start = Some(margin_start); 354 self 355 } 356 margin_top(mut self, margin_top: i32) -> Self357 pub fn margin_top(mut self, margin_top: i32) -> Self { 358 self.margin_top = Some(margin_top); 359 self 360 } 361 name(mut self, name: &str) -> Self362 pub fn name(mut self, name: &str) -> Self { 363 self.name = Some(name.to_string()); 364 self 365 } 366 no_show_all(mut self, no_show_all: bool) -> Self367 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 368 self.no_show_all = Some(no_show_all); 369 self 370 } 371 opacity(mut self, opacity: f64) -> Self372 pub fn opacity(mut self, opacity: f64) -> Self { 373 self.opacity = Some(opacity); 374 self 375 } 376 parent<P: IsA<Container>>(mut self, parent: &P) -> Self377 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 378 self.parent = Some(parent.clone().upcast()); 379 self 380 } 381 receives_default(mut self, receives_default: bool) -> Self382 pub fn receives_default(mut self, receives_default: bool) -> Self { 383 self.receives_default = Some(receives_default); 384 self 385 } 386 sensitive(mut self, sensitive: bool) -> Self387 pub fn sensitive(mut self, sensitive: bool) -> Self { 388 self.sensitive = Some(sensitive); 389 self 390 } 391 tooltip_markup(mut self, tooltip_markup: &str) -> Self392 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 393 self.tooltip_markup = Some(tooltip_markup.to_string()); 394 self 395 } 396 tooltip_text(mut self, tooltip_text: &str) -> Self397 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 398 self.tooltip_text = Some(tooltip_text.to_string()); 399 self 400 } 401 valign(mut self, valign: Align) -> Self402 pub fn valign(mut self, valign: Align) -> Self { 403 self.valign = Some(valign); 404 self 405 } 406 vexpand(mut self, vexpand: bool) -> Self407 pub fn vexpand(mut self, vexpand: bool) -> Self { 408 self.vexpand = Some(vexpand); 409 self 410 } 411 vexpand_set(mut self, vexpand_set: bool) -> Self412 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 413 self.vexpand_set = Some(vexpand_set); 414 self 415 } 416 visible(mut self, visible: bool) -> Self417 pub fn visible(mut self, visible: bool) -> Self { 418 self.visible = Some(visible); 419 self 420 } 421 width_request(mut self, width_request: i32) -> Self422 pub fn width_request(mut self, width_request: i32) -> Self { 423 self.width_request = Some(width_request); 424 self 425 } 426 orientation(mut self, orientation: Orientation) -> Self427 pub fn orientation(mut self, orientation: Orientation) -> Self { 428 self.orientation = Some(orientation); 429 self 430 } 431 } 432 433 pub const NONE_PROGRESS_BAR: Option<&ProgressBar> = None; 434 435 pub trait ProgressBarExt: 'static { 436 #[doc(alias = "gtk_progress_bar_get_ellipsize")] 437 #[doc(alias = "get_ellipsize")] ellipsize(&self) -> pango::EllipsizeMode438 fn ellipsize(&self) -> pango::EllipsizeMode; 439 440 #[doc(alias = "gtk_progress_bar_get_fraction")] 441 #[doc(alias = "get_fraction")] fraction(&self) -> f64442 fn fraction(&self) -> f64; 443 444 #[doc(alias = "gtk_progress_bar_get_inverted")] 445 #[doc(alias = "get_inverted")] is_inverted(&self) -> bool446 fn is_inverted(&self) -> bool; 447 448 #[doc(alias = "gtk_progress_bar_get_pulse_step")] 449 #[doc(alias = "get_pulse_step")] pulse_step(&self) -> f64450 fn pulse_step(&self) -> f64; 451 452 #[doc(alias = "gtk_progress_bar_get_show_text")] 453 #[doc(alias = "get_show_text")] shows_text(&self) -> bool454 fn shows_text(&self) -> bool; 455 456 #[doc(alias = "gtk_progress_bar_get_text")] 457 #[doc(alias = "get_text")] text(&self) -> Option<glib::GString>458 fn text(&self) -> Option<glib::GString>; 459 460 #[doc(alias = "gtk_progress_bar_pulse")] pulse(&self)461 fn pulse(&self); 462 463 #[doc(alias = "gtk_progress_bar_set_ellipsize")] set_ellipsize(&self, mode: pango::EllipsizeMode)464 fn set_ellipsize(&self, mode: pango::EllipsizeMode); 465 466 #[doc(alias = "gtk_progress_bar_set_fraction")] set_fraction(&self, fraction: f64)467 fn set_fraction(&self, fraction: f64); 468 469 #[doc(alias = "gtk_progress_bar_set_inverted")] set_inverted(&self, inverted: bool)470 fn set_inverted(&self, inverted: bool); 471 472 #[doc(alias = "gtk_progress_bar_set_pulse_step")] set_pulse_step(&self, fraction: f64)473 fn set_pulse_step(&self, fraction: f64); 474 475 #[doc(alias = "gtk_progress_bar_set_show_text")] set_show_text(&self, show_text: bool)476 fn set_show_text(&self, show_text: bool); 477 478 #[doc(alias = "gtk_progress_bar_set_text")] set_text(&self, text: Option<&str>)479 fn set_text(&self, text: Option<&str>); 480 481 #[doc(alias = "ellipsize")] connect_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId482 fn connect_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 483 484 #[doc(alias = "fraction")] connect_fraction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId485 fn connect_fraction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 486 487 #[doc(alias = "inverted")] connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId488 fn connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 489 490 #[doc(alias = "pulse-step")] connect_pulse_step_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId491 fn connect_pulse_step_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 492 493 #[doc(alias = "show-text")] connect_show_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId494 fn connect_show_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 495 496 #[doc(alias = "text")] connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId497 fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 498 } 499 500 impl<O: IsA<ProgressBar>> ProgressBarExt for O { ellipsize(&self) -> pango::EllipsizeMode501 fn ellipsize(&self) -> pango::EllipsizeMode { 502 unsafe { 503 from_glib(ffi::gtk_progress_bar_get_ellipsize( 504 self.as_ref().to_glib_none().0, 505 )) 506 } 507 } 508 fraction(&self) -> f64509 fn fraction(&self) -> f64 { 510 unsafe { ffi::gtk_progress_bar_get_fraction(self.as_ref().to_glib_none().0) } 511 } 512 is_inverted(&self) -> bool513 fn is_inverted(&self) -> bool { 514 unsafe { 515 from_glib(ffi::gtk_progress_bar_get_inverted( 516 self.as_ref().to_glib_none().0, 517 )) 518 } 519 } 520 pulse_step(&self) -> f64521 fn pulse_step(&self) -> f64 { 522 unsafe { ffi::gtk_progress_bar_get_pulse_step(self.as_ref().to_glib_none().0) } 523 } 524 shows_text(&self) -> bool525 fn shows_text(&self) -> bool { 526 unsafe { 527 from_glib(ffi::gtk_progress_bar_get_show_text( 528 self.as_ref().to_glib_none().0, 529 )) 530 } 531 } 532 text(&self) -> Option<glib::GString>533 fn text(&self) -> Option<glib::GString> { 534 unsafe { 535 from_glib_none(ffi::gtk_progress_bar_get_text( 536 self.as_ref().to_glib_none().0, 537 )) 538 } 539 } 540 pulse(&self)541 fn pulse(&self) { 542 unsafe { 543 ffi::gtk_progress_bar_pulse(self.as_ref().to_glib_none().0); 544 } 545 } 546 set_ellipsize(&self, mode: pango::EllipsizeMode)547 fn set_ellipsize(&self, mode: pango::EllipsizeMode) { 548 unsafe { 549 ffi::gtk_progress_bar_set_ellipsize(self.as_ref().to_glib_none().0, mode.into_glib()); 550 } 551 } 552 set_fraction(&self, fraction: f64)553 fn set_fraction(&self, fraction: f64) { 554 unsafe { 555 ffi::gtk_progress_bar_set_fraction(self.as_ref().to_glib_none().0, fraction); 556 } 557 } 558 set_inverted(&self, inverted: bool)559 fn set_inverted(&self, inverted: bool) { 560 unsafe { 561 ffi::gtk_progress_bar_set_inverted( 562 self.as_ref().to_glib_none().0, 563 inverted.into_glib(), 564 ); 565 } 566 } 567 set_pulse_step(&self, fraction: f64)568 fn set_pulse_step(&self, fraction: f64) { 569 unsafe { 570 ffi::gtk_progress_bar_set_pulse_step(self.as_ref().to_glib_none().0, fraction); 571 } 572 } 573 set_show_text(&self, show_text: bool)574 fn set_show_text(&self, show_text: bool) { 575 unsafe { 576 ffi::gtk_progress_bar_set_show_text( 577 self.as_ref().to_glib_none().0, 578 show_text.into_glib(), 579 ); 580 } 581 } 582 set_text(&self, text: Option<&str>)583 fn set_text(&self, text: Option<&str>) { 584 unsafe { 585 ffi::gtk_progress_bar_set_text(self.as_ref().to_glib_none().0, text.to_glib_none().0); 586 } 587 } 588 connect_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId589 fn connect_ellipsize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 590 unsafe extern "C" fn notify_ellipsize_trampoline< 591 P: IsA<ProgressBar>, 592 F: Fn(&P) + 'static, 593 >( 594 this: *mut ffi::GtkProgressBar, 595 _param_spec: glib::ffi::gpointer, 596 f: glib::ffi::gpointer, 597 ) { 598 let f: &F = &*(f as *const F); 599 f(ProgressBar::from_glib_borrow(this).unsafe_cast_ref()) 600 } 601 unsafe { 602 let f: Box_<F> = Box_::new(f); 603 connect_raw( 604 self.as_ptr() as *mut _, 605 b"notify::ellipsize\0".as_ptr() as *const _, 606 Some(transmute::<_, unsafe extern "C" fn()>( 607 notify_ellipsize_trampoline::<Self, F> as *const (), 608 )), 609 Box_::into_raw(f), 610 ) 611 } 612 } 613 connect_fraction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId614 fn connect_fraction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 615 unsafe extern "C" fn notify_fraction_trampoline< 616 P: IsA<ProgressBar>, 617 F: Fn(&P) + 'static, 618 >( 619 this: *mut ffi::GtkProgressBar, 620 _param_spec: glib::ffi::gpointer, 621 f: glib::ffi::gpointer, 622 ) { 623 let f: &F = &*(f as *const F); 624 f(ProgressBar::from_glib_borrow(this).unsafe_cast_ref()) 625 } 626 unsafe { 627 let f: Box_<F> = Box_::new(f); 628 connect_raw( 629 self.as_ptr() as *mut _, 630 b"notify::fraction\0".as_ptr() as *const _, 631 Some(transmute::<_, unsafe extern "C" fn()>( 632 notify_fraction_trampoline::<Self, F> as *const (), 633 )), 634 Box_::into_raw(f), 635 ) 636 } 637 } 638 connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId639 fn connect_inverted_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 640 unsafe extern "C" fn notify_inverted_trampoline< 641 P: IsA<ProgressBar>, 642 F: Fn(&P) + 'static, 643 >( 644 this: *mut ffi::GtkProgressBar, 645 _param_spec: glib::ffi::gpointer, 646 f: glib::ffi::gpointer, 647 ) { 648 let f: &F = &*(f as *const F); 649 f(ProgressBar::from_glib_borrow(this).unsafe_cast_ref()) 650 } 651 unsafe { 652 let f: Box_<F> = Box_::new(f); 653 connect_raw( 654 self.as_ptr() as *mut _, 655 b"notify::inverted\0".as_ptr() as *const _, 656 Some(transmute::<_, unsafe extern "C" fn()>( 657 notify_inverted_trampoline::<Self, F> as *const (), 658 )), 659 Box_::into_raw(f), 660 ) 661 } 662 } 663 connect_pulse_step_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId664 fn connect_pulse_step_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 665 unsafe extern "C" fn notify_pulse_step_trampoline< 666 P: IsA<ProgressBar>, 667 F: Fn(&P) + 'static, 668 >( 669 this: *mut ffi::GtkProgressBar, 670 _param_spec: glib::ffi::gpointer, 671 f: glib::ffi::gpointer, 672 ) { 673 let f: &F = &*(f as *const F); 674 f(ProgressBar::from_glib_borrow(this).unsafe_cast_ref()) 675 } 676 unsafe { 677 let f: Box_<F> = Box_::new(f); 678 connect_raw( 679 self.as_ptr() as *mut _, 680 b"notify::pulse-step\0".as_ptr() as *const _, 681 Some(transmute::<_, unsafe extern "C" fn()>( 682 notify_pulse_step_trampoline::<Self, F> as *const (), 683 )), 684 Box_::into_raw(f), 685 ) 686 } 687 } 688 connect_show_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId689 fn connect_show_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 690 unsafe extern "C" fn notify_show_text_trampoline< 691 P: IsA<ProgressBar>, 692 F: Fn(&P) + 'static, 693 >( 694 this: *mut ffi::GtkProgressBar, 695 _param_spec: glib::ffi::gpointer, 696 f: glib::ffi::gpointer, 697 ) { 698 let f: &F = &*(f as *const F); 699 f(ProgressBar::from_glib_borrow(this).unsafe_cast_ref()) 700 } 701 unsafe { 702 let f: Box_<F> = Box_::new(f); 703 connect_raw( 704 self.as_ptr() as *mut _, 705 b"notify::show-text\0".as_ptr() as *const _, 706 Some(transmute::<_, unsafe extern "C" fn()>( 707 notify_show_text_trampoline::<Self, F> as *const (), 708 )), 709 Box_::into_raw(f), 710 ) 711 } 712 } 713 connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId714 fn connect_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 715 unsafe extern "C" fn notify_text_trampoline<P: IsA<ProgressBar>, F: Fn(&P) + 'static>( 716 this: *mut ffi::GtkProgressBar, 717 _param_spec: glib::ffi::gpointer, 718 f: glib::ffi::gpointer, 719 ) { 720 let f: &F = &*(f as *const F); 721 f(ProgressBar::from_glib_borrow(this).unsafe_cast_ref()) 722 } 723 unsafe { 724 let f: Box_<F> = Box_::new(f); 725 connect_raw( 726 self.as_ptr() as *mut _, 727 b"notify::text\0".as_ptr() as *const _, 728 Some(transmute::<_, unsafe extern "C" fn()>( 729 notify_text_trampoline::<Self, F> as *const (), 730 )), 731 Box_::into_raw(f), 732 ) 733 } 734 } 735 } 736 737 impl fmt::Display for ProgressBar { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result738 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 739 f.write_str("ProgressBar") 740 } 741 } 742