Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always have an config object #371

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/Core/Main.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3202,7 +3202,7 @@ public class Main : GLib.Object{
else{
// retain values for next run
config.set_string_member("backup_device_uuid", backup_uuid);
config.set_string_member("parent_device_uuid", backup_parent_uuid);
config.set_string_member("parent_device_uuid", backup_parent_uuid);
}

config.set_string_member("do_first_run", false.to_string());
Expand Down Expand Up @@ -3298,8 +3298,10 @@ public class Main : GLib.Object{
} catch (Error e) {
log_error (e.message);
}
var node = parser.get_root();
var config = node.get_object();
Json.Node? node = parser.get_root();

// make sure object is always set
Json.Object config = node?.get_object() ?? new Json.Object();

bool do_first_run = json_get_bool(config, "do_first_run", false); // false as default

Expand All @@ -3308,7 +3310,7 @@ public class Main : GLib.Object{
if (do_first_run){
set_first_run_flag();
}

if (config.has_member("include_btrfs_home")){
include_btrfs_home_for_backup = json_get_bool(config, "include_btrfs_home", include_btrfs_home_for_backup);
}
Expand All @@ -3325,7 +3327,7 @@ public class Main : GLib.Object{

backup_uuid = json_get_string(config,"backup_device_uuid", backup_uuid);
backup_parent_uuid = json_get_string(config,"parent_device_uuid", backup_parent_uuid);

this.schedule_monthly = json_get_bool(config,"schedule_monthly",schedule_monthly);
this.schedule_weekly = json_get_bool(config,"schedule_weekly",schedule_weekly);
this.schedule_daily = json_get_bool(config,"schedule_daily",schedule_daily);
Expand Down
Loading