Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 1 | /* |
Guillaume Roguez | 77c579d | 2018-01-30 15:54:02 -0500 | [diff] [blame] | 2 | * Copyright (C) 2015-2018 Savoir-faire Linux Inc. |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 3 | * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com> |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 4 | * Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com> |
| 5 | * Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com> |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 20 | */ |
| 21 | |
| 22 | #include "incomingcallview.h" |
| 23 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 24 | // Gtk |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 25 | #include <gtk/gtk.h> |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 26 | #include <QSize> |
| 27 | |
| 28 | // Lrc |
| 29 | #include <api/newcallmodel.h> |
| 30 | #include <api/contactmodel.h> |
| 31 | #include <api/conversationmodel.h> |
| 32 | #include <api/contact.h> |
Stepan Salenikovich | bbd6c13 | 2015-08-20 15:21:48 -0400 | [diff] [blame] | 33 | #include <globalinstances.h> |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 34 | |
| 35 | // Client |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 36 | #include "chatview.h" |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 37 | #include "native/pixbufmanipulator.h" |
| 38 | #include "utils/drawing.h" |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 39 | #include "utils/files.h" |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 40 | |
| 41 | struct _IncomingCallView |
| 42 | { |
| 43 | GtkBox parent; |
| 44 | }; |
| 45 | |
| 46 | struct _IncomingCallViewClass |
| 47 | { |
| 48 | GtkBoxClass parent_class; |
| 49 | }; |
| 50 | |
| 51 | typedef struct _IncomingCallViewPrivate IncomingCallViewPrivate; |
| 52 | |
| 53 | struct _IncomingCallViewPrivate |
| 54 | { |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 55 | GtkWidget *paned_call; |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 56 | GtkWidget *image_incoming; |
Stepan Salenikovich | 86e9168 | 2016-05-04 18:03:37 -0400 | [diff] [blame] | 57 | GtkWidget *label_name; |
Nicolas Jager | 2e467c3 | 2017-01-18 08:52:23 -0500 | [diff] [blame] | 58 | GtkWidget *label_bestId; |
Stepan Salenikovich | 9d51d53 | 2015-06-15 17:47:42 -0400 | [diff] [blame] | 59 | GtkWidget *spinner_status; |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 60 | GtkWidget *label_status; |
| 61 | GtkWidget *button_accept_incoming; |
| 62 | GtkWidget *button_reject_incoming; |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 63 | GtkWidget *frame_chat; |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 64 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 65 | // The webkit_chat_container is created once, then reused for all chat views |
aviau | 039001d | 2016-09-29 16:39:05 -0400 | [diff] [blame] | 66 | GtkWidget *webkit_chat_container; |
| 67 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 68 | lrc::api::conversation::Info* conversation_; |
| 69 | AccountContainer* accountContainer_; |
Stepan Salenikovich | 09e0b78 | 2016-09-07 16:28:50 -0400 | [diff] [blame] | 70 | |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 71 | QMetaObject::Connection state_change_connection; |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 72 | |
| 73 | GSettings *settings; |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | G_DEFINE_TYPE_WITH_PRIVATE(IncomingCallView, incoming_call_view, GTK_TYPE_BOX); |
| 77 | |
| 78 | #define INCOMING_CALL_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), INCOMING_CALL_VIEW_TYPE, IncomingCallViewPrivate)) |
| 79 | |
| 80 | static void |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 81 | incoming_call_view_dispose(GObject *object) |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 82 | { |
| 83 | IncomingCallView *view; |
| 84 | IncomingCallViewPrivate *priv; |
| 85 | |
| 86 | view = INCOMING_CALL_VIEW(object); |
| 87 | priv = INCOMING_CALL_VIEW_GET_PRIVATE(view); |
| 88 | |
| 89 | QObject::disconnect(priv->state_change_connection); |
| 90 | |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 91 | g_clear_object(&priv->settings); |
| 92 | |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 93 | G_OBJECT_CLASS(incoming_call_view_parent_class)->dispose(object); |
| 94 | } |
| 95 | |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 96 | static gboolean |
| 97 | map_boolean_to_orientation(GValue *value, GVariant *variant, G_GNUC_UNUSED gpointer user_data) |
| 98 | { |
| 99 | if (g_variant_is_of_type(variant, G_VARIANT_TYPE_BOOLEAN)) { |
| 100 | if (g_variant_get_boolean(variant)) { |
| 101 | // true, chat should be horizontal (to the right) |
| 102 | g_value_set_enum(value, GTK_ORIENTATION_HORIZONTAL); |
| 103 | } else { |
| 104 | // false, chat should be vertical (at the bottom) |
| 105 | g_value_set_enum(value, GTK_ORIENTATION_VERTICAL); |
| 106 | } |
| 107 | return TRUE; |
| 108 | } |
| 109 | return FALSE; |
| 110 | } |
| 111 | |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 112 | static void |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 113 | reject_incoming_call(G_GNUC_UNUSED GtkWidget *widget, ChatView *self) |
| 114 | { |
| 115 | auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(self); |
| 116 | priv->accountContainer_->info.callModel->hangUp(priv->conversation_->callId); |
| 117 | } |
| 118 | |
| 119 | static void |
| 120 | accept_incoming_call(G_GNUC_UNUSED GtkWidget *widget, ChatView *self) |
| 121 | { |
| 122 | auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(self); |
| 123 | auto contactUri = priv->conversation_->participants[0]; |
Guillaume Roguez | c209592 | 2017-12-14 14:07:10 -0500 | [diff] [blame] | 124 | try { |
| 125 | auto contact = priv->accountContainer_->info.contactModel->getContact(contactUri); |
| 126 | // If the contact is pending, we should accept its request |
| 127 | if (contact.profileInfo.type == lrc::api::profile::Type::PENDING) |
Nicolas Jager | ac6698c | 2018-01-17 14:32:35 -0500 | [diff] [blame] | 128 | priv->accountContainer_->info.conversationModel->makePermanent(priv->conversation_->uid); |
Guillaume Roguez | c209592 | 2017-12-14 14:07:10 -0500 | [diff] [blame] | 129 | // Accept call |
| 130 | priv->accountContainer_->info.callModel->accept(priv->conversation_->callId); |
| 131 | } catch (const std::out_of_range&) { |
| 132 | // ContactModel::getContact() exception |
| 133 | } |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | static void |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 137 | incoming_call_view_init(IncomingCallView *view) |
| 138 | { |
| 139 | gtk_widget_init_template(GTK_WIDGET(view)); |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 140 | |
AmarOk | e7c0297 | 2017-07-17 15:21:20 -0400 | [diff] [blame] | 141 | auto provider = gtk_css_provider_new(); |
| 142 | gtk_css_provider_load_from_data(provider, |
| 143 | ".flat-button { border: 0; border-radius: 50%; transition: all 0.3s ease; } \ |
| 144 | .red-button { background: #dc3a37; } \ |
| 145 | .green-button { background: #27ae60; } \ |
| 146 | .red-button:hover { background: #dc2719; } \ |
| 147 | .green-button:hover { background: #219d55; }", |
| 148 | -1, nullptr |
| 149 | ); |
| 150 | gtk_style_context_add_provider_for_screen(gdk_display_get_default_screen(gdk_display_get_default()), |
| 151 | GTK_STYLE_PROVIDER(provider), |
| 152 | GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); |
| 153 | |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 154 | auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(view); |
| 155 | |
| 156 | /* bind the chat orientation to the gsetting */ |
| 157 | priv->settings = g_settings_new_full(get_ring_schema(), NULL, NULL); |
| 158 | g_settings_bind_with_mapping(priv->settings, "chat-pane-horizontal", |
| 159 | priv->paned_call, "orientation", |
| 160 | G_SETTINGS_BIND_GET, |
| 161 | map_boolean_to_orientation, |
| 162 | nullptr, nullptr, nullptr); |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 163 | |
| 164 | g_signal_connect(priv->button_reject_incoming, "clicked", G_CALLBACK(reject_incoming_call), view); |
| 165 | g_signal_connect(priv->button_accept_incoming, "clicked", G_CALLBACK(accept_incoming_call), view); |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | static void |
| 169 | incoming_call_view_class_init(IncomingCallViewClass *klass) |
| 170 | { |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 171 | G_OBJECT_CLASS(klass)->dispose = incoming_call_view_dispose; |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 172 | |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 173 | gtk_widget_class_set_template_from_resource(GTK_WIDGET_CLASS (klass), |
| 174 | "/cx/ring/RingGnome/incomingcallview.ui"); |
| 175 | |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 176 | gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, paned_call); |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 177 | gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, image_incoming); |
Stepan Salenikovich | 86e9168 | 2016-05-04 18:03:37 -0400 | [diff] [blame] | 178 | gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, label_name); |
Nicolas Jager | 2e467c3 | 2017-01-18 08:52:23 -0500 | [diff] [blame] | 179 | gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, label_bestId); |
Stepan Salenikovich | 9d51d53 | 2015-06-15 17:47:42 -0400 | [diff] [blame] | 180 | gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, spinner_status); |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 181 | gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, label_status); |
| 182 | gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, button_accept_incoming); |
| 183 | gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, button_reject_incoming); |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 184 | gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), IncomingCallView, frame_chat); |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 185 | } |
| 186 | |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 187 | static void |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 188 | update_state(IncomingCallView *view) |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 189 | { |
| 190 | IncomingCallViewPrivate *priv = INCOMING_CALL_VIEW_GET_PRIVATE(view); |
| 191 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 192 | // change state label |
| 193 | auto callId = priv->conversation_->callId; |
| 194 | if (!priv->accountContainer_->info.callModel->hasCall(callId)) return; |
| 195 | auto call = priv->accountContainer_->info.callModel->getCall(callId); |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 196 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 197 | gchar *status = g_strdup_printf("%s", lrc::api::call::to_string(call.status).c_str()); |
Stepan Salenikovich | 7ec8fe8 | 2015-06-02 18:26:39 -0400 | [diff] [blame] | 198 | gtk_label_set_text(GTK_LABEL(priv->label_status), status); |
| 199 | g_free(status); |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 200 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 201 | if (call.status == lrc::api::call::Status::INCOMING_RINGING) |
| 202 | gtk_widget_show(priv->button_accept_incoming); |
| 203 | else |
| 204 | gtk_widget_hide(priv->button_accept_incoming); |
| 205 | gtk_widget_show(priv->button_reject_incoming); |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 206 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 207 | gtk_widget_show(priv->spinner_status); |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 208 | } |
| 209 | |
Stepan Salenikovich | 09e0b78 | 2016-09-07 16:28:50 -0400 | [diff] [blame] | 210 | static void |
Stepan Salenikovich | aa4ff43 | 2017-05-19 16:16:53 -0400 | [diff] [blame] | 211 | update_name_and_photo(IncomingCallView *view) |
| 212 | { |
| 213 | auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(view); |
Stepan Salenikovich | 6f68707 | 2015-03-26 10:43:37 -0400 | [diff] [blame] | 214 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 215 | QVariant var_i = GlobalInstances::pixmapManipulator().conversationPhoto( |
| 216 | *priv->conversation_, |
| 217 | priv->accountContainer_->info, |
| 218 | QSize(110, 110), |
| 219 | false |
| 220 | ); |
Stepan Salenikovich | 6f68707 | 2015-03-26 10:43:37 -0400 | [diff] [blame] | 221 | std::shared_ptr<GdkPixbuf> image = var_i.value<std::shared_ptr<GdkPixbuf>>(); |
| 222 | gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_incoming), image.get()); |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 223 | |
Guillaume Roguez | c209592 | 2017-12-14 14:07:10 -0500 | [diff] [blame] | 224 | try { |
| 225 | auto contactInfo = priv->accountContainer_->info.contactModel->getContact(priv->conversation_->participants.front()); |
Stepan Salenikovich | 86e9168 | 2016-05-04 18:03:37 -0400 | [diff] [blame] | 226 | |
Guillaume Roguez | c209592 | 2017-12-14 14:07:10 -0500 | [diff] [blame] | 227 | auto name = contactInfo.profileInfo.alias; |
| 228 | gtk_label_set_text(GTK_LABEL(priv->label_name), name.c_str()); |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 229 | |
Guillaume Roguez | c209592 | 2017-12-14 14:07:10 -0500 | [diff] [blame] | 230 | auto bestId = contactInfo.registeredName; |
| 231 | if (name != bestId) { |
| 232 | gtk_label_set_text(GTK_LABEL(priv->label_bestId), bestId.c_str()); |
| 233 | gtk_widget_show(priv->label_bestId); |
| 234 | } |
| 235 | } catch (const std::out_of_range&) { |
| 236 | // ContactModel::getContact() exception |
Stepan Salenikovich | 86e9168 | 2016-05-04 18:03:37 -0400 | [diff] [blame] | 237 | } |
Stepan Salenikovich | aa4ff43 | 2017-05-19 16:16:53 -0400 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | static void |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 241 | set_call_info(IncomingCallView *view) { |
Stepan Salenikovich | aa4ff43 | 2017-05-19 16:16:53 -0400 | [diff] [blame] | 242 | IncomingCallViewPrivate *priv = INCOMING_CALL_VIEW_GET_PRIVATE(view); |
| 243 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 244 | update_state(view); |
| 245 | update_name_and_photo(view); |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 246 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 247 | // Update view if call state changes |
Stepan Salenikovich | 297b5d1 | 2015-02-26 17:51:13 -0500 | [diff] [blame] | 248 | priv->state_change_connection = QObject::connect( |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 249 | &*priv->accountContainer_->info.callModel, |
| 250 | &lrc::api::NewCallModel::callStatusChanged, |
| 251 | [view, priv] (const std::string& callId) { |
| 252 | if (callId == priv->conversation_->callId) { |
| 253 | update_state(view); |
| 254 | update_name_and_photo(view); |
| 255 | } |
| 256 | }); |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 257 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 258 | auto chat_view = chat_view_new(WEBKIT_CHAT_CONTAINER(priv->webkit_chat_container), |
| 259 | priv->accountContainer_, |
| 260 | priv->conversation_); |
Stepan Salenikovich | daf3cb3 | 2016-10-12 16:39:42 -0400 | [diff] [blame] | 261 | gtk_widget_show(chat_view); |
| 262 | chat_view_set_header_visible(CHAT_VIEW(chat_view), FALSE); |
| 263 | gtk_container_add(GTK_CONTAINER(priv->frame_chat), chat_view); |
Stepan Salenikovich | 6977184 | 2015-02-24 18:11:45 -0500 | [diff] [blame] | 264 | } |
Stepan Salenikovich | 09e0b78 | 2016-09-07 16:28:50 -0400 | [diff] [blame] | 265 | |
| 266 | GtkWidget * |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 267 | incoming_call_view_new(WebKitChatContainer* view, |
| 268 | AccountContainer* accountContainer, |
| 269 | lrc::api::conversation::Info* conversation) |
Stepan Salenikovich | 09e0b78 | 2016-09-07 16:28:50 -0400 | [diff] [blame] | 270 | { |
| 271 | auto self = g_object_new(INCOMING_CALL_VIEW_TYPE, NULL); |
aviau | 039001d | 2016-09-29 16:39:05 -0400 | [diff] [blame] | 272 | |
| 273 | IncomingCallViewPrivate *priv = INCOMING_CALL_VIEW_GET_PRIVATE(self); |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 274 | priv->webkit_chat_container = GTK_WIDGET(view); |
| 275 | priv->conversation_ = conversation; |
| 276 | priv->accountContainer_ = accountContainer; |
aviau | 039001d | 2016-09-29 16:39:05 -0400 | [diff] [blame] | 277 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 278 | set_call_info(INCOMING_CALL_VIEW(self)); |
Stepan Salenikovich | 09e0b78 | 2016-09-07 16:28:50 -0400 | [diff] [blame] | 279 | |
| 280 | return GTK_WIDGET(self); |
| 281 | } |
| 282 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 283 | lrc::api::conversation::Info |
| 284 | incoming_call_view_get_conversation(IncomingCallView *self) |
Stepan Salenikovich | 09e0b78 | 2016-09-07 16:28:50 -0400 | [diff] [blame] | 285 | { |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 286 | g_return_val_if_fail(IS_INCOMING_CALL_VIEW(self), lrc::api::conversation::Info()); |
Stepan Salenikovich | 09e0b78 | 2016-09-07 16:28:50 -0400 | [diff] [blame] | 287 | auto priv = INCOMING_CALL_VIEW_GET_PRIVATE(self); |
| 288 | |
Sébastien Blin | 55bff9d | 2017-10-03 15:15:23 -0400 | [diff] [blame] | 289 | return *priv->conversation_; |
Stepan Salenikovich | 09e0b78 | 2016-09-07 16:28:50 -0400 | [diff] [blame] | 290 | } |