mirror of
https://github.com/alexkay/spek.git
synced 2026-11-22 03:06:44 +03:00
Add Preferences.save()
This commit is contained in:
1 parent
d772055446
commit
2cea640e33
2 files changed
+12
-6
No files matched your search
@@ -50,8 +50,7 @@ namespace Spek {
|
||||
}
|
||||
|
||||
~Preferences () {
|
||||
var output = FileStream.open (file_name, "w+");
|
||||
output.puts (key_file.to_data ());
|
||||
save ();
|
||||
}
|
||||
|
||||
private static Preferences _instance;
|
||||
@@ -64,6 +63,11 @@ namespace Spek {
|
||||
}
|
||||
}
|
||||
|
||||
public void save () {
|
||||
var output = FileStream.open (file_name, "w+");
|
||||
output.puts (key_file.to_data ());
|
||||
}
|
||||
|
||||
public bool check_update {
|
||||
get {
|
||||
try {
|
||||
|
||||
@@ -285,7 +285,8 @@ namespace Spek {
|
||||
|
||||
private void * check_version () {
|
||||
// Does the user want to check for updates?
|
||||
var check = Preferences.instance.check_update;
|
||||
var prefs = Preferences.instance;
|
||||
var check = prefs.check_update;
|
||||
if (!check) {
|
||||
return null;
|
||||
}
|
||||
@@ -295,7 +296,7 @@ namespace Spek {
|
||||
time_val.get_current_time ();
|
||||
Date today = Date ();
|
||||
today.set_time_val (time_val);
|
||||
int day = Preferences.instance.last_update;
|
||||
int day = prefs.last_update;
|
||||
int diff = (int) today.get_julian () - day;
|
||||
if (diff < 7) {
|
||||
return null;
|
||||
@@ -312,8 +313,9 @@ namespace Spek {
|
||||
}
|
||||
|
||||
// Update the preferences.
|
||||
Preferences.instance.check_update = check;
|
||||
Preferences.instance.last_update = (int) today.get_julian ();
|
||||
prefs.check_update = check;
|
||||
prefs.last_update = (int) today.get_julian ();
|
||||
prefs.save ();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user