Commit 0a0e3fe2 authored by Sébastien Blin's avatar Sébastien Blin

migration: fix migration wizard

Change-Id: Ib6ad97f78f0aeabfca8fb632c8c30dd8613a1ffd
parent a90c55b4
......@@ -67,6 +67,8 @@ struct _AccountMigrationViewPrivate
GtkWidget *button_migrate_account;
GtkWidget *ringid_row;
GtkWidget *button_delete_account;
GtkWidget *hbox_migrating_account_spinner;
};
G_DEFINE_TYPE_WITH_PRIVATE(AccountMigrationView, account_migration_view, GTK_TYPE_BOX);
......@@ -116,6 +118,7 @@ account_migration_view_class_init(AccountMigrationViewClass *klass)
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountMigrationView, button_migrate_account);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountMigrationView, ringid_row);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountMigrationView, button_delete_account);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), AccountMigrationView, hbox_migrating_account_spinner);
/* add signals */
account_migration_view_signals[ACCOUNT_MIGRATION_COMPLETED] = g_signal_new("account-migration-completed",
......@@ -147,10 +150,7 @@ migrate(AccountMigrationView *view)
&lrc::api::NewAccountModel::migrationEnded,
[=] (const std::string& accountId, bool ok)
{
if ((*priv->accountInfo_)->id != accountId) {
return;
}
gtk_widget_hide(priv->hbox_migrating_account_spinner);
if (ok) {
g_signal_emit(G_OBJECT(view), account_migration_view_signals[ACCOUNT_MIGRATION_COMPLETED], 0);
} else {
......@@ -162,6 +162,8 @@ migrate(AccountMigrationView *view)
currentProp.archivePassword = password;
(*priv->accountInfo_)->accountModel->setAccountConfig((*priv->accountInfo_)->id, currentProp);
gtk_entry_set_text(GTK_ENTRY(priv->entry_password), "");
gtk_widget_show_all(priv->hbox_migrating_account_spinner);
}
......@@ -244,6 +246,8 @@ build_migration_view(AccountMigrationView *view)
GtkStyleContext* context;
context = gtk_widget_get_style_context(GTK_WIDGET(priv->button_delete_account));
gtk_style_context_add_class(context, "button_red");
gtk_widget_hide(priv->hbox_migrating_account_spinner);
}
GtkWidget *
......
......@@ -838,14 +838,9 @@ on_handle_account_migrations(RingMainWindow* self)
}
priv->cpp->accountInfoForMigration_ = nullptr;
for (const auto& accountId : accounts) {
auto* accountInfo = &priv->cpp->lrc_->getAccountModel().getAccountInfo(accountId);
if (accountInfo->enabled) {
priv->cpp->updateLrc(accountId);
}
}
on_account_changed(self);
gtk_stack_set_visible_child_name(GTK_STACK(priv->stack_main_view), CALL_VIEW_NAME);
gtk_widget_show(priv->ring_settings);
priv->cpp->showAccountSelectorWidget();
}
enum class Action {
......@@ -1700,6 +1695,8 @@ CppImpl::enterAccountCreationWizard(bool showControls)
void
CppImpl::leaveAccountCreationWizard()
{
auto old_view = gtk_stack_get_visible_child(GTK_STACK(widgets->stack_main_view));
if(IS_ACCOUNT_MIGRATION_VIEW(old_view)) return;
if (show_settings) {
gtk_stack_set_visible_child(GTK_STACK(widgets->stack_main_view), widgets->last_settings_view);
gtk_widget_show(widgets->hbox_settings);
......
......@@ -31,6 +31,7 @@
<property name="label" translatable="yes">This account is malformed, please enter your password</property>
</object>
</child>
<!-- End Migrating account spinner -->
<child>
<object class="GtkFrame">
<property name="visible">True</property>
......@@ -194,11 +195,12 @@
<property name="halign">fill</property>
<property name="spacing">10</property>
<child>
<object class="GtkButton" id="button_migrate_account">
<property name="label" translatable="yes">Migrate account</property>
<object class="GtkButton" id="button_delete_account">
<property name="label" translatable="yes">Delete account</property>
<property name="image">image-remove-account</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="receives_default">True</property>
<property name="halign">fill</property>
</object>
<packing>
......@@ -208,12 +210,11 @@
</packing>
</child>
<child>
<object class="GtkButton" id="button_delete_account">
<property name="label" translatable="yes">Delete account</property>
<property name="image">image-remove-account</property>
<object class="GtkButton" id="button_migrate_account">
<property name="label" translatable="yes">Migrate account</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="receives_default">False</property>
<property name="halign">fill</property>
</object>
<packing>
......@@ -224,6 +225,32 @@
</child>
</object>
</child>
<!-- Migrating account spinner -->
<child>
<object class="GtkBox" id="hbox_migrating_account_spinner">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkSpinner" id="spinner_migrating_account">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="active">True</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="sensitive">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Migrating your Jami account…</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLabel" id="label_migration_error">
<property name="sensitive">False</property>
......
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