Commit d35feb24 authored by Hugo Lefeuvre's avatar Hugo Lefeuvre Committed by Sébastien Blin

conversationsview: fix call status updates

Make sure call status gets updated in the conversationsview when
callStatusUpdated() signal is emitted.

Also, fix usage of bad formatters in ringmainwindow logs.

Change-Id: I5e7a5fb1ae11973f37eafefa4a6badcbe3fb81a2
Gitlab: #913
Gitlab: #905Reviewed-by: Sébastien Blin's avatarSebastien Blin <sebastien.blin@savoirfairelinux.com>
parent 371da8f1
/****************************************************************************
* Copyright (C) 2017-2018 Savoir-faire Linux *
* Copyright (C) 2017-2018 Savoir-faire Linux *
* Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com> *
* Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> *
* *
......@@ -63,7 +63,7 @@ struct _ConversationsViewPrivate
QMetaObject::Connection modelSortedConnection_;
QMetaObject::Connection conversationUpdatedConnection_;
QMetaObject::Connection filterChangedConnection_;
QMetaObject::Connection callChangedConnection_;
};
G_DEFINE_TYPE_WITH_PRIVATE(ConversationsView, conversations_view, GTK_TYPE_TREE_VIEW);
......@@ -634,6 +634,27 @@ build_conversations_view(ConversationsView *self)
GTK_TREE_MODEL(model));
});
priv->callChangedConnection_ = QObject::connect(
&*(*priv->accountInfo_)->callModel,
&lrc::api::NewCallModel::callStatusChanged,
[self, priv] (const std::string& callId) {
// retrieve currently selected conversation
GtkTreeIter iter;
GtkTreeModel *model = nullptr;
gchar *conversationUid = nullptr;
auto selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
if (!gtk_tree_selection_get_selected(selection, &model, &iter)) return;
gtk_tree_model_get(model, &iter, 0, &conversationUid, -1);
// create updated model
auto new_model = create_and_fill_model(self);
gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(new_model));
// make sure conversation remains selected
conversations_view_select_conversation(self, conversationUid);
});
gtk_widget_show_all(GTK_WIDGET(self));
auto selectionNew = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
......@@ -674,6 +695,7 @@ conversations_view_dispose(GObject *object)
QObject::disconnect(priv->modelSortedConnection_);
QObject::disconnect(priv->conversationUpdatedConnection_);
QObject::disconnect(priv->filterChangedConnection_);
QObject::disconnect(priv->callChangedConnection_);
gtk_widget_destroy(priv->popupMenu_);
......
......@@ -1802,7 +1802,7 @@ CppImpl::slotCallStatusChanged(const std::string& callId)
ring_hide_notification(RING_NOTIFIER(widgets->notifier), notifId);
}
} catch (const std::exception& e) {
g_warning("Can't get call %lu for this account.", callId);
g_warning("Can't get call %s for this account.", callId.c_str());
}
}
......@@ -1843,7 +1843,7 @@ CppImpl::slotNewIncomingCall(const std::string& callId)
ring_show_notification(RING_NOTIFIER(widgets->notifier), avatar, uri, name, notifId, _("Incoming call"), body, NotificationType::CALL);
}
} catch (const std::exception& e) {
g_warning("Can't get call %lu for this account.", callId);
g_warning("Can't get call %s for this account.", callId.c_str());
}
}
......
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