From 8deb778cb33dacc594ed65576c527e764a2116a5 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Sun, 19 Jan 2025 17:49:21 +0100 Subject: [PATCH 1/3] desktop/print: Fix PageSetup fields names --- src/desktop/print.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/desktop/print.rs b/src/desktop/print.rs index e0d309f28..903e90eb1 100644 --- a/src/desktop/print.rs +++ b/src/desktop/print.rs @@ -461,22 +461,31 @@ pub struct PageSetup { #[zvariant(rename = "PPDName")] pub ppdname: Option, /// The name of the page setup. + #[zvariant(rename = "Name")] pub name: Option, /// The user-visible name of the page setup. + #[zvariant(rename = "DisplayName")] pub display_name: Option, /// Paper width in millimeters. + #[zvariant(rename = "Width")] pub width: Option, /// Paper height in millimeters. + #[zvariant(rename = "Height")] pub height: Option, /// Top margin in millimeters. + #[zvariant(rename = "MarginTop")] pub margin_top: Option, /// Bottom margin in millimeters. + #[zvariant(rename = "MarginBottom")] pub margin_bottom: Option, /// Right margin in millimeters. + #[zvariant(rename = "MarginRight")] pub margin_right: Option, /// Left margin in millimeters. + #[zvariant(rename = "MarginLeft")] pub margin_left: Option, /// The page orientation. + #[zvariant(rename = "Orientation")] pub orientation: Option, } From 18bb50aaee9fcd30d06ffc77d50ca93ec8923e24 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Sun, 19 Jan 2025 17:51:23 +0100 Subject: [PATCH 2/3] desktop/print: Mark use-color as a String No idea why it is a string... --- src/desktop/print.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/desktop/print.rs b/src/desktop/print.rs index 903e90eb1..c78a833a2 100644 --- a/src/desktop/print.rs +++ b/src/desktop/print.rs @@ -196,7 +196,7 @@ pub struct Settings { pub resolution: Option, /// Whether to use color. #[zvariant(rename = "use-color")] - pub use_color: Option, + pub use_color: Option, /// Duplex printing mode, one of simplex, horizontal or vertical. pub duplex: Option, /// Whether to collate copies. @@ -311,7 +311,12 @@ impl Settings { /// Sets whether to use color. #[must_use] pub fn use_color(mut self, use_color: impl Into>) -> Self { - self.use_color = use_color.into(); + let use_color = use_color.into().unwrap_or_default(); + if use_color { + self.use_color = Some("yes".to_owned()); + } else { + self.use_color = Some("no".to_owned()) + }; self } From c2db6ea8be3e3640c95115fa4da1130724c31aab Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Sun, 19 Jan 2025 17:52:54 +0100 Subject: [PATCH 3/3] desktop/print: Use boolean externally for collate/reverse No idea why they are strings... --- src/desktop/print.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/desktop/print.rs b/src/desktop/print.rs index c78a833a2..d5751dd1c 100644 --- a/src/desktop/print.rs +++ b/src/desktop/print.rs @@ -329,15 +329,25 @@ impl Settings { /// Whether to collate copies. #[must_use] - pub fn collate<'a>(mut self, collate: impl Into>) -> Self { - self.collate = collate.into().map(ToOwned::to_owned); + pub fn collate(mut self, collate: impl Into>) -> Self { + let collate = collate.into().unwrap_or_default(); + if collate { + self.collate = Some("yes".to_owned()); + } else { + self.collate = Some("no".to_owned()) + }; self } /// Sets whether to reverse the order of the printed pages. #[must_use] - pub fn reverse<'a>(mut self, reverse: impl Into>) -> Self { - self.reverse = reverse.into().map(ToOwned::to_owned); + pub fn reverse(mut self, reverse: impl Into>) -> Self { + let reverse = reverse.into().unwrap_or_default(); + if reverse { + self.reverse = Some("yes".to_owned()); + } else { + self.reverse = Some("no".to_owned()) + }; self }