330
const string SSH_USERNAME_KEY = "username";
331
const string SSH_SERVER_KEY = "server";
332
const string SSH_PORT_KEY = "port";
333
const string SSH_DIRECTORY_KEY = "directory";
335
// Once, we didn't use GIO, but had a special SSH backend for duplicity that
336
// would tell duplicity to use its own SSH handling. We convert those gsettings
337
// values to the new ones here.
338
void convert_ssh_to_file()
340
var settings = get_settings();
341
var backend = settings.get_string(BACKEND_KEY);
342
if (backend == "ssh") {
343
settings.set_string(BACKEND_KEY, "file");
344
var ssh_settings = get_settings("SSH");
345
var server = ssh_settings.get_string(SSH_SERVER_KEY);
346
if (server != null && server != "") {
347
var username = ssh_settings.get_string(SSH_USERNAME_KEY);
348
var port = ssh_settings.get_int(SSH_PORT_KEY);
349
var directory = ssh_settings.get_string(SSH_DIRECTORY_KEY);
351
var gio_uri = "ssh://";
352
if (username != null && username != "")
353
gio_uri += username + "@";
355
if (port > 0 && port != 22)
356
gio_uri += ":" + port.to_string();
357
if (directory == null || directory == "")
359
else if (directory[0] != '/')
360
gio_uri += "/" + directory;
362
gio_uri += directory;
364
var file_settings = get_settings(FILE_ROOT);
365
file_settings.set_string(FILE_PATH_KEY, gio_uri);
370
void convert_s3_folder_to_hostname()
372
// So historically, the default S3 folder was '/'. But in keeping with other
373
// cloud backends, the desire to use a hostname in the default folder would
374
// make one want to change that default. But since the user might not have
375
// actually changed the default, we don't want to upgrade the folder default
376
// in such a case. So we check here if the user has ever backed up before
377
// and if not (or not using S3), then we update the field.
378
var settings = get_settings();
379
var s3_settings = get_settings(S3_ROOT);
380
if ((s3_settings.get_string(S3_FOLDER_KEY) == "" ||
381
s3_settings.get_string(S3_FOLDER_KEY) == "/") &&
382
(Backend.get_default_type() != "s3" ||
383
settings.get_string(LAST_RUN_KEY) == "")) {
384
s3_settings.set_string(S3_FOLDER_KEY, "$HOSTNAME");
388
330
ToolPlugin tool = null;
389
331
void initialize_tool_plugin() throws Error
455
394
var language = Environment.get_variable("DEJA_DUP_LANGUAGE");
456
395
if (language != null && language != "")
457
396
Environment.set_variable("LANGUAGE", language, true);
397
Intl.setlocale(LocaleCategory.ALL, "");
458
398
Intl.textdomain(Config.GETTEXT_PACKAGE);
459
399
Intl.bindtextdomain(Config.GETTEXT_PACKAGE, localedir);
460
400
Intl.bind_textdomain_codeset(Config.GETTEXT_PACKAGE, "UTF-8");
525
public Secret.Schema get_passphrase_schema()
527
// Use freedesktop's schema id for historical reasons
528
return new Secret.Schema("org.freedesktop.Secret.Generic",
529
Secret.SchemaFlags.NONE,
530
"owner", Secret.SchemaAttributeType.STRING,
531
"type", Secret.SchemaAttributeType.STRING);
585
534
} // end namespace