Commit 5912ad07 authored by Sébastien Blin's avatar Sébastien Blin

ringmainwindow: always display the combobox when creating a new account

Change-Id: Ie53419c624ecccbad7f6f0c3793ff13090a7fb35
Gitlab: #886Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 36425318
......@@ -1876,7 +1876,6 @@ build_settings_view(NewAccountSettingsView* view)
g_signal_connect(priv->entry_sip_username, "focus-out-event", G_CALLBACK(update_sip_username), view);
g_signal_connect(priv->entry_sip_password, "focus-out-event", G_CALLBACK(update_sip_password), view);
g_signal_connect(priv->entry_sip_proxy, "focus-out-event", G_CALLBACK(update_sip_proxy), view);
g_signal_connect(priv->entry_sip_password, "focus-out-event", G_CALLBACK(update_sip_password), view);
g_signal_connect_swapped(priv->button_export_account, "clicked", G_CALLBACK(choose_export_file), view);
g_signal_connect_swapped(priv->button_delete_account, "clicked", G_CALLBACK(remove_account), view);
g_signal_connect_swapped(priv->sip_button_delete_account, "clicked", G_CALLBACK(remove_account), view);
......
......@@ -282,7 +282,7 @@ public:
void leaveSettingsView();
void showAccountSelectorWidget(bool show = true);
std::size_t refreshAccountSelectorWidget(int selection_row = -1, bool show = true, const std::string& selected = "");
std::size_t refreshAccountSelectorWidget(int selection_row = -1, const std::string& selected = "");
WebKitChatContainer* webkitChatContainer() const;
......@@ -1150,20 +1150,15 @@ CppImpl::refreshPendingContactRequestTab()
void
CppImpl::showAccountSelectorWidget(bool show)
{
// we only want to show the account selector when there is more than 1 enabled
// account; so every time we want to show it, we should preform this check
std::size_t enabled_accounts = 0;
foreachLrcAccount(*lrc_, [&] (const auto&) { ++enabled_accounts; });
gtk_widget_set_visible(widgets->combobox_account_selector, show);
}
/// Update the account GtkComboBox from LRC data and select the given entry.
/// The widget visibility is changed depending on number of account found.
/// /note Default selection_row is -1, meaning no selection.
/// /note Default visibility mode is true, meaning showing the widget.
/// /note Default selected is "", meaning no forcing
std::size_t
CppImpl::refreshAccountSelectorWidget(int selection_row, bool show, const std::string& selected)
CppImpl::refreshAccountSelectorWidget(int selection_row, const std::string& selected)
{
auto store = gtk_list_store_new(6 /* # of cols */ ,
G_TYPE_STRING,
......@@ -1208,7 +1203,6 @@ CppImpl::refreshAccountSelectorWidget(int selection_row, bool show, const std::s
GTK_TREE_MODEL(store)
);
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->combobox_account_selector), selection_row);
gtk_widget_set_visible(widgets->combobox_account_selector, show);
return enabled_accounts;
}
......@@ -1481,15 +1475,13 @@ CppImpl::slotAccountAddedFromLrc(const std::string& id)
NEW_ACCOUNT_SETTINGS_VIEW_NAME);
}
}
refreshAccountSelectorWidget(currentIdx, id);
if (account_info.profileInfo.type == lrc::api::profile::Type::SIP) {
refreshAccountSelectorWidget(currentIdx, false, id);
enterSettingsView();
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widgets->radiobutton_new_account_settings), true);
} else {
refreshAccountSelectorWidget(currentIdx, true, id);
}
} catch (...) {
refreshAccountSelectorWidget(currentIdx, true, id);
refreshAccountSelectorWidget(currentIdx, id);
}
}
......
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