Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit 67b273a

Browse files
authored
Merge pull request #689 from lucab/ups/gtk-print-operation-get-error
gtk: manually implement gtk_print_operation_get_error
2 parents f559e5f + f90cad7 commit 67b273a

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

gtk/Gir.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,6 +1772,10 @@ status = "generate"
17721772
name = "Gtk.PrintOperation"
17731773
status = "generate"
17741774
generate_builder = true
1775+
[[object.function]]
1776+
name = "get_error"
1777+
# It quacks like a fallible function, but it isn't.
1778+
ignore = true
17751779

17761780
[[object]]
17771781
name = "Gtk.PrintSettings"

gtk/src/auto/print_operation.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,6 @@ pub trait PrintOperationExt: 'static {
233233
#[doc(alias = "get_embed_page_setup")]
234234
fn embeds_page_setup(&self) -> bool;
235235

236-
#[doc(alias = "gtk_print_operation_get_error")]
237-
#[doc(alias = "get_error")]
238-
fn error(&self) -> Result<(), glib::Error>;
239-
240236
#[doc(alias = "gtk_print_operation_get_has_selection")]
241237
#[doc(alias = "get_has_selection")]
242238
fn has_selection(&self) -> bool;
@@ -486,18 +482,6 @@ impl<O: IsA<PrintOperation>> PrintOperationExt for O {
486482
}
487483
}
488484

489-
fn error(&self) -> Result<(), glib::Error> {
490-
unsafe {
491-
let mut error = ptr::null_mut();
492-
let _ = ffi::gtk_print_operation_get_error(self.as_ref().to_glib_none().0, &mut error);
493-
if error.is_null() {
494-
Ok(())
495-
} else {
496-
Err(from_glib_full(error))
497-
}
498-
}
499-
}
500-
501485
fn has_selection(&self) -> bool {
502486
unsafe {
503487
from_glib(ffi::gtk_print_operation_get_has_selection(

gtk/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ mod pad_action_entry;
9999
#[cfg(any(feature = "v3_22", feature = "dox"))]
100100
mod pad_controller;
101101
mod page_range;
102+
mod print_operation;
102103
mod print_settings;
103104
mod radio_button;
104105
mod radio_menu_item;

gtk/src/print_operation.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Take a look at the license at the top of the repository in the LICENSE file.
2+
3+
use crate::PrintOperation;
4+
use glib::translate::*;
5+
use std::ptr;
6+
7+
impl PrintOperation {
8+
#[doc(alias = "gtk_print_operation_get_error")]
9+
#[doc(alias = "get_error")]
10+
pub fn error(&self) -> Option<glib::Error> {
11+
unsafe {
12+
let mut error = ptr::null_mut();
13+
ffi::gtk_print_operation_get_error(self.to_glib_none().0, &mut error);
14+
if error.is_null() {
15+
None
16+
} else {
17+
Some(from_glib_full(error))
18+
}
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)