diff --git a/src/ringmainwindow.cpp b/src/ringmainwindow.cpp index 916433790c0e9c0f3eb64ffc8669d511cea9a55f..7722a833b09dae98aac3ac2aaeb96e0d23edba70 100644 --- a/src/ringmainwindow.cpp +++ b/src/ringmainwindow.cpp @@ -329,6 +329,7 @@ public: QMetaObject::Connection newConversationConnection_; QMetaObject::Connection conversationRemovedConnection_; QMetaObject::Connection accountStatusChangedConnection_; + QMetaObject::Connection profileUpdatedConnection_; private: CppImpl() = delete; @@ -360,6 +361,7 @@ private: void slotNewInteraction(const std::string& accountId, const std::string& conversation, uint64_t, const lrc::api::interaction::Info& interaction); void slotCloseInteraction(const std::string& accountId, const std::string& conversation, uint64_t); + void slotProfileUpdated(const std::string& id); }; inline namespace gtk_callbacks @@ -944,6 +946,11 @@ CppImpl::init() accountStatusChangedConnection_ = QObject::connect(&lrc_->getAccountModel(), &lrc::api::NewAccountModel::accountStatusChanged, [this](const std::string& id){ slotAccountStatusChanged(id); }); + profileUpdatedConnection_ = QObject::connect(&lrc_->getAccountModel(), + &lrc::api::NewAccountModel::profileUpdated, + [this](const std::string& id){ + slotProfileUpdated(id); + }); newAccountConnection_ = QObject::connect(&lrc_->getAccountModel(), &lrc::api::NewAccountModel::accountAdded, [this](const std::string& id){ slotAccountAddedFromLrc(id); }); @@ -1156,6 +1163,7 @@ CppImpl::~CppImpl() QObject::disconnect(slotNewInteraction_); QObject::disconnect(slotReadInteraction_); QObject::disconnect(accountStatusChangedConnection_); + QObject::disconnect(profileUpdatedConnection_); g_clear_object(&widgets->welcome_view); g_clear_object(&widgets->webkit_chat_container); @@ -2076,6 +2084,15 @@ CppImpl::slotShowIncomingCallView(const std::string& id, lrc::api::conversation: changeView(INCOMING_CALL_VIEW_TYPE, origin); } +void +CppImpl::slotProfileUpdated(const std::string& id) +{ + auto currentIdx = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->combobox_account_selector)); + if (currentIdx == -1) + currentIdx = 0; // If no account selected, select the first account + refreshAccountSelectorWidget(currentIdx, id); +} + }} // namespace <anonymous>::details void