Skip to content

Commit

Permalink
gtk: manually implement PrintSettings::set_page_ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
bilelmoussaoui committed Mar 23, 2021
1 parent 335ff84 commit c35b474
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gtk4/Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,7 @@ trust_return_value_nullability = false
nullable = false
[[object.function]]
name = "set_page_ranges"
ignore = true # TODO: implement me
manual = true # use &[&PageRange] instead of &[PageRange]
[[object.function]]
name = "set_paper_size"
[[object.function.parameter]]
Expand Down
1 change: 1 addition & 0 deletions gtk4/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ mod pad_action_entry;
mod pad_controller;
mod page_range;
mod print_job;
mod print_settings;
mod recent_data;
mod requisition;
mod response_type;
Expand Down
18 changes: 18 additions & 0 deletions gtk4/src/print_settings.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::{PageRange, PrintSettings};
use glib::translate::*;

impl PrintSettings {
#[doc(alias = "gtk_print_settings_set_page_ranges")]
pub fn set_page_ranges(&self, page_ranges: &[PageRange]) {
let num_ranges = page_ranges.len() as i32;
unsafe {
ffi::gtk_print_settings_set_page_ranges(
self.to_glib_none().0,
mut_override(page_ranges.to_glib_none().0),
num_ranges,
);
}
}
}

0 comments on commit c35b474

Please sign in to comment.