[moserial] Save and restore outgoing input string from profile.
- From: Michael J. Chudobiak <mjc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [moserial] Save and restore outgoing input string from profile.
- Date: Sat, 16 Jan 2021 13:47:24 +0000 (UTC)
commit f524e06ea636c81b91309a5e1d4496c35278f9dd
Author: Mictronics <github mictronics de>
Date: Mon Apr 27 21:33:02 2020 +0200
Save and restore outgoing input string from profile.
data/ui/mainwindow.ui | 2 ++
src/MainWindow.vala | 11 +++++++----
src/Profile.vala | 12 ++++++++++++
3 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/data/ui/mainwindow.ui b/data/ui/mainwindow.ui
index e52fa2f..543f496 100644
--- a/data/ui/mainwindow.ui
+++ b/data/ui/mainwindow.ui
@@ -685,11 +685,13 @@
<object class="GtkBox" id="hbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">3</property>
<child>
<object class="GtkEntry" id="entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
+ <property name="max_length">512</property>
<property name="invisible_char">●</property>
<property name="primary_icon_activatable">False</property>
<property name="secondary_icon_activatable">False</property>
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index 396f593..1bae248 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -284,6 +284,7 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
sendButton.clicked.connect (sendString);
sendButton.set_tooltip_text (_("Send the outgoing data now."));
entry = (Gtk.Entry)builder.get_object ("entry");
+ entry.set_text (profile.getInputString ());
entry.activate.connect (sendString);
entry.set_tooltip_text (_("Type outgoing data here. Press Enter or Send to send it."));
@@ -474,12 +475,14 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
}
public void sendString (Widget w) {
-
- if (!ensureConnected ())
- return;
-
string s;
s = entry.get_text ();
+ profile.setInputString (s);
+ warning ("test");
+ if (!ensureConnected ()) {
+ return;
+ }
+
serialConnection.echoReference = s;
long len;
diff --git a/src/Profile.vala b/src/Profile.vala
index ade15c6..8cc5db7 100644
--- a/src/Profile.vala
+++ b/src/Profile.vala
@@ -112,6 +112,18 @@ public class Profile : GLib.Object {
}
}
+ public void setInputString (string s) {
+ keyFile.set_string ("window", "input_string", s);
+ }
+
+ public string getInputString () {
+ try {
+ return keyFile.get_string ("window", "input_string");
+ } catch (GLib.KeyFileError e) {
+ return "";
+ }
+ }
+
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]