currentcallview: fix Gtk warning and critical messages
- fix new-messages-displayed signal's name (new-interactions-displayed)
- call update_temporary on the correct object.
Change-Id: Id95637b4621f7e39842c9bca67a0c21629b8138c
diff --git a/src/currentcallview.cpp b/src/currentcallview.cpp
index a3e0fbf..3256032 100644
--- a/src/currentcallview.cpp
+++ b/src/currentcallview.cpp
@@ -84,6 +84,7 @@
GtkWidget *button_hangup;
GtkWidget *scalebutton_quality;
GtkWidget *checkbutton_autoquality;
+ GtkWidget *chat_view;
/* The webkit_chat_container is created once, then reused for all chat
* views */
@@ -864,11 +865,11 @@
priv->vbox_call_smartInfo);
// init chat view
- auto chat_view = chat_view_new(WEBKIT_CHAT_CONTAINER(priv->webkit_chat_container), priv->accountContainer_, priv->conversation_);
- gtk_container_add(GTK_CONTAINER(priv->frame_chat), chat_view);
+ priv->chat_view = chat_view_new(WEBKIT_CHAT_CONTAINER(priv->webkit_chat_container), priv->accountContainer_, priv->conversation_);
+ gtk_container_add(GTK_CONTAINER(priv->frame_chat), priv->chat_view);
- g_signal_connect_swapped(chat_view, "new-messages-displayed", G_CALLBACK(show_chat_view), view);
- chat_view_set_header_visible(CHAT_VIEW(chat_view), FALSE);
+ g_signal_connect_swapped(priv->chat_view, "new-interactions-displayed", G_CALLBACK(show_chat_view), view);
+ chat_view_set_header_visible(CHAT_VIEW(priv->chat_view), FALSE);
}
@@ -893,3 +894,11 @@
return *priv->conversation_;
}
+
+GtkWidget *
+current_call_view_get_chat_view(CurrentCallView *self)
+{
+ g_return_val_if_fail(IS_CURRENT_CALL_VIEW(self), nullptr);
+ auto priv = CURRENT_CALL_VIEW_GET_PRIVATE(self);
+ return priv->chat_view;
+}
diff --git a/src/currentcallview.h b/src/currentcallview.h
index 8315a89..cba14fd 100644
--- a/src/currentcallview.h
+++ b/src/currentcallview.h
@@ -53,5 +53,6 @@
AccountContainer* accountContainer,
lrc::api::conversation::Info* conversation);
lrc::api::conversation::Info current_call_view_get_conversation(CurrentCallView*);
+GtkWidget *current_call_view_get_chat_view(CurrentCallView*);
G_END_DECLS
diff --git a/src/ringmainwindow.cpp b/src/ringmainwindow.cpp
index 95df62e..e9d8e2a 100644
--- a/src/ringmainwindow.cpp
+++ b/src/ringmainwindow.cpp
@@ -259,9 +259,12 @@
try {
auto contactUri = priv->chatViewConversation_->participants.front();
auto contactInfo = priv->accountContainer_->info.contactModel->getContact(contactUri);
- chat_view_update_temporary(CHAT_VIEW(gtk_bin_get_child(GTK_BIN(priv->frame_call))),
- contactInfo.profileInfo.type == lrc::api::profile::Type::PENDING
- || contactInfo.profileInfo.type == lrc::api::profile::Type::TEMPORARY);
+ auto chat_view = current_call_view_get_chat_view(CURRENT_CALL_VIEW(new_view));
+ if (chat_view) {
+ chat_view_update_temporary(CHAT_VIEW(chat_view),
+ contactInfo.profileInfo.type == lrc::api::profile::Type::PENDING
+ || contactInfo.profileInfo.type == lrc::api::profile::Type::TEMPORARY);
+ }
} catch(...) { }
g_signal_connect_swapped(new_view, "video-double-clicked", G_CALLBACK(video_double_clicked), self);
} else if (g_type_is_a(CHAT_VIEW_TYPE, type)) {