Commit 650c0db0 authored by Sébastien Blin's avatar Sébastien Blin

filetransfer: force migration to downloads/Jami path once

Change-Id: Ic2adb8834086db8c1370cdb2d5f638f6a7f86918
parent beba095e
......@@ -104,5 +104,10 @@
<summary>Accept files transfer with an inferior size in Mb</summary>
<description>Accept files transfer with an inferior size in Mb.</description>
</key>
<key name="migrated-from-homedir" type="b">
<default>false</default>
<summary>Just check if default directory for filetransfer was migrated</summary>
<description>Just check if default directory for filetransfer was migrated.</description>
</key>
</schema>
</schemalist>
......@@ -386,8 +386,18 @@ general_settings_view_init(GeneralSettingsView *self)
g_variant_get(download_directory_variant, "&s", &download_directory_value);
auto current_value = std::string(download_directory_value);
if (current_value.empty()) {
// First time Jami is opened
std::string default_download_dir = lrc::api::DataTransferModel::createDefaultDirectory().toStdString();
g_settings_set_value(priv->settings, "download-folder", g_variant_new("s", default_download_dir.c_str()));
g_settings_set_boolean(priv->settings, "migrated-from-homedir", true);
} else if (!g_settings_get_boolean(priv->settings, "migrated-from-homedir")) {
// Migrate from HOME directory to the new download directory
const auto* home_dir = g_get_home_dir ();
if (home_dir && current_value == home_dir) {
std::string default_download_dir = lrc::api::DataTransferModel::createDefaultDirectory().toStdString();
g_settings_set_value(priv->settings, "download-folder", g_variant_new("s", default_download_dir.c_str()));
}
g_settings_set_boolean(priv->settings, "migrated-from-homedir", true);
}
update_downloads_button_label(self);
......
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