[moserial] make profileChanged flag externally read-only
- From: Michael J. Chudobiak <mjc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [moserial] make profileChanged flag externally read-only
- Date: Fri, 22 Jan 2021 16:59:32 +0000 (UTC)
commit 36caca0fb088e6bd795bc9681d33cb81bdc397dc
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date: Fri Jan 22 11:59:16 2021 -0500
make profileChanged flag externally read-only
src/MainWindow.vala | 2 --
src/Profile.vala | 6 +++++-
2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index 152a1ee..af2ac7b 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -431,7 +431,6 @@ public class moserial.MainWindow : Gtk.Window // Have to extend Gtk.Winow to get
statusbar.pop (statusbarContext);
statusbar.push (statusbarContext, currentSettings.getStatusbarString (false));
setWindowTitle (null);
- profile.profileChanged = false;
RecentManager recentManager = RecentManager.get_default ();
try {
recentManager.add_full (GLib.Filename.to_uri (filename), recentData);
@@ -1118,7 +1117,6 @@ font-weight:
if (profileFilename == null)
return;
profile.save (profileFilename, gtkWindow);
- profile.profileChanged = false;
RecentManager recentManager = RecentManager.get_default ();
try {
recentManager.add_full (GLib.Filename.to_uri (profileFilename), recentData);
diff --git a/src/Profile.vala b/src/Profile.vala
index 9f4e91d..cd1213d 100644
--- a/src/Profile.vala
+++ b/src/Profile.vala
@@ -21,7 +21,7 @@ using Gtk;
public class Profile : GLib.Object
{
- public bool profileChanged = false;
+ public bool profileChanged {get; private set; default = false; }
private KeyFile keyFile;
construct {
@@ -98,12 +98,15 @@ public class Profile : GLib.Object
f = "%s/moserial.conf".printf (GLib.Environment.get_user_config_dir ());
} else
f = filename;
+
try {
keyFile.load_from_file (f, GLib.KeyFileFlags.NONE);
+ profileChanged = false;
return true;
} catch (GLib.KeyFileError e) {
stdout.printf ("%s\n", e.message);
/* try loading the non-broken parts of the profile - return true */
+ profileChanged = false;
return true;
} catch (GLib.FileError e) {
if (!default_profile) {
@@ -147,5 +150,6 @@ public class Profile : GLib.Object
errorDialog.destroy ();
}
}
+ profileChanged = false;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]