[moserial] Save and restore input line ending from profile.
- From: Michael J. Chudobiak <mjc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [moserial] Save and restore input line ending from profile.
- Date: Sat, 16 Jan 2021 13:47:24 +0000 (UTC)
commit 51f0ece63743cfb73cef3234bc58ccef718b660f
Author: Mictronics <github mictronics de>
Date: Mon Apr 27 21:07:24 2020 +0200
Save and restore input line ending from profile.
src/MainWindow.vala | 7 ++++++-
src/Profile.vala | 12 ++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index 5c9c1db..396f593 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -298,7 +298,8 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
lineEndModeCombo = (ComboBox) builder.get_object ("termination_mode");
MoUtils.populateComboBox (lineEndModeCombo, SerialConnection.LineEndStrings);
- lineEndModeCombo.set_active (SerialConnection.LineEnd.CRLF);
+ lineEndModeCombo.set_active (profile.getInputLineEnd ());
+ lineEndModeCombo.changed.connect (lineEndChanged);
// setup recent chooser
recentData.groups = { recentGroup };
@@ -902,6 +903,10 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
}
}
+ private void lineEndChanged (ComboBox lineEndCombo) {
+ profile.setInputLineEnd (lineEndCombo.get_active ());
+ }
+
private void showHelpButton (ToolButton button) {
showHelp ();
}
diff --git a/src/Profile.vala b/src/Profile.vala
index 430564b..ade15c6 100644
--- a/src/Profile.vala
+++ b/src/Profile.vala
@@ -100,6 +100,18 @@ public class Profile : GLib.Object {
}
}
+ public void setInputLineEnd (int end) {
+ keyFile.set_integer ("window", "input_line_end", end);
+ }
+
+ public int getInputLineEnd () {
+ try {
+ return keyFile.get_integer ("window", "input_line_end");
+ } catch (GLib.KeyFileError e) {
+ return 0;
+ }
+ }
+
public bool load (string ? filename, Gtk.Window window) {
string f;
bool default_profile = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]