[connections/refactor-properties-instanciation: 1/4] vnc: Move VNC properties on its own file
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [connections/refactor-properties-instanciation: 1/4] vnc: Move VNC properties on its own file
- Date: Tue, 1 Dec 2020 17:42:11 +0000 (UTC)
commit 172188cbe1d7993293a2f3c9860071678b47e713
Author: Felipe Borges <felipeborges gnome org>
Date: Tue Dec 1 16:51:51 2020 +0100
vnc: Move VNC properties on its own file
src/meson.build | 1 +
src/vnc-connection.vala | 51 -----------------------------
src/vnc-properties-dialog.vala | 73 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 74 insertions(+), 51 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index 0570650..780e0b1 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -15,6 +15,7 @@ connections_sources = [
'thumbnailer.vala',
'topbar.vala',
'vnc-connection.vala',
+ 'vnc-properties-dialog.vala',
'window.vala',
]
diff --git a/src/vnc-connection.vala b/src/vnc-connection.vala
index 226059d..3cc8aea 100644
--- a/src/vnc-connection.vala
+++ b/src/vnc-connection.vala
@@ -276,57 +276,6 @@ namespace Connections {
}
}
- private class VncPropertiesDialog : PropertiesDialog {
- public VncPropertiesDialog (Connection connection) {
- this.connection = connection;
- var vnc = connection as VncConnection;
-
- var scaling = new Property () {
- label = _("Scaling"),
- widget = new Gtk.Switch () {
- active = connection.scaling
- }
- };
- scaling.widget.bind_property ("active", connection, "scaling", BindingFlags.SYNC_CREATE);
- connection.notify["scaling"].connect (() => { connection.save (); });
- add_property (scaling);
-
- var view_only = new Property () {
- label = _("View only"),
- widget = new Gtk.Switch () {
- active = vnc.view_only
- }
- };
- view_only.widget.bind_property ("active", vnc, "view_only", BindingFlags.SYNC_CREATE);
- vnc.notify["view-only"].connect (() => { vnc.save (); });
- add_property (view_only);
-
- var local_pointer = new Property () {
- label = _("Show local pointer"),
- widget = new Gtk.Switch () {
- active = vnc.show_local_pointer
- }
- };
- local_pointer.widget.bind_property ("active", vnc, "show_local_pointer",
BindingFlags.SYNC_CREATE);
- vnc.notify["show-local-pointer"].connect (() => { vnc.save (); });
- add_property (local_pointer);
-
- var combo_widget = new Gtk.ComboBoxText ();
- combo_widget.append ("high-quality", _("High quality"));
- combo_widget.append ("fast-refresh", _("Fast refresh"));
- combo_widget.active_id = vnc.bandwidth.to_string ();
- var bandwidth = new Property () {
- label = _("Bandwidth"),
- widget = combo_widget
- };
- combo_widget.notify["active-id"].connect (() => {
- vnc.bandwidth = vnc.bandwidth.from_string (combo_widget.active_id);
- });
- vnc.notify["bandwidth"].connect (() => { vnc.save (); });
- add_property (bandwidth);
- }
- }
-
private class VncConfig : ConnectionConfig {
public override void load () {
base.load ();
diff --git a/src/vnc-properties-dialog.vala b/src/vnc-properties-dialog.vala
new file mode 100644
index 0000000..415e8b1
--- /dev/null
+++ b/src/vnc-properties-dialog.vala
@@ -0,0 +1,73 @@
+/* vnc-properties-dialog.vala
+ *
+ * Copyright (C) Red Hat, Inc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Felipe Borges <felipeborges gnome org>
+ *
+ */
+
+namespace Connections {
+ private class VncPropertiesDialog : PropertiesDialog {
+ public VncPropertiesDialog (Connection connection) {
+ this.connection = connection;
+ var vnc = connection as VncConnection;
+
+ var scaling = new Property () {
+ label = _("Scaling"),
+ widget = new Gtk.Switch () {
+ active = connection.scaling
+ }
+ };
+ scaling.widget.bind_property ("active", connection, "scaling", BindingFlags.SYNC_CREATE);
+ connection.notify["scaling"].connect (() => { connection.save (); });
+ add_property (scaling);
+
+ var view_only = new Property () {
+ label = _("View only"),
+ widget = new Gtk.Switch () {
+ active = vnc.view_only
+ }
+ };
+ view_only.widget.bind_property ("active", vnc, "view_only", BindingFlags.SYNC_CREATE);
+ vnc.notify["view-only"].connect (() => { vnc.save (); });
+ add_property (view_only);
+
+ var local_pointer = new Property () {
+ label = _("Show local pointer"),
+ widget = new Gtk.Switch () {
+ active = vnc.show_local_pointer
+ }
+ };
+ local_pointer.widget.bind_property ("active", vnc, "show_local_pointer",
BindingFlags.SYNC_CREATE);
+ vnc.notify["show-local-pointer"].connect (() => { vnc.save (); });
+ add_property (local_pointer);
+
+ var combo_widget = new Gtk.ComboBoxText ();
+ combo_widget.append ("high-quality", _("High quality"));
+ combo_widget.append ("fast-refresh", _("Fast refresh"));
+ combo_widget.active_id = vnc.bandwidth.to_string ();
+ var bandwidth = new Property () {
+ label = _("Bandwidth"),
+ widget = combo_widget
+ };
+ combo_widget.notify["active-id"].connect (() => {
+ vnc.bandwidth = vnc.bandwidth.from_string (combo_widget.active_id);
+ });
+ vnc.notify["bandwidth"].connect (() => { vnc.save (); });
+ add_property (bandwidth);
+ }
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]