[connections/vnc-audio-support: 3/3] vnc, preferences: Expose setting for enabling/disabling audio




commit 7061eaca77b64e03b07391c88a1181f8cdaabebf
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Nov 1 10:49:46 2021 +0100

    vnc, preferences: Expose setting for enabling/disabling audio

 src/ui/vnc-preferences.ui       |  7 +++++++
 src/vnc-connection.vala         | 17 +++++++++++++++++
 src/vnc-preferences-window.vala |  3 +++
 3 files changed, 27 insertions(+)
---
diff --git a/src/ui/vnc-preferences.ui b/src/ui/vnc-preferences.ui
index 398c6fb..93c144e 100644
--- a/src/ui/vnc-preferences.ui
+++ b/src/ui/vnc-preferences.ui
@@ -75,6 +75,13 @@
                 </object>
               </child>
 
+              <child>
+                <object class="ConnectionsBooleanProperty" id="enable_audio">
+                  <property name="visible">True</property>
+                  <property name="title" translatable="yes">Enable audio</property>
+                </object>
+              </child>
+
               <child>
                 <object class="HdyActionRow">
                   <property name="activatable-widget">bandwidth_combo</property>
diff --git a/src/vnc-connection.vala b/src/vnc-connection.vala
index 3bc92fe..683bb49 100644
--- a/src/vnc-connection.vala
+++ b/src/vnc-connection.vala
@@ -80,6 +80,23 @@ namespace Connections {
             }
         }
 
+        private bool _enable_audio = true;
+        public bool enable_audio {
+            set {
+                var connection = display.get_connection ();
+                _enable_audio = value;
+
+                if (_enable_audio)
+                    connection.audio_enable ();
+                else
+                    connection.audio_disable ();
+            }
+
+            get {
+                return _enable_audio;
+            }
+        }
+
         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"; }
diff --git a/src/vnc-preferences-window.vala b/src/vnc-preferences-window.vala
index 5d816ee..d09ee16 100644
--- a/src/vnc-preferences-window.vala
+++ b/src/vnc-preferences-window.vala
@@ -33,6 +33,8 @@ namespace Connections {
         [GtkChild]
         private unowned BooleanProperty show_local_pointer;
         [GtkChild]
+        private unowned BooleanProperty enable_audio;
+        [GtkChild]
         private unowned Gtk.ComboBoxText bandwidth_combo;
         [GtkChild]
         private unowned Gtk.ComboBoxText scale_mode_combo;
@@ -44,6 +46,7 @@ namespace Connections {
             bind_widget_property (host_address_label, "label", "uri");
             bind_widget_property (scaling, "active", "scaling");
             bind_widget_property (view_only, "active", "view-only");
+            bind_widget_property (enable_audio, "active", "enable_audio");
             bind_widget_property (show_local_pointer, "active", "show-local-pointer");
             bind_widget_property (bandwidth_combo, "active_id", "bandwidth");
             bind_widget_property (scale_mode_combo, "active_id", "scale-mode");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]