[connections/wip/scale-mode: 3/3] vnc-connection, vnc-properties: Add scale mode setting
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [connections/wip/scale-mode: 3/3] vnc-connection, vnc-properties: Add scale mode setting
- Date: Wed, 12 May 2021 08:11:07 +0000 (UTC)
commit e1d1c9a11241806c1e88acf36c3500e07a7e3993
Author: Felipe Borges <felipeborges gnome org>
Date: Tue May 11 17:20:35 2021 +0200
vnc-connection, vnc-properties: Add scale mode setting
This allows the display to be resized to fit the window or to
expand to the remote's original size.
src/vnc-connection.vala | 17 +++++++++++++++++
src/vnc-properties-dialog.vala | 10 ++++++++++
2 files changed, 27 insertions(+)
---
diff --git a/src/vnc-connection.vala b/src/vnc-connection.vala
index bc4a586..1edcee4 100644
--- a/src/vnc-connection.vala
+++ b/src/vnc-connection.vala
@@ -81,6 +81,7 @@ namespace Connections {
public override int port { get; protected set; default = 5900; }
public string bandwidth { get; set; default = "hight-quality"; }
+ public string scale_mode { get; set; default = "fit-window"; }
construct {
display = new Vnc.Display ();
@@ -96,6 +97,8 @@ namespace Connections {
display.vnc_auth_credential.connect (on_vnc_auth_credential_cb);
display.vnc_auth_failure.connect (on_vnc_auth_failure_cb);
display.size_allocate.connect (scale);
+
+ notify["scale-mode"].connect (scale);
}
public VncConnection (string uuid) {
@@ -206,8 +209,22 @@ namespace Connections {
if (!display.is_open ())
return;
+ display.scaling = display.expand = false;
+
+ if (scale_mode == "original")
+ scale_to_original_size ();
+ else
+ scale_to_fit_window ();
+ }
+
+ private void scale_to_fit_window () {
display.scaling = display.hexpand = true;
display.width_request = display.height_request = 0;
}
+
+ private void scale_to_original_size () {
+ display.width_request = display.width;
+ display.height_request = display.height;
+ }
}
}
diff --git a/src/vnc-properties-dialog.vala b/src/vnc-properties-dialog.vala
index 6cf7af3..9a47b21 100644
--- a/src/vnc-properties-dialog.vala
+++ b/src/vnc-properties-dialog.vala
@@ -49,6 +49,16 @@ namespace Connections {
vnc.bandwidth = property_value;
});
add_property (bandwidth);
+
+ var scale_mode = new ComboProperty (vnc, "scale-mode", vnc.scale_mode) {
+ label = _("Scale mode")
+ };
+ scale_mode.add_option ("fit-window", _("Fit window"));
+ scale_mode.add_option ("original", _("Original size"));
+ scale_mode.changed.connect ((property_value) => {
+ vnc.scale_mode = property_value;
+ });
+ add_property (scale_mode);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]