Commit 96f3d9ed authored by Michael Terry's avatar Michael Terry

When restoring, pay more attention to our temporary settings object.

https://bugs.launchpad.net/deja-dup/+bug/1804744
parent 9a109e5e
Pipeline #49169 passed with stage
in 6 minutes and 23 seconds
......@@ -83,8 +83,10 @@ public class AssistantRestore : AssistantOperation
void ensure_config_location()
{
label_sizes = new Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL);
config_location = new DejaDup.ConfigLocation(true, true, label_sizes);
if (config_location == null) {
label_sizes = new Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL);
config_location = new DejaDup.ConfigLocation(true, true, label_sizes);
}
}
Gtk.Widget make_backup_location_page()
......@@ -228,9 +230,10 @@ public class AssistantRestore : AssistantOperation
"column-spacing", 12,
"border-width", 12);
ensure_config_location();
label = new Gtk.Label(_("Backup location"));
label.set("xalign", 1.0f, "yalign", 0.0f);
w = new DejaDup.ConfigLabelLocation();
w = new DejaDup.ConfigLabelLocation(config_location);
w.set("hexpand", true);
page.attach(label, 0, rows, 1, 1);
page.attach(w, 1, rows, 1, 1);
......
......@@ -24,32 +24,19 @@ namespace DejaDup {
public class ConfigLabelLocation : ConfigLabel
{
Gtk.Image img;
FilteredSettings local_root;
FilteredSettings remote_root;
FilteredSettings drive_root;
FilteredSettings goa_root;
FilteredSettings s3_root;
FilteredSettings rackspace_root;
FilteredSettings openstack_root;
FilteredSettings gcs_root;
public ConfigLabelLocation()
public ConfigLocation location {get; construct;}
public ConfigLabelLocation(ConfigLocation location)
{
base(null);
Object(key: null, location: location);
}
construct {
img = new Gtk.Image.from_icon_name("folder", Gtk.IconSize.MENU);
fill_box();
watch_key(BACKEND_KEY);
watch_key(null, (local_root = DejaDup.get_settings(LOCAL_ROOT)));
watch_key(null, (remote_root = DejaDup.get_settings(REMOTE_ROOT)));
watch_key(null, (drive_root = DejaDup.get_settings(DRIVE_ROOT)));
watch_key(null, (goa_root = DejaDup.get_settings(GOA_ROOT)));
watch_key(null, (s3_root = DejaDup.get_settings(S3_ROOT)));
watch_key(null, (rackspace_root = DejaDup.get_settings(RACKSPACE_ROOT)));
watch_key(null, (openstack_root = DejaDup.get_settings(OPENSTACK_ROOT)));
watch_key(null, (gcs_root = DejaDup.get_settings(GCS_ROOT)));
foreach (var setting in location.get_all_settings()) {
watch_key(null, setting);
}
set_from_config.begin();
}
......@@ -71,7 +58,7 @@ public class ConfigLabelLocation : ConfigLabel
if (img == null)
return;
var backend = Backend.get_default();
var backend = location.get_backend();
string desc = backend.get_location_pretty();
if (desc == null)
......
......@@ -21,6 +21,16 @@ using GLib;
namespace DejaDup {
bool str_caseless_equal(string a, string b)
{
return str_equal(a.ascii_down(), b.ascii_down());
}
uint str_caseless_hash(string a)
{
return str_hash(a.ascii_down());
}
public class ConfigLocation : ConfigWidget
{
enum Col {
......@@ -98,7 +108,7 @@ public class ConfigLocation : ConfigWidget
accessible.set_name("Location");
}
all_settings = new HashTable<string, FilteredSettings>(str_hash, str_equal);
all_settings = new HashTable<string, FilteredSettings>(str_caseless_hash, str_caseless_equal);
string[] roots = {"", GOA_ROOT, REMOTE_ROOT, DRIVE_ROOT, LOCAL_ROOT,
S3_ROOT, GCS_ROOT, OPENSTACK_ROOT, RACKSPACE_ROOT};
foreach (string? root in roots) {
......@@ -637,6 +647,11 @@ public class ConfigLocation : ConfigWidget
var sub_settings = all_settings[type];
return Backend.get_for_type(type, sub_settings);
}
public List<unowned FilteredSettings> get_all_settings()
{
return all_settings.get_values();
}
}
}
......
......@@ -90,7 +90,7 @@ public abstract class Operation : Object
public async virtual void start()
{
action_desc_changed(_("Preparing…"));
action_desc_changed(_("Preparing…"));
yield check_dependencies();
if (!finished) // might have been cancelled during check above
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment