228
228
settings.set_string(PROMPT_CHECK_KEY, cur_time_str);
231
public string get_trash_path()
233
return Path.build_filename(Environment.get_user_data_dir(), "Trash");
236
231
public string get_folder_key(SimpleSettings settings, string key)
238
233
string folder = settings.get_string(key);
248
public File? parse_dir(string dir)
252
s = Environment.get_home_dir();
253
else if (s == "$DESKTOP")
254
s = Environment.get_user_special_dir(UserDirectory.DESKTOP);
255
else if (s == "$DOCUMENTS")
256
s = Environment.get_user_special_dir(UserDirectory.DOCUMENTS);
257
else if (s == "$DOWNLOAD")
258
s = Environment.get_user_special_dir(UserDirectory.DOWNLOAD);
259
else if (s == "$MUSIC")
260
s = Environment.get_user_special_dir(UserDirectory.MUSIC);
261
else if (s == "$PICTURES")
262
s = Environment.get_user_special_dir(UserDirectory.PICTURES);
263
else if (s == "$PUBLIC_SHARE")
264
s = Environment.get_user_special_dir(UserDirectory.PUBLIC_SHARE);
265
else if (s == "$TEMPLATES")
266
s = Environment.get_user_special_dir(UserDirectory.TEMPLATES);
267
else if (s == "$TRASH")
268
s = get_trash_path();
269
else if (s == "$VIDEOS")
270
s = Environment.get_user_special_dir(UserDirectory.VIDEOS);
271
else if (Uri.parse_scheme(s) == null && !Path.is_absolute(s))
272
s = Path.build_filename(Environment.get_home_dir(), s);
274
return File.parse_name(s);
277
return File.new_for_path(s);
282
public File[] parse_dir_list(string*[] dirs)
284
File[] rv = new File[0];
286
foreach (string s in dirs) {
287
var f = parse_dir(s);
295
243
bool settings_read_only = false;
296
244
HashTable<string, SimpleSettings> settings_table = null;
297
245
public void set_settings_read_only(bool ro)
392
public bool meet_requirements(out string header, out string msg)
394
return DuplicityInfo.get_default().check_duplicity_version(out header, out msg);
340
ToolPlugin tool = null;
341
void initialize_tool_plugin() throws Error
343
var engine = new Peas.Engine ();
345
// For testing, we'll often point to in-tree tools
346
string search_path = Environment.get_variable("DEJA_DUP_TOOLS_PATH");
347
if (search_path == null || search_path == "")
348
search_path = Path.build_filename(Config.PKG_LIBEXEC_DIR, "tools");
349
engine.add_search_path(search_path, null);
351
var info = engine.get_plugin_info("libduplicity.so");
353
throw new SpawnError.FAILED(_("Could not find backup tool in %s. Your installation is incomplete.").printf(search_path));
354
if (!engine.try_load_plugin(info))
355
throw new SpawnError.FAILED(_("Could not load backup tool. Your installation is incomplete."));
357
var extset = new Peas.ExtensionSet(engine, typeof(Peas.Activatable));
358
var ext = extset.get_extension(info);
359
tool = ext as ToolPlugin;
361
throw new SpawnError.FAILED(_("Backup tool is broken. Your installation is incomplete."));
366
public ToolJob make_tool_job() throws Error
369
initialize_tool_plugin();
370
return tool.create_job();
397
373
public bool initialize(out string header, out string msg)
399
if (!meet_requirements(out header, out msg))
378
// Get tool plugin to use
380
initialize_tool_plugin();
383
header = _("Could not start backup tool");
402
388
convert_ssh_to_file();
403
389
convert_s3_folder_to_hostname();
431
417
// First try to get the DESCRIPTION. Else get the DISPLAY_NAME
433
var info = file.query_info(FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME + "," +
434
FILE_ATTRIBUTE_STANDARD_DESCRIPTION,
419
var info = file.query_info(FileAttribute.STANDARD_DISPLAY_NAME + "," +
420
FileAttribute.STANDARD_DESCRIPTION,
435
421
FileQueryInfoFlags.NONE, null);
436
if (info.has_attribute(FILE_ATTRIBUTE_STANDARD_DESCRIPTION))
437
return info.get_attribute_string(FILE_ATTRIBUTE_STANDARD_DESCRIPTION);
438
else if (info.has_attribute(FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME))
439
return info.get_attribute_string(FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
422
if (info.has_attribute(FileAttribute.STANDARD_DESCRIPTION))
423
return info.get_attribute_string(FileAttribute.STANDARD_DESCRIPTION);
424
else if (info.has_attribute(FileAttribute.STANDARD_DISPLAY_NAME))
425
return info.get_attribute_string(FileAttribute.STANDARD_DISPLAY_NAME);
441
427
catch (Error e) {}
492
478
// were backing up more than they were. This should help avoid such data
493
479
// loss accidents.
495
var info = yield f.query_info_async(FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
481
var info = yield f.query_info_async(FileAttribute.STANDARD_DISPLAY_NAME,
496
482
FileQueryInfoFlags.NOFOLLOW_SYMLINKS);
497
483
// Translators: this is the home folder and %s is the user's username
498
484
s = _("Home (%s)").printf(info.get_display_name());