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::PageSetup; 6 use crate::PrintContext; 7 use crate::PrintOperationAction; 8 use crate::PrintOperationPreview; 9 use crate::PrintOperationResult; 10 use crate::PrintSettings; 11 use crate::PrintStatus; 12 use crate::Unit; 13 use crate::Widget; 14 use crate::Window; 15 use glib::object::Cast; 16 use glib::object::IsA; 17 use glib::signal::connect_raw; 18 use glib::signal::SignalHandlerId; 19 use glib::translate::*; 20 use glib::StaticType; 21 use glib::ToValue; 22 use std::boxed::Box as Box_; 23 use std::fmt; 24 use std::mem::transmute; 25 use std::ptr; 26 27 glib::wrapper! { 28 #[doc(alias = "GtkPrintOperation")] 29 pub struct PrintOperation(Object<ffi::GtkPrintOperation, ffi::GtkPrintOperationClass>) @implements PrintOperationPreview; 30 31 match fn { 32 type_ => || ffi::gtk_print_operation_get_type(), 33 } 34 } 35 36 impl PrintOperation { 37 #[doc(alias = "gtk_print_operation_new")] new() -> PrintOperation38 pub fn new() -> PrintOperation { 39 assert_initialized_main_thread!(); 40 unsafe { from_glib_full(ffi::gtk_print_operation_new()) } 41 } 42 43 // rustdoc-stripper-ignore-next 44 /// Creates a new builder-pattern struct instance to construct [`PrintOperation`] objects. 45 /// 46 /// This method returns an instance of [`PrintOperationBuilder`] which can be used to create [`PrintOperation`] objects. builder() -> PrintOperationBuilder47 pub fn builder() -> PrintOperationBuilder { 48 PrintOperationBuilder::default() 49 } 50 } 51 52 impl Default for PrintOperation { default() -> Self53 fn default() -> Self { 54 Self::new() 55 } 56 } 57 58 #[derive(Clone, Default)] 59 // rustdoc-stripper-ignore-next 60 /// A [builder-pattern] type to construct [`PrintOperation`] objects. 61 /// 62 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 63 pub struct PrintOperationBuilder { 64 allow_async: Option<bool>, 65 current_page: Option<i32>, 66 custom_tab_label: Option<String>, 67 default_page_setup: Option<PageSetup>, 68 embed_page_setup: Option<bool>, 69 export_filename: Option<String>, 70 has_selection: Option<bool>, 71 job_name: Option<String>, 72 n_pages: Option<i32>, 73 print_settings: Option<PrintSettings>, 74 show_progress: Option<bool>, 75 support_selection: Option<bool>, 76 track_print_status: Option<bool>, 77 unit: Option<Unit>, 78 use_full_page: Option<bool>, 79 } 80 81 impl PrintOperationBuilder { 82 // rustdoc-stripper-ignore-next 83 /// Create a new [`PrintOperationBuilder`]. new() -> Self84 pub fn new() -> Self { 85 Self::default() 86 } 87 88 // rustdoc-stripper-ignore-next 89 /// Build the [`PrintOperation`]. build(self) -> PrintOperation90 pub fn build(self) -> PrintOperation { 91 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 92 if let Some(ref allow_async) = self.allow_async { 93 properties.push(("allow-async", allow_async)); 94 } 95 if let Some(ref current_page) = self.current_page { 96 properties.push(("current-page", current_page)); 97 } 98 if let Some(ref custom_tab_label) = self.custom_tab_label { 99 properties.push(("custom-tab-label", custom_tab_label)); 100 } 101 if let Some(ref default_page_setup) = self.default_page_setup { 102 properties.push(("default-page-setup", default_page_setup)); 103 } 104 if let Some(ref embed_page_setup) = self.embed_page_setup { 105 properties.push(("embed-page-setup", embed_page_setup)); 106 } 107 if let Some(ref export_filename) = self.export_filename { 108 properties.push(("export-filename", export_filename)); 109 } 110 if let Some(ref has_selection) = self.has_selection { 111 properties.push(("has-selection", has_selection)); 112 } 113 if let Some(ref job_name) = self.job_name { 114 properties.push(("job-name", job_name)); 115 } 116 if let Some(ref n_pages) = self.n_pages { 117 properties.push(("n-pages", n_pages)); 118 } 119 if let Some(ref print_settings) = self.print_settings { 120 properties.push(("print-settings", print_settings)); 121 } 122 if let Some(ref show_progress) = self.show_progress { 123 properties.push(("show-progress", show_progress)); 124 } 125 if let Some(ref support_selection) = self.support_selection { 126 properties.push(("support-selection", support_selection)); 127 } 128 if let Some(ref track_print_status) = self.track_print_status { 129 properties.push(("track-print-status", track_print_status)); 130 } 131 if let Some(ref unit) = self.unit { 132 properties.push(("unit", unit)); 133 } 134 if let Some(ref use_full_page) = self.use_full_page { 135 properties.push(("use-full-page", use_full_page)); 136 } 137 glib::Object::new::<PrintOperation>(&properties) 138 .expect("Failed to create an instance of PrintOperation") 139 } 140 allow_async(mut self, allow_async: bool) -> Self141 pub fn allow_async(mut self, allow_async: bool) -> Self { 142 self.allow_async = Some(allow_async); 143 self 144 } 145 current_page(mut self, current_page: i32) -> Self146 pub fn current_page(mut self, current_page: i32) -> Self { 147 self.current_page = Some(current_page); 148 self 149 } 150 custom_tab_label(mut self, custom_tab_label: &str) -> Self151 pub fn custom_tab_label(mut self, custom_tab_label: &str) -> Self { 152 self.custom_tab_label = Some(custom_tab_label.to_string()); 153 self 154 } 155 default_page_setup(mut self, default_page_setup: &PageSetup) -> Self156 pub fn default_page_setup(mut self, default_page_setup: &PageSetup) -> Self { 157 self.default_page_setup = Some(default_page_setup.clone()); 158 self 159 } 160 embed_page_setup(mut self, embed_page_setup: bool) -> Self161 pub fn embed_page_setup(mut self, embed_page_setup: bool) -> Self { 162 self.embed_page_setup = Some(embed_page_setup); 163 self 164 } 165 export_filename(mut self, export_filename: &str) -> Self166 pub fn export_filename(mut self, export_filename: &str) -> Self { 167 self.export_filename = Some(export_filename.to_string()); 168 self 169 } 170 has_selection(mut self, has_selection: bool) -> Self171 pub fn has_selection(mut self, has_selection: bool) -> Self { 172 self.has_selection = Some(has_selection); 173 self 174 } 175 job_name(mut self, job_name: &str) -> Self176 pub fn job_name(mut self, job_name: &str) -> Self { 177 self.job_name = Some(job_name.to_string()); 178 self 179 } 180 n_pages(mut self, n_pages: i32) -> Self181 pub fn n_pages(mut self, n_pages: i32) -> Self { 182 self.n_pages = Some(n_pages); 183 self 184 } 185 print_settings(mut self, print_settings: &PrintSettings) -> Self186 pub fn print_settings(mut self, print_settings: &PrintSettings) -> Self { 187 self.print_settings = Some(print_settings.clone()); 188 self 189 } 190 show_progress(mut self, show_progress: bool) -> Self191 pub fn show_progress(mut self, show_progress: bool) -> Self { 192 self.show_progress = Some(show_progress); 193 self 194 } 195 support_selection(mut self, support_selection: bool) -> Self196 pub fn support_selection(mut self, support_selection: bool) -> Self { 197 self.support_selection = Some(support_selection); 198 self 199 } 200 track_print_status(mut self, track_print_status: bool) -> Self201 pub fn track_print_status(mut self, track_print_status: bool) -> Self { 202 self.track_print_status = Some(track_print_status); 203 self 204 } 205 unit(mut self, unit: Unit) -> Self206 pub fn unit(mut self, unit: Unit) -> Self { 207 self.unit = Some(unit); 208 self 209 } 210 use_full_page(mut self, use_full_page: bool) -> Self211 pub fn use_full_page(mut self, use_full_page: bool) -> Self { 212 self.use_full_page = Some(use_full_page); 213 self 214 } 215 } 216 217 pub const NONE_PRINT_OPERATION: Option<&PrintOperation> = None; 218 219 pub trait PrintOperationExt: 'static { 220 #[doc(alias = "gtk_print_operation_cancel")] cancel(&self)221 fn cancel(&self); 222 223 #[doc(alias = "gtk_print_operation_draw_page_finish")] draw_page_finish(&self)224 fn draw_page_finish(&self); 225 226 #[doc(alias = "gtk_print_operation_get_default_page_setup")] 227 #[doc(alias = "get_default_page_setup")] default_page_setup(&self) -> Option<PageSetup>228 fn default_page_setup(&self) -> Option<PageSetup>; 229 230 #[doc(alias = "gtk_print_operation_get_embed_page_setup")] 231 #[doc(alias = "get_embed_page_setup")] embeds_page_setup(&self) -> bool232 fn embeds_page_setup(&self) -> bool; 233 234 #[doc(alias = "gtk_print_operation_get_error")] 235 #[doc(alias = "get_error")] error(&self) -> Result<(), glib::Error>236 fn error(&self) -> Result<(), glib::Error>; 237 238 #[doc(alias = "gtk_print_operation_get_has_selection")] 239 #[doc(alias = "get_has_selection")] has_selection(&self) -> bool240 fn has_selection(&self) -> bool; 241 242 #[doc(alias = "gtk_print_operation_get_n_pages_to_print")] 243 #[doc(alias = "get_n_pages_to_print")] n_pages_to_print(&self) -> i32244 fn n_pages_to_print(&self) -> i32; 245 246 #[doc(alias = "gtk_print_operation_get_print_settings")] 247 #[doc(alias = "get_print_settings")] print_settings(&self) -> Option<PrintSettings>248 fn print_settings(&self) -> Option<PrintSettings>; 249 250 #[doc(alias = "gtk_print_operation_get_status")] 251 #[doc(alias = "get_status")] status(&self) -> PrintStatus252 fn status(&self) -> PrintStatus; 253 254 #[doc(alias = "gtk_print_operation_get_status_string")] 255 #[doc(alias = "get_status_string")] status_string(&self) -> Option<glib::GString>256 fn status_string(&self) -> Option<glib::GString>; 257 258 #[doc(alias = "gtk_print_operation_get_support_selection")] 259 #[doc(alias = "get_support_selection")] supports_selection(&self) -> bool260 fn supports_selection(&self) -> bool; 261 262 #[doc(alias = "gtk_print_operation_is_finished")] is_finished(&self) -> bool263 fn is_finished(&self) -> bool; 264 265 #[doc(alias = "gtk_print_operation_run")] run<P: IsA<Window>>( &self, action: PrintOperationAction, parent: Option<&P>, ) -> Result<PrintOperationResult, glib::Error>266 fn run<P: IsA<Window>>( 267 &self, 268 action: PrintOperationAction, 269 parent: Option<&P>, 270 ) -> Result<PrintOperationResult, glib::Error>; 271 272 #[doc(alias = "gtk_print_operation_set_allow_async")] set_allow_async(&self, allow_async: bool)273 fn set_allow_async(&self, allow_async: bool); 274 275 #[doc(alias = "gtk_print_operation_set_current_page")] set_current_page(&self, current_page: i32)276 fn set_current_page(&self, current_page: i32); 277 278 #[doc(alias = "gtk_print_operation_set_custom_tab_label")] set_custom_tab_label(&self, label: Option<&str>)279 fn set_custom_tab_label(&self, label: Option<&str>); 280 281 #[doc(alias = "gtk_print_operation_set_default_page_setup")] set_default_page_setup(&self, default_page_setup: Option<&PageSetup>)282 fn set_default_page_setup(&self, default_page_setup: Option<&PageSetup>); 283 284 #[doc(alias = "gtk_print_operation_set_defer_drawing")] set_defer_drawing(&self)285 fn set_defer_drawing(&self); 286 287 #[doc(alias = "gtk_print_operation_set_embed_page_setup")] set_embed_page_setup(&self, embed: bool)288 fn set_embed_page_setup(&self, embed: bool); 289 290 #[doc(alias = "gtk_print_operation_set_export_filename")] set_export_filename<P: AsRef<std::path::Path>>(&self, filename: P)291 fn set_export_filename<P: AsRef<std::path::Path>>(&self, filename: P); 292 293 #[doc(alias = "gtk_print_operation_set_has_selection")] set_has_selection(&self, has_selection: bool)294 fn set_has_selection(&self, has_selection: bool); 295 296 #[doc(alias = "gtk_print_operation_set_job_name")] set_job_name(&self, job_name: &str)297 fn set_job_name(&self, job_name: &str); 298 299 #[doc(alias = "gtk_print_operation_set_n_pages")] set_n_pages(&self, n_pages: i32)300 fn set_n_pages(&self, n_pages: i32); 301 302 #[doc(alias = "gtk_print_operation_set_print_settings")] set_print_settings(&self, print_settings: Option<&PrintSettings>)303 fn set_print_settings(&self, print_settings: Option<&PrintSettings>); 304 305 #[doc(alias = "gtk_print_operation_set_show_progress")] set_show_progress(&self, show_progress: bool)306 fn set_show_progress(&self, show_progress: bool); 307 308 #[doc(alias = "gtk_print_operation_set_support_selection")] set_support_selection(&self, support_selection: bool)309 fn set_support_selection(&self, support_selection: bool); 310 311 #[doc(alias = "gtk_print_operation_set_track_print_status")] set_track_print_status(&self, track_status: bool)312 fn set_track_print_status(&self, track_status: bool); 313 314 #[doc(alias = "gtk_print_operation_set_unit")] set_unit(&self, unit: Unit)315 fn set_unit(&self, unit: Unit); 316 317 #[doc(alias = "gtk_print_operation_set_use_full_page")] set_use_full_page(&self, full_page: bool)318 fn set_use_full_page(&self, full_page: bool); 319 320 #[doc(alias = "allow-async")] allows_async(&self) -> bool321 fn allows_async(&self) -> bool; 322 323 #[doc(alias = "current-page")] current_page(&self) -> i32324 fn current_page(&self) -> i32; 325 326 #[doc(alias = "custom-tab-label")] custom_tab_label(&self) -> Option<glib::GString>327 fn custom_tab_label(&self) -> Option<glib::GString>; 328 329 #[doc(alias = "export-filename")] export_filename(&self) -> Option<glib::GString>330 fn export_filename(&self) -> Option<glib::GString>; 331 332 #[doc(alias = "job-name")] job_name(&self) -> Option<glib::GString>333 fn job_name(&self) -> Option<glib::GString>; 334 335 #[doc(alias = "n-pages")] n_pages(&self) -> i32336 fn n_pages(&self) -> i32; 337 338 #[doc(alias = "show-progress")] shows_progress(&self) -> bool339 fn shows_progress(&self) -> bool; 340 341 #[doc(alias = "track-print-status")] tracks_print_status(&self) -> bool342 fn tracks_print_status(&self) -> bool; 343 unit(&self) -> Unit344 fn unit(&self) -> Unit; 345 346 #[doc(alias = "use-full-page")] uses_full_page(&self) -> bool347 fn uses_full_page(&self) -> bool; 348 349 #[doc(alias = "begin-print")] connect_begin_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId350 fn connect_begin_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId; 351 352 #[doc(alias = "create-custom-widget")] connect_create_custom_widget<F: Fn(&Self) -> glib::Object + 'static>( &self, f: F, ) -> SignalHandlerId353 fn connect_create_custom_widget<F: Fn(&Self) -> glib::Object + 'static>( 354 &self, 355 f: F, 356 ) -> SignalHandlerId; 357 358 #[doc(alias = "custom-widget-apply")] connect_custom_widget_apply<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId359 fn connect_custom_widget_apply<F: Fn(&Self, &Widget) + 'static>(&self, f: F) 360 -> SignalHandlerId; 361 362 #[doc(alias = "done")] connect_done<F: Fn(&Self, PrintOperationResult) + 'static>(&self, f: F) -> SignalHandlerId363 fn connect_done<F: Fn(&Self, PrintOperationResult) + 'static>(&self, f: F) -> SignalHandlerId; 364 365 #[doc(alias = "draw-page")] connect_draw_page<F: Fn(&Self, &PrintContext, i32) + 'static>( &self, f: F, ) -> SignalHandlerId366 fn connect_draw_page<F: Fn(&Self, &PrintContext, i32) + 'static>( 367 &self, 368 f: F, 369 ) -> SignalHandlerId; 370 371 #[doc(alias = "end-print")] connect_end_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId372 fn connect_end_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId; 373 374 #[doc(alias = "paginate")] connect_paginate<F: Fn(&Self, &PrintContext) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId375 fn connect_paginate<F: Fn(&Self, &PrintContext) -> bool + 'static>( 376 &self, 377 f: F, 378 ) -> SignalHandlerId; 379 380 #[doc(alias = "preview")] connect_preview< F: Fn(&Self, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static, >( &self, f: F, ) -> SignalHandlerId381 fn connect_preview< 382 F: Fn(&Self, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static, 383 >( 384 &self, 385 f: F, 386 ) -> SignalHandlerId; 387 388 #[doc(alias = "request-page-setup")] connect_request_page_setup<F: Fn(&Self, &PrintContext, i32, &PageSetup) + 'static>( &self, f: F, ) -> SignalHandlerId389 fn connect_request_page_setup<F: Fn(&Self, &PrintContext, i32, &PageSetup) + 'static>( 390 &self, 391 f: F, 392 ) -> SignalHandlerId; 393 394 #[doc(alias = "status-changed")] connect_status_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId395 fn connect_status_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 396 397 #[doc(alias = "update-custom-widget")] connect_update_custom_widget<F: Fn(&Self, &Widget, &PageSetup, &PrintSettings) + 'static>( &self, f: F, ) -> SignalHandlerId398 fn connect_update_custom_widget<F: Fn(&Self, &Widget, &PageSetup, &PrintSettings) + 'static>( 399 &self, 400 f: F, 401 ) -> SignalHandlerId; 402 403 #[doc(alias = "allow-async")] connect_allow_async_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId404 fn connect_allow_async_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 405 406 #[doc(alias = "current-page")] connect_current_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId407 fn connect_current_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 408 409 #[doc(alias = "custom-tab-label")] connect_custom_tab_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId410 fn connect_custom_tab_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 411 412 #[doc(alias = "default-page-setup")] connect_default_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId413 fn connect_default_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 414 415 #[doc(alias = "embed-page-setup")] connect_embed_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId416 fn connect_embed_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 417 418 #[doc(alias = "export-filename")] connect_export_filename_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId419 fn connect_export_filename_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 420 421 #[doc(alias = "has-selection")] connect_has_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId422 fn connect_has_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 423 424 #[doc(alias = "job-name")] connect_job_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId425 fn connect_job_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 426 427 #[doc(alias = "n-pages")] connect_n_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId428 fn connect_n_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 429 430 #[doc(alias = "n-pages-to-print")] connect_n_pages_to_print_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId431 fn connect_n_pages_to_print_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 432 433 #[doc(alias = "print-settings")] connect_print_settings_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId434 fn connect_print_settings_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 435 436 #[doc(alias = "show-progress")] connect_show_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId437 fn connect_show_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 438 439 #[doc(alias = "status")] connect_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId440 fn connect_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 441 442 #[doc(alias = "status-string")] connect_status_string_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId443 fn connect_status_string_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 444 445 #[doc(alias = "support-selection")] connect_support_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId446 fn connect_support_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 447 448 #[doc(alias = "track-print-status")] connect_track_print_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId449 fn connect_track_print_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 450 451 #[doc(alias = "unit")] connect_unit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId452 fn connect_unit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 453 454 #[doc(alias = "use-full-page")] connect_use_full_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId455 fn connect_use_full_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 456 } 457 458 impl<O: IsA<PrintOperation>> PrintOperationExt for O { cancel(&self)459 fn cancel(&self) { 460 unsafe { 461 ffi::gtk_print_operation_cancel(self.as_ref().to_glib_none().0); 462 } 463 } 464 draw_page_finish(&self)465 fn draw_page_finish(&self) { 466 unsafe { 467 ffi::gtk_print_operation_draw_page_finish(self.as_ref().to_glib_none().0); 468 } 469 } 470 default_page_setup(&self) -> Option<PageSetup>471 fn default_page_setup(&self) -> Option<PageSetup> { 472 unsafe { 473 from_glib_none(ffi::gtk_print_operation_get_default_page_setup( 474 self.as_ref().to_glib_none().0, 475 )) 476 } 477 } 478 embeds_page_setup(&self) -> bool479 fn embeds_page_setup(&self) -> bool { 480 unsafe { 481 from_glib(ffi::gtk_print_operation_get_embed_page_setup( 482 self.as_ref().to_glib_none().0, 483 )) 484 } 485 } 486 error(&self) -> Result<(), glib::Error>487 fn error(&self) -> Result<(), glib::Error> { 488 unsafe { 489 let mut error = ptr::null_mut(); 490 let _ = ffi::gtk_print_operation_get_error(self.as_ref().to_glib_none().0, &mut error); 491 if error.is_null() { 492 Ok(()) 493 } else { 494 Err(from_glib_full(error)) 495 } 496 } 497 } 498 has_selection(&self) -> bool499 fn has_selection(&self) -> bool { 500 unsafe { 501 from_glib(ffi::gtk_print_operation_get_has_selection( 502 self.as_ref().to_glib_none().0, 503 )) 504 } 505 } 506 n_pages_to_print(&self) -> i32507 fn n_pages_to_print(&self) -> i32 { 508 unsafe { ffi::gtk_print_operation_get_n_pages_to_print(self.as_ref().to_glib_none().0) } 509 } 510 print_settings(&self) -> Option<PrintSettings>511 fn print_settings(&self) -> Option<PrintSettings> { 512 unsafe { 513 from_glib_none(ffi::gtk_print_operation_get_print_settings( 514 self.as_ref().to_glib_none().0, 515 )) 516 } 517 } 518 status(&self) -> PrintStatus519 fn status(&self) -> PrintStatus { 520 unsafe { 521 from_glib(ffi::gtk_print_operation_get_status( 522 self.as_ref().to_glib_none().0, 523 )) 524 } 525 } 526 status_string(&self) -> Option<glib::GString>527 fn status_string(&self) -> Option<glib::GString> { 528 unsafe { 529 from_glib_none(ffi::gtk_print_operation_get_status_string( 530 self.as_ref().to_glib_none().0, 531 )) 532 } 533 } 534 supports_selection(&self) -> bool535 fn supports_selection(&self) -> bool { 536 unsafe { 537 from_glib(ffi::gtk_print_operation_get_support_selection( 538 self.as_ref().to_glib_none().0, 539 )) 540 } 541 } 542 is_finished(&self) -> bool543 fn is_finished(&self) -> bool { 544 unsafe { 545 from_glib(ffi::gtk_print_operation_is_finished( 546 self.as_ref().to_glib_none().0, 547 )) 548 } 549 } 550 run<P: IsA<Window>>( &self, action: PrintOperationAction, parent: Option<&P>, ) -> Result<PrintOperationResult, glib::Error>551 fn run<P: IsA<Window>>( 552 &self, 553 action: PrintOperationAction, 554 parent: Option<&P>, 555 ) -> Result<PrintOperationResult, glib::Error> { 556 unsafe { 557 let mut error = ptr::null_mut(); 558 let ret = ffi::gtk_print_operation_run( 559 self.as_ref().to_glib_none().0, 560 action.into_glib(), 561 parent.map(|p| p.as_ref()).to_glib_none().0, 562 &mut error, 563 ); 564 if error.is_null() { 565 Ok(from_glib(ret)) 566 } else { 567 Err(from_glib_full(error)) 568 } 569 } 570 } 571 set_allow_async(&self, allow_async: bool)572 fn set_allow_async(&self, allow_async: bool) { 573 unsafe { 574 ffi::gtk_print_operation_set_allow_async( 575 self.as_ref().to_glib_none().0, 576 allow_async.into_glib(), 577 ); 578 } 579 } 580 set_current_page(&self, current_page: i32)581 fn set_current_page(&self, current_page: i32) { 582 unsafe { 583 ffi::gtk_print_operation_set_current_page(self.as_ref().to_glib_none().0, current_page); 584 } 585 } 586 set_custom_tab_label(&self, label: Option<&str>)587 fn set_custom_tab_label(&self, label: Option<&str>) { 588 unsafe { 589 ffi::gtk_print_operation_set_custom_tab_label( 590 self.as_ref().to_glib_none().0, 591 label.to_glib_none().0, 592 ); 593 } 594 } 595 set_default_page_setup(&self, default_page_setup: Option<&PageSetup>)596 fn set_default_page_setup(&self, default_page_setup: Option<&PageSetup>) { 597 unsafe { 598 ffi::gtk_print_operation_set_default_page_setup( 599 self.as_ref().to_glib_none().0, 600 default_page_setup.to_glib_none().0, 601 ); 602 } 603 } 604 set_defer_drawing(&self)605 fn set_defer_drawing(&self) { 606 unsafe { 607 ffi::gtk_print_operation_set_defer_drawing(self.as_ref().to_glib_none().0); 608 } 609 } 610 set_embed_page_setup(&self, embed: bool)611 fn set_embed_page_setup(&self, embed: bool) { 612 unsafe { 613 ffi::gtk_print_operation_set_embed_page_setup( 614 self.as_ref().to_glib_none().0, 615 embed.into_glib(), 616 ); 617 } 618 } 619 set_export_filename<P: AsRef<std::path::Path>>(&self, filename: P)620 fn set_export_filename<P: AsRef<std::path::Path>>(&self, filename: P) { 621 unsafe { 622 ffi::gtk_print_operation_set_export_filename( 623 self.as_ref().to_glib_none().0, 624 filename.as_ref().to_glib_none().0, 625 ); 626 } 627 } 628 set_has_selection(&self, has_selection: bool)629 fn set_has_selection(&self, has_selection: bool) { 630 unsafe { 631 ffi::gtk_print_operation_set_has_selection( 632 self.as_ref().to_glib_none().0, 633 has_selection.into_glib(), 634 ); 635 } 636 } 637 set_job_name(&self, job_name: &str)638 fn set_job_name(&self, job_name: &str) { 639 unsafe { 640 ffi::gtk_print_operation_set_job_name( 641 self.as_ref().to_glib_none().0, 642 job_name.to_glib_none().0, 643 ); 644 } 645 } 646 set_n_pages(&self, n_pages: i32)647 fn set_n_pages(&self, n_pages: i32) { 648 unsafe { 649 ffi::gtk_print_operation_set_n_pages(self.as_ref().to_glib_none().0, n_pages); 650 } 651 } 652 set_print_settings(&self, print_settings: Option<&PrintSettings>)653 fn set_print_settings(&self, print_settings: Option<&PrintSettings>) { 654 unsafe { 655 ffi::gtk_print_operation_set_print_settings( 656 self.as_ref().to_glib_none().0, 657 print_settings.to_glib_none().0, 658 ); 659 } 660 } 661 set_show_progress(&self, show_progress: bool)662 fn set_show_progress(&self, show_progress: bool) { 663 unsafe { 664 ffi::gtk_print_operation_set_show_progress( 665 self.as_ref().to_glib_none().0, 666 show_progress.into_glib(), 667 ); 668 } 669 } 670 set_support_selection(&self, support_selection: bool)671 fn set_support_selection(&self, support_selection: bool) { 672 unsafe { 673 ffi::gtk_print_operation_set_support_selection( 674 self.as_ref().to_glib_none().0, 675 support_selection.into_glib(), 676 ); 677 } 678 } 679 set_track_print_status(&self, track_status: bool)680 fn set_track_print_status(&self, track_status: bool) { 681 unsafe { 682 ffi::gtk_print_operation_set_track_print_status( 683 self.as_ref().to_glib_none().0, 684 track_status.into_glib(), 685 ); 686 } 687 } 688 set_unit(&self, unit: Unit)689 fn set_unit(&self, unit: Unit) { 690 unsafe { 691 ffi::gtk_print_operation_set_unit(self.as_ref().to_glib_none().0, unit.into_glib()); 692 } 693 } 694 set_use_full_page(&self, full_page: bool)695 fn set_use_full_page(&self, full_page: bool) { 696 unsafe { 697 ffi::gtk_print_operation_set_use_full_page( 698 self.as_ref().to_glib_none().0, 699 full_page.into_glib(), 700 ); 701 } 702 } 703 allows_async(&self) -> bool704 fn allows_async(&self) -> bool { 705 unsafe { 706 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 707 glib::gobject_ffi::g_object_get_property( 708 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 709 b"allow-async\0".as_ptr() as *const _, 710 value.to_glib_none_mut().0, 711 ); 712 value 713 .get() 714 .expect("Return Value for property `allow-async` getter") 715 } 716 } 717 current_page(&self) -> i32718 fn current_page(&self) -> i32 { 719 unsafe { 720 let mut value = glib::Value::from_type(<i32 as StaticType>::static_type()); 721 glib::gobject_ffi::g_object_get_property( 722 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 723 b"current-page\0".as_ptr() as *const _, 724 value.to_glib_none_mut().0, 725 ); 726 value 727 .get() 728 .expect("Return Value for property `current-page` getter") 729 } 730 } 731 custom_tab_label(&self) -> Option<glib::GString>732 fn custom_tab_label(&self) -> Option<glib::GString> { 733 unsafe { 734 let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type()); 735 glib::gobject_ffi::g_object_get_property( 736 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 737 b"custom-tab-label\0".as_ptr() as *const _, 738 value.to_glib_none_mut().0, 739 ); 740 value 741 .get() 742 .expect("Return Value for property `custom-tab-label` getter") 743 } 744 } 745 export_filename(&self) -> Option<glib::GString>746 fn export_filename(&self) -> Option<glib::GString> { 747 unsafe { 748 let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type()); 749 glib::gobject_ffi::g_object_get_property( 750 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 751 b"export-filename\0".as_ptr() as *const _, 752 value.to_glib_none_mut().0, 753 ); 754 value 755 .get() 756 .expect("Return Value for property `export-filename` getter") 757 } 758 } 759 job_name(&self) -> Option<glib::GString>760 fn job_name(&self) -> Option<glib::GString> { 761 unsafe { 762 let mut value = glib::Value::from_type(<glib::GString as StaticType>::static_type()); 763 glib::gobject_ffi::g_object_get_property( 764 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 765 b"job-name\0".as_ptr() as *const _, 766 value.to_glib_none_mut().0, 767 ); 768 value 769 .get() 770 .expect("Return Value for property `job-name` getter") 771 } 772 } 773 n_pages(&self) -> i32774 fn n_pages(&self) -> i32 { 775 unsafe { 776 let mut value = glib::Value::from_type(<i32 as StaticType>::static_type()); 777 glib::gobject_ffi::g_object_get_property( 778 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 779 b"n-pages\0".as_ptr() as *const _, 780 value.to_glib_none_mut().0, 781 ); 782 value 783 .get() 784 .expect("Return Value for property `n-pages` getter") 785 } 786 } 787 shows_progress(&self) -> bool788 fn shows_progress(&self) -> bool { 789 unsafe { 790 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 791 glib::gobject_ffi::g_object_get_property( 792 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 793 b"show-progress\0".as_ptr() as *const _, 794 value.to_glib_none_mut().0, 795 ); 796 value 797 .get() 798 .expect("Return Value for property `show-progress` getter") 799 } 800 } 801 tracks_print_status(&self) -> bool802 fn tracks_print_status(&self) -> bool { 803 unsafe { 804 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 805 glib::gobject_ffi::g_object_get_property( 806 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 807 b"track-print-status\0".as_ptr() as *const _, 808 value.to_glib_none_mut().0, 809 ); 810 value 811 .get() 812 .expect("Return Value for property `track-print-status` getter") 813 } 814 } 815 unit(&self) -> Unit816 fn unit(&self) -> Unit { 817 unsafe { 818 let mut value = glib::Value::from_type(<Unit as StaticType>::static_type()); 819 glib::gobject_ffi::g_object_get_property( 820 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 821 b"unit\0".as_ptr() as *const _, 822 value.to_glib_none_mut().0, 823 ); 824 value 825 .get() 826 .expect("Return Value for property `unit` getter") 827 } 828 } 829 uses_full_page(&self) -> bool830 fn uses_full_page(&self) -> bool { 831 unsafe { 832 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 833 glib::gobject_ffi::g_object_get_property( 834 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 835 b"use-full-page\0".as_ptr() as *const _, 836 value.to_glib_none_mut().0, 837 ); 838 value 839 .get() 840 .expect("Return Value for property `use-full-page` getter") 841 } 842 } 843 connect_begin_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId844 fn connect_begin_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId { 845 unsafe extern "C" fn begin_print_trampoline< 846 P: IsA<PrintOperation>, 847 F: Fn(&P, &PrintContext) + 'static, 848 >( 849 this: *mut ffi::GtkPrintOperation, 850 context: *mut ffi::GtkPrintContext, 851 f: glib::ffi::gpointer, 852 ) { 853 let f: &F = &*(f as *const F); 854 f( 855 PrintOperation::from_glib_borrow(this).unsafe_cast_ref(), 856 &from_glib_borrow(context), 857 ) 858 } 859 unsafe { 860 let f: Box_<F> = Box_::new(f); 861 connect_raw( 862 self.as_ptr() as *mut _, 863 b"begin-print\0".as_ptr() as *const _, 864 Some(transmute::<_, unsafe extern "C" fn()>( 865 begin_print_trampoline::<Self, F> as *const (), 866 )), 867 Box_::into_raw(f), 868 ) 869 } 870 } 871 connect_create_custom_widget<F: Fn(&Self) -> glib::Object + 'static>( &self, f: F, ) -> SignalHandlerId872 fn connect_create_custom_widget<F: Fn(&Self) -> glib::Object + 'static>( 873 &self, 874 f: F, 875 ) -> SignalHandlerId { 876 unsafe extern "C" fn create_custom_widget_trampoline< 877 P: IsA<PrintOperation>, 878 F: Fn(&P) -> glib::Object + 'static, 879 >( 880 this: *mut ffi::GtkPrintOperation, 881 f: glib::ffi::gpointer, 882 ) -> *mut glib::gobject_ffi::GObject { 883 let f: &F = &*(f as *const F); 884 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) /*Not checked*/ 885 .to_glib_none() 886 .0 887 } 888 unsafe { 889 let f: Box_<F> = Box_::new(f); 890 connect_raw( 891 self.as_ptr() as *mut _, 892 b"create-custom-widget\0".as_ptr() as *const _, 893 Some(transmute::<_, unsafe extern "C" fn()>( 894 create_custom_widget_trampoline::<Self, F> as *const (), 895 )), 896 Box_::into_raw(f), 897 ) 898 } 899 } 900 connect_custom_widget_apply<F: Fn(&Self, &Widget) + 'static>( &self, f: F, ) -> SignalHandlerId901 fn connect_custom_widget_apply<F: Fn(&Self, &Widget) + 'static>( 902 &self, 903 f: F, 904 ) -> SignalHandlerId { 905 unsafe extern "C" fn custom_widget_apply_trampoline< 906 P: IsA<PrintOperation>, 907 F: Fn(&P, &Widget) + 'static, 908 >( 909 this: *mut ffi::GtkPrintOperation, 910 widget: *mut ffi::GtkWidget, 911 f: glib::ffi::gpointer, 912 ) { 913 let f: &F = &*(f as *const F); 914 f( 915 PrintOperation::from_glib_borrow(this).unsafe_cast_ref(), 916 &from_glib_borrow(widget), 917 ) 918 } 919 unsafe { 920 let f: Box_<F> = Box_::new(f); 921 connect_raw( 922 self.as_ptr() as *mut _, 923 b"custom-widget-apply\0".as_ptr() as *const _, 924 Some(transmute::<_, unsafe extern "C" fn()>( 925 custom_widget_apply_trampoline::<Self, F> as *const (), 926 )), 927 Box_::into_raw(f), 928 ) 929 } 930 } 931 connect_done<F: Fn(&Self, PrintOperationResult) + 'static>(&self, f: F) -> SignalHandlerId932 fn connect_done<F: Fn(&Self, PrintOperationResult) + 'static>(&self, f: F) -> SignalHandlerId { 933 unsafe extern "C" fn done_trampoline< 934 P: IsA<PrintOperation>, 935 F: Fn(&P, PrintOperationResult) + 'static, 936 >( 937 this: *mut ffi::GtkPrintOperation, 938 result: ffi::GtkPrintOperationResult, 939 f: glib::ffi::gpointer, 940 ) { 941 let f: &F = &*(f as *const F); 942 f( 943 PrintOperation::from_glib_borrow(this).unsafe_cast_ref(), 944 from_glib(result), 945 ) 946 } 947 unsafe { 948 let f: Box_<F> = Box_::new(f); 949 connect_raw( 950 self.as_ptr() as *mut _, 951 b"done\0".as_ptr() as *const _, 952 Some(transmute::<_, unsafe extern "C" fn()>( 953 done_trampoline::<Self, F> as *const (), 954 )), 955 Box_::into_raw(f), 956 ) 957 } 958 } 959 connect_draw_page<F: Fn(&Self, &PrintContext, i32) + 'static>( &self, f: F, ) -> SignalHandlerId960 fn connect_draw_page<F: Fn(&Self, &PrintContext, i32) + 'static>( 961 &self, 962 f: F, 963 ) -> SignalHandlerId { 964 unsafe extern "C" fn draw_page_trampoline< 965 P: IsA<PrintOperation>, 966 F: Fn(&P, &PrintContext, i32) + 'static, 967 >( 968 this: *mut ffi::GtkPrintOperation, 969 context: *mut ffi::GtkPrintContext, 970 page_nr: libc::c_int, 971 f: glib::ffi::gpointer, 972 ) { 973 let f: &F = &*(f as *const F); 974 f( 975 PrintOperation::from_glib_borrow(this).unsafe_cast_ref(), 976 &from_glib_borrow(context), 977 page_nr, 978 ) 979 } 980 unsafe { 981 let f: Box_<F> = Box_::new(f); 982 connect_raw( 983 self.as_ptr() as *mut _, 984 b"draw-page\0".as_ptr() as *const _, 985 Some(transmute::<_, unsafe extern "C" fn()>( 986 draw_page_trampoline::<Self, F> as *const (), 987 )), 988 Box_::into_raw(f), 989 ) 990 } 991 } 992 connect_end_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId993 fn connect_end_print<F: Fn(&Self, &PrintContext) + 'static>(&self, f: F) -> SignalHandlerId { 994 unsafe extern "C" fn end_print_trampoline< 995 P: IsA<PrintOperation>, 996 F: Fn(&P, &PrintContext) + 'static, 997 >( 998 this: *mut ffi::GtkPrintOperation, 999 context: *mut ffi::GtkPrintContext, 1000 f: glib::ffi::gpointer, 1001 ) { 1002 let f: &F = &*(f as *const F); 1003 f( 1004 PrintOperation::from_glib_borrow(this).unsafe_cast_ref(), 1005 &from_glib_borrow(context), 1006 ) 1007 } 1008 unsafe { 1009 let f: Box_<F> = Box_::new(f); 1010 connect_raw( 1011 self.as_ptr() as *mut _, 1012 b"end-print\0".as_ptr() as *const _, 1013 Some(transmute::<_, unsafe extern "C" fn()>( 1014 end_print_trampoline::<Self, F> as *const (), 1015 )), 1016 Box_::into_raw(f), 1017 ) 1018 } 1019 } 1020 connect_paginate<F: Fn(&Self, &PrintContext) -> bool + 'static>( &self, f: F, ) -> SignalHandlerId1021 fn connect_paginate<F: Fn(&Self, &PrintContext) -> bool + 'static>( 1022 &self, 1023 f: F, 1024 ) -> SignalHandlerId { 1025 unsafe extern "C" fn paginate_trampoline< 1026 P: IsA<PrintOperation>, 1027 F: Fn(&P, &PrintContext) -> bool + 'static, 1028 >( 1029 this: *mut ffi::GtkPrintOperation, 1030 context: *mut ffi::GtkPrintContext, 1031 f: glib::ffi::gpointer, 1032 ) -> glib::ffi::gboolean { 1033 let f: &F = &*(f as *const F); 1034 f( 1035 PrintOperation::from_glib_borrow(this).unsafe_cast_ref(), 1036 &from_glib_borrow(context), 1037 ) 1038 .into_glib() 1039 } 1040 unsafe { 1041 let f: Box_<F> = Box_::new(f); 1042 connect_raw( 1043 self.as_ptr() as *mut _, 1044 b"paginate\0".as_ptr() as *const _, 1045 Some(transmute::<_, unsafe extern "C" fn()>( 1046 paginate_trampoline::<Self, F> as *const (), 1047 )), 1048 Box_::into_raw(f), 1049 ) 1050 } 1051 } 1052 connect_preview< F: Fn(&Self, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static, >( &self, f: F, ) -> SignalHandlerId1053 fn connect_preview< 1054 F: Fn(&Self, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static, 1055 >( 1056 &self, 1057 f: F, 1058 ) -> SignalHandlerId { 1059 unsafe extern "C" fn preview_trampoline< 1060 P: IsA<PrintOperation>, 1061 F: Fn(&P, &PrintOperationPreview, &PrintContext, Option<&Window>) -> bool + 'static, 1062 >( 1063 this: *mut ffi::GtkPrintOperation, 1064 preview: *mut ffi::GtkPrintOperationPreview, 1065 context: *mut ffi::GtkPrintContext, 1066 parent: *mut ffi::GtkWindow, 1067 f: glib::ffi::gpointer, 1068 ) -> glib::ffi::gboolean { 1069 let f: &F = &*(f as *const F); 1070 f( 1071 PrintOperation::from_glib_borrow(this).unsafe_cast_ref(), 1072 &from_glib_borrow(preview), 1073 &from_glib_borrow(context), 1074 Option::<Window>::from_glib_borrow(parent).as_ref().as_ref(), 1075 ) 1076 .into_glib() 1077 } 1078 unsafe { 1079 let f: Box_<F> = Box_::new(f); 1080 connect_raw( 1081 self.as_ptr() as *mut _, 1082 b"preview\0".as_ptr() as *const _, 1083 Some(transmute::<_, unsafe extern "C" fn()>( 1084 preview_trampoline::<Self, F> as *const (), 1085 )), 1086 Box_::into_raw(f), 1087 ) 1088 } 1089 } 1090 connect_request_page_setup<F: Fn(&Self, &PrintContext, i32, &PageSetup) + 'static>( &self, f: F, ) -> SignalHandlerId1091 fn connect_request_page_setup<F: Fn(&Self, &PrintContext, i32, &PageSetup) + 'static>( 1092 &self, 1093 f: F, 1094 ) -> SignalHandlerId { 1095 unsafe extern "C" fn request_page_setup_trampoline< 1096 P: IsA<PrintOperation>, 1097 F: Fn(&P, &PrintContext, i32, &PageSetup) + 'static, 1098 >( 1099 this: *mut ffi::GtkPrintOperation, 1100 context: *mut ffi::GtkPrintContext, 1101 page_nr: libc::c_int, 1102 setup: *mut ffi::GtkPageSetup, 1103 f: glib::ffi::gpointer, 1104 ) { 1105 let f: &F = &*(f as *const F); 1106 f( 1107 PrintOperation::from_glib_borrow(this).unsafe_cast_ref(), 1108 &from_glib_borrow(context), 1109 page_nr, 1110 &from_glib_borrow(setup), 1111 ) 1112 } 1113 unsafe { 1114 let f: Box_<F> = Box_::new(f); 1115 connect_raw( 1116 self.as_ptr() as *mut _, 1117 b"request-page-setup\0".as_ptr() as *const _, 1118 Some(transmute::<_, unsafe extern "C" fn()>( 1119 request_page_setup_trampoline::<Self, F> as *const (), 1120 )), 1121 Box_::into_raw(f), 1122 ) 1123 } 1124 } 1125 connect_status_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1126 fn connect_status_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1127 unsafe extern "C" fn status_changed_trampoline< 1128 P: IsA<PrintOperation>, 1129 F: Fn(&P) + 'static, 1130 >( 1131 this: *mut ffi::GtkPrintOperation, 1132 f: glib::ffi::gpointer, 1133 ) { 1134 let f: &F = &*(f as *const F); 1135 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1136 } 1137 unsafe { 1138 let f: Box_<F> = Box_::new(f); 1139 connect_raw( 1140 self.as_ptr() as *mut _, 1141 b"status-changed\0".as_ptr() as *const _, 1142 Some(transmute::<_, unsafe extern "C" fn()>( 1143 status_changed_trampoline::<Self, F> as *const (), 1144 )), 1145 Box_::into_raw(f), 1146 ) 1147 } 1148 } 1149 connect_update_custom_widget<F: Fn(&Self, &Widget, &PageSetup, &PrintSettings) + 'static>( &self, f: F, ) -> SignalHandlerId1150 fn connect_update_custom_widget<F: Fn(&Self, &Widget, &PageSetup, &PrintSettings) + 'static>( 1151 &self, 1152 f: F, 1153 ) -> SignalHandlerId { 1154 unsafe extern "C" fn update_custom_widget_trampoline< 1155 P: IsA<PrintOperation>, 1156 F: Fn(&P, &Widget, &PageSetup, &PrintSettings) + 'static, 1157 >( 1158 this: *mut ffi::GtkPrintOperation, 1159 widget: *mut ffi::GtkWidget, 1160 setup: *mut ffi::GtkPageSetup, 1161 settings: *mut ffi::GtkPrintSettings, 1162 f: glib::ffi::gpointer, 1163 ) { 1164 let f: &F = &*(f as *const F); 1165 f( 1166 PrintOperation::from_glib_borrow(this).unsafe_cast_ref(), 1167 &from_glib_borrow(widget), 1168 &from_glib_borrow(setup), 1169 &from_glib_borrow(settings), 1170 ) 1171 } 1172 unsafe { 1173 let f: Box_<F> = Box_::new(f); 1174 connect_raw( 1175 self.as_ptr() as *mut _, 1176 b"update-custom-widget\0".as_ptr() as *const _, 1177 Some(transmute::<_, unsafe extern "C" fn()>( 1178 update_custom_widget_trampoline::<Self, F> as *const (), 1179 )), 1180 Box_::into_raw(f), 1181 ) 1182 } 1183 } 1184 connect_allow_async_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1185 fn connect_allow_async_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1186 unsafe extern "C" fn notify_allow_async_trampoline< 1187 P: IsA<PrintOperation>, 1188 F: Fn(&P) + 'static, 1189 >( 1190 this: *mut ffi::GtkPrintOperation, 1191 _param_spec: glib::ffi::gpointer, 1192 f: glib::ffi::gpointer, 1193 ) { 1194 let f: &F = &*(f as *const F); 1195 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1196 } 1197 unsafe { 1198 let f: Box_<F> = Box_::new(f); 1199 connect_raw( 1200 self.as_ptr() as *mut _, 1201 b"notify::allow-async\0".as_ptr() as *const _, 1202 Some(transmute::<_, unsafe extern "C" fn()>( 1203 notify_allow_async_trampoline::<Self, F> as *const (), 1204 )), 1205 Box_::into_raw(f), 1206 ) 1207 } 1208 } 1209 connect_current_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1210 fn connect_current_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1211 unsafe extern "C" fn notify_current_page_trampoline< 1212 P: IsA<PrintOperation>, 1213 F: Fn(&P) + 'static, 1214 >( 1215 this: *mut ffi::GtkPrintOperation, 1216 _param_spec: glib::ffi::gpointer, 1217 f: glib::ffi::gpointer, 1218 ) { 1219 let f: &F = &*(f as *const F); 1220 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1221 } 1222 unsafe { 1223 let f: Box_<F> = Box_::new(f); 1224 connect_raw( 1225 self.as_ptr() as *mut _, 1226 b"notify::current-page\0".as_ptr() as *const _, 1227 Some(transmute::<_, unsafe extern "C" fn()>( 1228 notify_current_page_trampoline::<Self, F> as *const (), 1229 )), 1230 Box_::into_raw(f), 1231 ) 1232 } 1233 } 1234 connect_custom_tab_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1235 fn connect_custom_tab_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1236 unsafe extern "C" fn notify_custom_tab_label_trampoline< 1237 P: IsA<PrintOperation>, 1238 F: Fn(&P) + 'static, 1239 >( 1240 this: *mut ffi::GtkPrintOperation, 1241 _param_spec: glib::ffi::gpointer, 1242 f: glib::ffi::gpointer, 1243 ) { 1244 let f: &F = &*(f as *const F); 1245 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1246 } 1247 unsafe { 1248 let f: Box_<F> = Box_::new(f); 1249 connect_raw( 1250 self.as_ptr() as *mut _, 1251 b"notify::custom-tab-label\0".as_ptr() as *const _, 1252 Some(transmute::<_, unsafe extern "C" fn()>( 1253 notify_custom_tab_label_trampoline::<Self, F> as *const (), 1254 )), 1255 Box_::into_raw(f), 1256 ) 1257 } 1258 } 1259 connect_default_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1260 fn connect_default_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1261 unsafe extern "C" fn notify_default_page_setup_trampoline< 1262 P: IsA<PrintOperation>, 1263 F: Fn(&P) + 'static, 1264 >( 1265 this: *mut ffi::GtkPrintOperation, 1266 _param_spec: glib::ffi::gpointer, 1267 f: glib::ffi::gpointer, 1268 ) { 1269 let f: &F = &*(f as *const F); 1270 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1271 } 1272 unsafe { 1273 let f: Box_<F> = Box_::new(f); 1274 connect_raw( 1275 self.as_ptr() as *mut _, 1276 b"notify::default-page-setup\0".as_ptr() as *const _, 1277 Some(transmute::<_, unsafe extern "C" fn()>( 1278 notify_default_page_setup_trampoline::<Self, F> as *const (), 1279 )), 1280 Box_::into_raw(f), 1281 ) 1282 } 1283 } 1284 connect_embed_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1285 fn connect_embed_page_setup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1286 unsafe extern "C" fn notify_embed_page_setup_trampoline< 1287 P: IsA<PrintOperation>, 1288 F: Fn(&P) + 'static, 1289 >( 1290 this: *mut ffi::GtkPrintOperation, 1291 _param_spec: glib::ffi::gpointer, 1292 f: glib::ffi::gpointer, 1293 ) { 1294 let f: &F = &*(f as *const F); 1295 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1296 } 1297 unsafe { 1298 let f: Box_<F> = Box_::new(f); 1299 connect_raw( 1300 self.as_ptr() as *mut _, 1301 b"notify::embed-page-setup\0".as_ptr() as *const _, 1302 Some(transmute::<_, unsafe extern "C" fn()>( 1303 notify_embed_page_setup_trampoline::<Self, F> as *const (), 1304 )), 1305 Box_::into_raw(f), 1306 ) 1307 } 1308 } 1309 connect_export_filename_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1310 fn connect_export_filename_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1311 unsafe extern "C" fn notify_export_filename_trampoline< 1312 P: IsA<PrintOperation>, 1313 F: Fn(&P) + 'static, 1314 >( 1315 this: *mut ffi::GtkPrintOperation, 1316 _param_spec: glib::ffi::gpointer, 1317 f: glib::ffi::gpointer, 1318 ) { 1319 let f: &F = &*(f as *const F); 1320 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1321 } 1322 unsafe { 1323 let f: Box_<F> = Box_::new(f); 1324 connect_raw( 1325 self.as_ptr() as *mut _, 1326 b"notify::export-filename\0".as_ptr() as *const _, 1327 Some(transmute::<_, unsafe extern "C" fn()>( 1328 notify_export_filename_trampoline::<Self, F> as *const (), 1329 )), 1330 Box_::into_raw(f), 1331 ) 1332 } 1333 } 1334 connect_has_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1335 fn connect_has_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1336 unsafe extern "C" fn notify_has_selection_trampoline< 1337 P: IsA<PrintOperation>, 1338 F: Fn(&P) + 'static, 1339 >( 1340 this: *mut ffi::GtkPrintOperation, 1341 _param_spec: glib::ffi::gpointer, 1342 f: glib::ffi::gpointer, 1343 ) { 1344 let f: &F = &*(f as *const F); 1345 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1346 } 1347 unsafe { 1348 let f: Box_<F> = Box_::new(f); 1349 connect_raw( 1350 self.as_ptr() as *mut _, 1351 b"notify::has-selection\0".as_ptr() as *const _, 1352 Some(transmute::<_, unsafe extern "C" fn()>( 1353 notify_has_selection_trampoline::<Self, F> as *const (), 1354 )), 1355 Box_::into_raw(f), 1356 ) 1357 } 1358 } 1359 connect_job_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1360 fn connect_job_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1361 unsafe extern "C" fn notify_job_name_trampoline< 1362 P: IsA<PrintOperation>, 1363 F: Fn(&P) + 'static, 1364 >( 1365 this: *mut ffi::GtkPrintOperation, 1366 _param_spec: glib::ffi::gpointer, 1367 f: glib::ffi::gpointer, 1368 ) { 1369 let f: &F = &*(f as *const F); 1370 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1371 } 1372 unsafe { 1373 let f: Box_<F> = Box_::new(f); 1374 connect_raw( 1375 self.as_ptr() as *mut _, 1376 b"notify::job-name\0".as_ptr() as *const _, 1377 Some(transmute::<_, unsafe extern "C" fn()>( 1378 notify_job_name_trampoline::<Self, F> as *const (), 1379 )), 1380 Box_::into_raw(f), 1381 ) 1382 } 1383 } 1384 connect_n_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1385 fn connect_n_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1386 unsafe extern "C" fn notify_n_pages_trampoline< 1387 P: IsA<PrintOperation>, 1388 F: Fn(&P) + 'static, 1389 >( 1390 this: *mut ffi::GtkPrintOperation, 1391 _param_spec: glib::ffi::gpointer, 1392 f: glib::ffi::gpointer, 1393 ) { 1394 let f: &F = &*(f as *const F); 1395 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1396 } 1397 unsafe { 1398 let f: Box_<F> = Box_::new(f); 1399 connect_raw( 1400 self.as_ptr() as *mut _, 1401 b"notify::n-pages\0".as_ptr() as *const _, 1402 Some(transmute::<_, unsafe extern "C" fn()>( 1403 notify_n_pages_trampoline::<Self, F> as *const (), 1404 )), 1405 Box_::into_raw(f), 1406 ) 1407 } 1408 } 1409 connect_n_pages_to_print_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1410 fn connect_n_pages_to_print_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1411 unsafe extern "C" fn notify_n_pages_to_print_trampoline< 1412 P: IsA<PrintOperation>, 1413 F: Fn(&P) + 'static, 1414 >( 1415 this: *mut ffi::GtkPrintOperation, 1416 _param_spec: glib::ffi::gpointer, 1417 f: glib::ffi::gpointer, 1418 ) { 1419 let f: &F = &*(f as *const F); 1420 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1421 } 1422 unsafe { 1423 let f: Box_<F> = Box_::new(f); 1424 connect_raw( 1425 self.as_ptr() as *mut _, 1426 b"notify::n-pages-to-print\0".as_ptr() as *const _, 1427 Some(transmute::<_, unsafe extern "C" fn()>( 1428 notify_n_pages_to_print_trampoline::<Self, F> as *const (), 1429 )), 1430 Box_::into_raw(f), 1431 ) 1432 } 1433 } 1434 connect_print_settings_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1435 fn connect_print_settings_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1436 unsafe extern "C" fn notify_print_settings_trampoline< 1437 P: IsA<PrintOperation>, 1438 F: Fn(&P) + 'static, 1439 >( 1440 this: *mut ffi::GtkPrintOperation, 1441 _param_spec: glib::ffi::gpointer, 1442 f: glib::ffi::gpointer, 1443 ) { 1444 let f: &F = &*(f as *const F); 1445 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1446 } 1447 unsafe { 1448 let f: Box_<F> = Box_::new(f); 1449 connect_raw( 1450 self.as_ptr() as *mut _, 1451 b"notify::print-settings\0".as_ptr() as *const _, 1452 Some(transmute::<_, unsafe extern "C" fn()>( 1453 notify_print_settings_trampoline::<Self, F> as *const (), 1454 )), 1455 Box_::into_raw(f), 1456 ) 1457 } 1458 } 1459 connect_show_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1460 fn connect_show_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1461 unsafe extern "C" fn notify_show_progress_trampoline< 1462 P: IsA<PrintOperation>, 1463 F: Fn(&P) + 'static, 1464 >( 1465 this: *mut ffi::GtkPrintOperation, 1466 _param_spec: glib::ffi::gpointer, 1467 f: glib::ffi::gpointer, 1468 ) { 1469 let f: &F = &*(f as *const F); 1470 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1471 } 1472 unsafe { 1473 let f: Box_<F> = Box_::new(f); 1474 connect_raw( 1475 self.as_ptr() as *mut _, 1476 b"notify::show-progress\0".as_ptr() as *const _, 1477 Some(transmute::<_, unsafe extern "C" fn()>( 1478 notify_show_progress_trampoline::<Self, F> as *const (), 1479 )), 1480 Box_::into_raw(f), 1481 ) 1482 } 1483 } 1484 connect_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1485 fn connect_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1486 unsafe extern "C" fn notify_status_trampoline< 1487 P: IsA<PrintOperation>, 1488 F: Fn(&P) + 'static, 1489 >( 1490 this: *mut ffi::GtkPrintOperation, 1491 _param_spec: glib::ffi::gpointer, 1492 f: glib::ffi::gpointer, 1493 ) { 1494 let f: &F = &*(f as *const F); 1495 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1496 } 1497 unsafe { 1498 let f: Box_<F> = Box_::new(f); 1499 connect_raw( 1500 self.as_ptr() as *mut _, 1501 b"notify::status\0".as_ptr() as *const _, 1502 Some(transmute::<_, unsafe extern "C" fn()>( 1503 notify_status_trampoline::<Self, F> as *const (), 1504 )), 1505 Box_::into_raw(f), 1506 ) 1507 } 1508 } 1509 connect_status_string_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1510 fn connect_status_string_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1511 unsafe extern "C" fn notify_status_string_trampoline< 1512 P: IsA<PrintOperation>, 1513 F: Fn(&P) + 'static, 1514 >( 1515 this: *mut ffi::GtkPrintOperation, 1516 _param_spec: glib::ffi::gpointer, 1517 f: glib::ffi::gpointer, 1518 ) { 1519 let f: &F = &*(f as *const F); 1520 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1521 } 1522 unsafe { 1523 let f: Box_<F> = Box_::new(f); 1524 connect_raw( 1525 self.as_ptr() as *mut _, 1526 b"notify::status-string\0".as_ptr() as *const _, 1527 Some(transmute::<_, unsafe extern "C" fn()>( 1528 notify_status_string_trampoline::<Self, F> as *const (), 1529 )), 1530 Box_::into_raw(f), 1531 ) 1532 } 1533 } 1534 connect_support_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1535 fn connect_support_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1536 unsafe extern "C" fn notify_support_selection_trampoline< 1537 P: IsA<PrintOperation>, 1538 F: Fn(&P) + 'static, 1539 >( 1540 this: *mut ffi::GtkPrintOperation, 1541 _param_spec: glib::ffi::gpointer, 1542 f: glib::ffi::gpointer, 1543 ) { 1544 let f: &F = &*(f as *const F); 1545 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1546 } 1547 unsafe { 1548 let f: Box_<F> = Box_::new(f); 1549 connect_raw( 1550 self.as_ptr() as *mut _, 1551 b"notify::support-selection\0".as_ptr() as *const _, 1552 Some(transmute::<_, unsafe extern "C" fn()>( 1553 notify_support_selection_trampoline::<Self, F> as *const (), 1554 )), 1555 Box_::into_raw(f), 1556 ) 1557 } 1558 } 1559 connect_track_print_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1560 fn connect_track_print_status_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1561 unsafe extern "C" fn notify_track_print_status_trampoline< 1562 P: IsA<PrintOperation>, 1563 F: Fn(&P) + 'static, 1564 >( 1565 this: *mut ffi::GtkPrintOperation, 1566 _param_spec: glib::ffi::gpointer, 1567 f: glib::ffi::gpointer, 1568 ) { 1569 let f: &F = &*(f as *const F); 1570 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1571 } 1572 unsafe { 1573 let f: Box_<F> = Box_::new(f); 1574 connect_raw( 1575 self.as_ptr() as *mut _, 1576 b"notify::track-print-status\0".as_ptr() as *const _, 1577 Some(transmute::<_, unsafe extern "C" fn()>( 1578 notify_track_print_status_trampoline::<Self, F> as *const (), 1579 )), 1580 Box_::into_raw(f), 1581 ) 1582 } 1583 } 1584 connect_unit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1585 fn connect_unit_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1586 unsafe extern "C" fn notify_unit_trampoline<P: IsA<PrintOperation>, F: Fn(&P) + 'static>( 1587 this: *mut ffi::GtkPrintOperation, 1588 _param_spec: glib::ffi::gpointer, 1589 f: glib::ffi::gpointer, 1590 ) { 1591 let f: &F = &*(f as *const F); 1592 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1593 } 1594 unsafe { 1595 let f: Box_<F> = Box_::new(f); 1596 connect_raw( 1597 self.as_ptr() as *mut _, 1598 b"notify::unit\0".as_ptr() as *const _, 1599 Some(transmute::<_, unsafe extern "C" fn()>( 1600 notify_unit_trampoline::<Self, F> as *const (), 1601 )), 1602 Box_::into_raw(f), 1603 ) 1604 } 1605 } 1606 connect_use_full_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1607 fn connect_use_full_page_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1608 unsafe extern "C" fn notify_use_full_page_trampoline< 1609 P: IsA<PrintOperation>, 1610 F: Fn(&P) + 'static, 1611 >( 1612 this: *mut ffi::GtkPrintOperation, 1613 _param_spec: glib::ffi::gpointer, 1614 f: glib::ffi::gpointer, 1615 ) { 1616 let f: &F = &*(f as *const F); 1617 f(PrintOperation::from_glib_borrow(this).unsafe_cast_ref()) 1618 } 1619 unsafe { 1620 let f: Box_<F> = Box_::new(f); 1621 connect_raw( 1622 self.as_ptr() as *mut _, 1623 b"notify::use-full-page\0".as_ptr() as *const _, 1624 Some(transmute::<_, unsafe extern "C" fn()>( 1625 notify_use_full_page_trampoline::<Self, F> as *const (), 1626 )), 1627 Box_::into_raw(f), 1628 ) 1629 } 1630 } 1631 } 1632 1633 impl fmt::Display for PrintOperation { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1634 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 1635 f.write_str("PrintOperation") 1636 } 1637 } 1638