[moserial] Fix outgoing input field and send button are sensitive while port access mode is read-only.



commit eb7d9297e69aef0272508fb2f6efc46495ff754f
Author: Mictronics <github mictronics de>
Date:   Sun Apr 26 21:17:14 2020 +0200

    Fix outgoing input field and send button are sensitive while port access mode is read-only.

 src/MainWindow.vala | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index aa85f0e..5af08f9 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -343,6 +343,9 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
         outgoingClearButton.clicked.connect (clearOutgoing);
         outgoingClearButton.set_tooltip_text (_("Clear outgoing text box."));
 
+        //take currentSettings into account for outgoing input area
+        updateOutgoingInputArea();
+
         // load and apply preferences
         currentPreferences = Preferences.loadFromProfile (profile);
         updatePreferences (null, currentPreferences);
@@ -396,6 +399,7 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
             currentSettings = Settings.loadFromProfile (profile);
             currentPreferences = Preferences.loadFromProfile (profile);
             currentPaths = DefaultPaths.loadFromProfile (profile);
+            updateOutgoingInputArea();
             updatePreferences (null, currentPreferences);
             statusbar.pop (statusbarContext);
             statusbar.push (statusbarContext, currentSettings.getStatusbarString (false));
@@ -648,9 +652,20 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
         currentSettings = newSettings;
         statusbar.pop (statusbarContext);
         statusbar.push (statusbarContext, currentSettings.getStatusbarString (false));
+        updateOutgoingInputArea();
         profileChanged = true;
     }
 
+    private void updateOutgoingInputArea () {
+        if (currentSettings.accessMode == READONLY) {
+            entry.set_sensitive (false);
+            sendButton.set_sensitive (false);
+        } else {
+            entry.set_sensitive (true);
+            sendButton.set_sensitive (true);
+        }
+    }
+
     private void updatePreferences (PreferencesDialog ? d, Preferences newPreferences) {
         currentPreferences = newPreferences;
         string font;


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