diff --git a/src/accountgeneraltab.cpp b/src/accountgeneraltab.cpp index a00c0158307db98e6361295858498308fb4e7e40..64ceeb413fe0be215692d113121094d90be33ee1 100644 --- a/src/accountgeneraltab.cpp +++ b/src/accountgeneraltab.cpp @@ -28,7 +28,6 @@ #include "utils/models.h" #include "usernameregistrationbox.h" -#include <iostream> #include <api/newdevicemodel.h> #include <api/newaccountmodel.h> diff --git a/src/accountmigrationview.cpp b/src/accountmigrationview.cpp index 7f050fe46d4ff21268c04b718f1820be2f14f7c4..26e89b144f2194d9df1e5ade3239b2326e85c564 100644 --- a/src/accountmigrationview.cpp +++ b/src/accountmigrationview.cpp @@ -26,7 +26,8 @@ // Qt #include <QSize> -#include <iostream> +// std +#include <memory> // for std::shared_ptr // LRC #include <api/newaccountmodel.h> @@ -205,8 +206,9 @@ build_migration_view(AccountMigrationView *view) g_signal_connect_swapped(priv->entry_password, "activate", G_CALLBACK(migrate), view); gtk_label_set_text(GTK_LABEL(priv->label_account_alias), (*priv->accountInfo_)->profileInfo.alias.c_str()); + // display the ringID (without "ring:") - std::cout << "MIGRATE FOR " << (*priv->accountInfo_)->id << std::endl; + g_debug("MIGRATE FOR %s", (*priv->accountInfo_)->id.c_str()); std::string username = (*priv->accountInfo_)->profileInfo.uri; if (username.empty()) { username = (*priv->accountInfo_)->profileInfo.uri; diff --git a/src/currentcallview.cpp b/src/currentcallview.cpp index 578761e2b1e3d381c47025d74496fbb12d549738..e95d9de8dd1642e3d272e3b8538da06a945b7f74 100644 --- a/src/currentcallview.cpp +++ b/src/currentcallview.cpp @@ -42,7 +42,9 @@ #include "utils/files.h" #include "video/video_widget.h" -#include <iostream> +// std +#include <memory> // for std::shared_ptr +#include <string> namespace { namespace details { diff --git a/src/newaccountsettingsview.cpp b/src/newaccountsettingsview.cpp index 79e32411de1917982aef472826978a8d44a13c46..bfbafdd2471093046677d1d9f4e009d9592ec591 100644 --- a/src/newaccountsettingsview.cpp +++ b/src/newaccountsettingsview.cpp @@ -861,19 +861,19 @@ show_change_password_dialog(GtkListBox*, GtkListBoxRow *row, NewAccountSettingsV gtk_entry_set_placeholder_text(GTK_ENTRY(priv->entry_current_password), _("Current password")); gtk_entry_set_input_purpose(GTK_ENTRY(priv->entry_current_password), GTK_INPUT_PURPOSE_PASSWORD); gtk_entry_set_visibility(GTK_ENTRY(priv->entry_current_password), 0); - gtk_entry_set_icon_from_stock(GTK_ENTRY(priv->entry_current_password), GTK_ENTRY_ICON_PRIMARY, "gtk-dialog-authentication"); + gtk_entry_set_icon_from_icon_name(GTK_ENTRY(priv->entry_current_password), GTK_ENTRY_ICON_PRIMARY, "gtk-dialog-authentication"); gtk_container_add(GTK_CONTAINER(priv->vbox_change_password), priv->entry_current_password); priv->entry_new_password = gtk_entry_new(); gtk_entry_set_placeholder_text(GTK_ENTRY(priv->entry_new_password), _("New password")); gtk_entry_set_visibility(GTK_ENTRY(priv->entry_new_password), 0); gtk_entry_set_input_purpose(GTK_ENTRY(priv->entry_new_password), GTK_INPUT_PURPOSE_PASSWORD); - gtk_entry_set_icon_from_stock(GTK_ENTRY(priv->entry_new_password), GTK_ENTRY_ICON_PRIMARY, "gtk-dialog-authentication"); + gtk_entry_set_icon_from_icon_name(GTK_ENTRY(priv->entry_new_password), GTK_ENTRY_ICON_PRIMARY, "gtk-dialog-authentication"); gtk_container_add(GTK_CONTAINER(priv->vbox_change_password), priv->entry_new_password); priv->entry_confirm_password = gtk_entry_new(); gtk_entry_set_placeholder_text(GTK_ENTRY(priv->entry_confirm_password), _("Confirm password")); gtk_entry_set_visibility(GTK_ENTRY(priv->entry_confirm_password), 0); gtk_entry_set_input_purpose(GTK_ENTRY(priv->entry_confirm_password), GTK_INPUT_PURPOSE_PASSWORD); - gtk_entry_set_icon_from_stock(GTK_ENTRY(priv->entry_confirm_password), GTK_ENTRY_ICON_PRIMARY, "gtk-dialog-authentication"); + gtk_entry_set_icon_from_icon_name(GTK_ENTRY(priv->entry_confirm_password), GTK_ENTRY_ICON_PRIMARY, "gtk-dialog-authentication"); gtk_container_add(GTK_CONTAINER(priv->vbox_change_password), priv->entry_confirm_password); auto* buttons = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); priv->button_validate_password = gtk_button_new(); diff --git a/src/ring_client.cpp b/src/ring_client.cpp index d2c25ef11f56dae1ebea6c0814bf3aeb6d0af0f2..d92ee4cc0bfaf3bc60ed8654eeb7b879aded1ad9 100644 --- a/src/ring_client.cpp +++ b/src/ring_client.cpp @@ -378,8 +378,9 @@ ring_client_open(GApplication *app, GFile **file, gint /*arg3*/, const gchar* /* { ring_client_activate(app); - if (strcmp(g_file_get_uri_scheme(*file), "ring") == 0) { - const char * call_id = g_file_get_basename(*file); + gchar *file_uri_scheme = g_file_get_uri_scheme(*file); + if (strcmp(file_uri_scheme, "ring") == 0) { + char * call_id = g_file_get_basename(*file); std::regex format {"^[[:xdigit:]]{40}$"}; if (std::regex_match(call_id, format)) { @@ -389,7 +390,11 @@ ring_client_open(GApplication *app, GFile **file, gint /*arg3*/, const gchar* /* place_new_call(cm.get()); cm.release(); } + + g_free(call_id); } + + g_free(file_uri_scheme); } #if USE_LIBNM diff --git a/src/ringmainwindow.cpp b/src/ringmainwindow.cpp index ebd03838411f3c3c68ec380de161f235a5c62007..56f434f69e36937569378fa02ca474606017b8a9 100644 --- a/src/ringmainwindow.cpp +++ b/src/ringmainwindow.cpp @@ -44,7 +44,6 @@ #include <media/recordingmodel.h> #include <media/text.h> - // Ring client #include "newaccountsettingsview.h" #include "accountmigrationview.h" @@ -150,11 +149,11 @@ inline namespace helpers * set the column value by printing the alias and the state of an account in combobox_account_selector. */ static void -print_account_and_state(GtkCellLayout* cell_layout, +print_account_and_state(G_GNUC_UNUSED GtkCellLayout* cell_layout, GtkCellRenderer* cell, GtkTreeModel* model, GtkTreeIter* iter, - gpointer* data) + G_GNUC_UNUSED gpointer* data) { gchar *id; gchar *alias; @@ -203,15 +202,20 @@ print_account_and_state(GtkCellLayout* cell_layout, g_object_set(G_OBJECT(cell), "markup", text, NULL); g_object_set(G_OBJECT(cell), "height", 17, NULL); g_object_set(G_OBJECT(cell), "ypad", 0, NULL); + + g_free(id); g_free(alias); + g_free(registeredName); + g_free(uri); + g_free(text); } static void -render_account_avatar(GtkCellLayout* cell_layout, +render_account_avatar(G_GNUC_UNUSED GtkCellLayout* cell_layout, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, - gpointer data) + G_GNUC_UNUSED gpointer data) { gchar *id; gchar* avatar; @@ -223,11 +227,11 @@ render_account_avatar(GtkCellLayout* cell_layout, 2 /* col# */, &avatar /* data */, -1); - bool enabled = g_strcmp0("true", enabledStr) == 0; - if (g_strcmp0("", id) == 0) { g_free(enabledStr); g_free(avatar); + g_free(id); + GdkPixbuf* icon = gdk_pixbuf_new_from_resource("/cx/ring/RingGnome/add-device", nullptr); g_object_set(G_OBJECT(cell), "width", 32, nullptr); g_object_set(G_OBJECT(cell), "height", 32, nullptr); @@ -235,9 +239,11 @@ render_account_avatar(GtkCellLayout* cell_layout, return; } + bool enabled = g_strcmp0("true", enabledStr) == 0; auto default_avatar = Interfaces::PixbufManipulator().generateAvatar("", ""); auto default_scaled = Interfaces::PixbufManipulator().scaleAndFrame(default_avatar.get(), QSize(32, 32), true, enabled); auto photo = default_scaled; + std::string photostr = avatar; if (!photostr.empty()) { QByteArray byteArray(photostr.c_str(), photostr.length()); @@ -254,6 +260,7 @@ render_account_avatar(GtkCellLayout* cell_layout, g_free(enabledStr); g_free(avatar); + g_free(id); } inline static void @@ -367,18 +374,6 @@ private: inline namespace gtk_callbacks { -static gboolean -on_save_accounts_timeout(GtkWidget* working_dialog) -{ - /* save changes to accounts */ - AccountModel::instance().save(); - - if (working_dialog) - gtk_widget_destroy(working_dialog); - - return G_SOURCE_REMOVE; -} - static void on_video_double_clicked(RingMainWindow* self) { @@ -600,7 +595,7 @@ on_dtmf_pressed(RingMainWindow* self, GdkEventKey* event, gpointer user_data) // the daemon will filter out invalid DTMF characters guint32 unicode_val = gdk_keyval_to_unicode(event->keyval); QString val = QString::fromUcs4(&unicode_val, 1); - g_debug("attemptingto play DTMF tone during ongoing call: %s", val.toUtf8().constData()); + g_debug("attempting to play DTMF tone during ongoing call: %s", val.toUtf8().constData()); priv->cpp->accountInfo_->callModel->playDTMF(current_item.callId, val.toStdString()); // always propagate the key, so we don't steal accelerators/shortcuts return GDK_EVENT_PROPAGATE; @@ -740,7 +735,6 @@ action_notification(gchar* title, RingMainWindow* self, Action action) conversations_view_select_conversation(CONVERSATIONS_VIEW(priv->treeview_conversations), information); } else if (type == "request") { for (const auto& conversation : priv->cpp->accountInfo_->conversationModel->getFilteredConversations(lrc::api::profile::Type::PENDING)) { - auto current_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(priv->notebook_contacts)); auto contactRequestsPageNum = gtk_notebook_page_num(GTK_NOTEBOOK(priv->notebook_contacts), priv->scrolled_window_contact_requests); gtk_notebook_set_current_page(GTK_NOTEBOOK(priv->notebook_contacts), contactRequestsPageNum); @@ -764,14 +758,15 @@ action_notification(gchar* title, RingMainWindow* self, Action action) } } } catch (const std::out_of_range& e) { - g_warning("Can't get account %i: %s", id.c_str(), e.what()); + g_warning("Can't get account %s: %s", id.c_str(), e.what()); } } } static void -on_notification_chat_clicked(GtkWidget* notifier, gchar *title, RingMainWindow* self) +on_notification_chat_clicked(G_GNUC_UNUSED GtkWidget* notifier, + gchar *title, RingMainWindow* self) { action_notification(title, self, Action::SELECT); } @@ -789,7 +784,8 @@ on_notification_refuse_pending(GtkWidget*, gchar *title, RingMainWindow* self) } static void -on_notification_accept_call(GtkWidget* notifier, gchar *title, RingMainWindow* self) +on_notification_accept_call(G_GNUC_UNUSED GtkWidget* notifier, + gchar *title, RingMainWindow* self) { g_return_if_fail(IS_RING_MAIN_WINDOW(self) && title); auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self)); @@ -816,12 +812,12 @@ on_notification_accept_call(GtkWidget* notifier, gchar *title, RingMainWindow* s auto& accountInfo = priv->cpp->lrc_->getAccountModel().getAccountInfo(id); accountInfo.callModel->accept(information); } catch (const std::out_of_range& e) { - g_warning("Can't get account %i: %s", id.c_str(), e.what()); + g_warning("Can't get account %s: %s", id.c_str(), e.what()); } } static void -on_notification_decline_call(GtkWidget* notifier, gchar *title, RingMainWindow* self) +on_notification_decline_call(G_GNUC_UNUSED GtkWidget* notifier, gchar *title, RingMainWindow* self) { g_return_if_fail(IS_RING_MAIN_WINDOW(self) && title); auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self)); @@ -844,7 +840,7 @@ on_notification_decline_call(GtkWidget* notifier, gchar *title, RingMainWindow* auto& accountInfo = priv->cpp->lrc_->getAccountModel().getAccountInfo(id); accountInfo.callModel->hangUp(information); } catch (const std::out_of_range& e) { - g_warning("Can't get account %i: %s", id.c_str(), e.what()); + g_warning("Can't get account %s: %s", id.c_str(), e.what()); } } @@ -857,18 +853,19 @@ CppImpl::CppImpl(RingMainWindow& widget) {} static gboolean -on_clear_all_history_foreach(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer self) +on_clear_all_history_foreach(GtkTreeModel *model, G_GNUC_UNUSED GtkTreePath *path, GtkTreeIter *iter, gpointer self) { g_return_val_if_fail(IS_RING_MAIN_WINDOW(self), TRUE); auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self)); - const gchar* account_id; + gchar* account_id; gtk_tree_model_get(model, iter, 0 /* col# */, &account_id /* data */, -1); auto& accountInfo = priv->cpp->lrc_->getAccountModel().getAccountInfo(account_id); accountInfo.conversationModel->clearAllHistory(); + g_free(account_id); return FALSE; } @@ -1082,9 +1079,6 @@ CppImpl::init() refreshAccountSelectorWidget(0); /* layout */ - auto* model = gtk_combo_box_get_model(GTK_COMBO_BOX(widgets->combobox_account_selector)); - - auto* renderer = gtk_cell_renderer_pixbuf_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widgets->combobox_account_selector), renderer, true); gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(widgets->combobox_account_selector), @@ -1448,13 +1442,15 @@ CppImpl::changeAccountSelection(const std::string& id) GtkTreeIter iter; auto valid = gtk_tree_model_get_iter_first(model, &iter); while (valid) { - const gchar* account_id; + gchar* account_id; gtk_tree_model_get(model, &iter, 0 /* col# */, &account_id /* data */, -1); if (id == account_id) { gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widgets->combobox_account_selector), &iter); + g_free(account_id); return; } valid = gtk_tree_model_iter_next(model, &iter); + g_free(account_id); } g_debug("BUGS: account not listed: %s", id.c_str()); @@ -1787,7 +1783,6 @@ CppImpl::slotCallStatusChanged(const std::string& callId) if (accountInfo_->profileInfo.type == lrc::api::profile::Type::RING && peer.find("ring:") == 0) { peer = peer.substr(5); } - auto& contactModel = accountInfo_->contactModel; std::string notifId = ""; try { notifId = accountInfo_->id + ":call:" + callId; diff --git a/src/ringnotify.cpp b/src/ringnotify.cpp index e26f3bf50578e9a0beede9011793da14a67d0e0b..d543952db5b162dfb3e44d0d04a4ea7590196af4 100644 --- a/src/ringnotify.cpp +++ b/src/ringnotify.cpp @@ -45,28 +45,6 @@ static constexpr const char* SERVER_NOTIFY_OSD = "notify-osd"; static constexpr const char* NOTIFICATION_FILE = SOUNDSDIR "/ringtone_notify.wav"; -/* struct to store the parsed list of the notify server capabilities */ -struct RingNotifyServerInfo -{ - /* info */ - char *name; - char *vendor; - char *version; - char *spec; - - /* capabilities */ - gboolean append; - gboolean actions; - - /* the info strings must be freed */ - ~RingNotifyServerInfo() { - g_free(name); - g_free(vendor); - g_free(version); - g_free(spec); - } -}; - namespace details { class CppImpl; @@ -86,8 +64,6 @@ typedef struct _RingNotifierPrivate RingNotifierPrivate; struct _RingNotifierPrivate { - RingNotifyServerInfo serverInfo; - details::CppImpl* cpp; ///< Non-UI and C++ only code0 }; @@ -119,23 +95,40 @@ public: RingNotifier* self = nullptr; // The GTK widget itself RingNotifierPrivate* priv = nullptr; + /* server info and capabilities */ + char *name = nullptr; + char *vendor = nullptr; + char *version = nullptr; + char *spec = nullptr; + gboolean append; + gboolean actions; + std::map<std::string, std::shared_ptr<NotifyNotification>> notifications_; private: CppImpl() = delete; CppImpl(const CppImpl&) = delete; CppImpl& operator=(const CppImpl&) = delete; - }; CppImpl::CppImpl(RingNotifier& widget) - : self {&widget} -{} +: self {&widget} +{ +} CppImpl::~CppImpl() -{} - +{ + if (name) + g_free(name); + if (vendor) + g_free(vendor); + if (version) + g_free(version); + if (spec) + g_free(spec); } +} // namespace details + static void ring_notifier_dispose(GObject *object) { @@ -165,12 +158,12 @@ ring_notifier_init(RingNotifier *view) notify_init("Ring"); /* get notify server info */ - if (notify_get_server_info(&(priv->serverInfo).name, - &(priv->serverInfo).vendor, - &(priv->serverInfo).version, - &(priv->serverInfo).spec)) { + if (notify_get_server_info(&priv->cpp->name, + &priv->cpp->vendor, + &priv->cpp->version, + &priv->cpp->spec)) { g_debug("notify server name: %s, vendor: %s, version: %s, spec: %s", - priv->serverInfo.name, priv->serverInfo.vendor, priv->serverInfo.version, priv->serverInfo.spec); + priv->cpp->name, priv->cpp->vendor, priv->cpp->version, priv->cpp->spec); } /* check notify server capabilities */ @@ -178,10 +171,10 @@ ring_notifier_init(RingNotifier *view) while (list) { if (g_strcmp0((const char *)list->data, "append") == 0 || g_strcmp0((const char *)list->data, "x-canonical-append") == 0) { - priv->serverInfo.append = TRUE; + priv->cpp->append = TRUE; } if (g_strcmp0((const char *)list->data, "actions") == 0) { - priv->serverInfo.actions = TRUE; + priv->cpp->actions = TRUE; } list = g_list_next(list); @@ -340,7 +333,7 @@ ring_show_notification(RingNotifier* view, const std::string& icon, #endif // USE_CANBERRA // if the notification server supports actions, make the default action to show the chat view - if (priv->serverInfo.actions) { + if (priv->cpp->actions) { if (type != NotificationType::CALL) { notify_notification_add_action(notification.get(), id.c_str(), @@ -397,23 +390,26 @@ gboolean ring_hide_notification(RingNotifier* view, const std::string& id) { g_return_val_if_fail(IS_RING_NOTIFIER(view), false); - gboolean success = FALSE; RingNotifierPrivate *priv = RING_NOTIFIER_GET_PRIVATE(view); #if USE_LIBNOTIFY // Search auto notification = priv->cpp->notifications_.find(id); if (notification == priv->cpp->notifications_.end()) { - return success; + return FALSE; } + // Close GError *error = nullptr; if (!notify_notification_close(notification->second.get(), &error)) { g_warning("could not close notification: %s", error->message); g_clear_error(&error); + return FALSE; } + // Erase priv->cpp->notifications_.erase(id); #endif - return success; + + return TRUE; } diff --git a/src/ringwelcomeview.cpp b/src/ringwelcomeview.cpp index 4391f11938f674092d66fcaa1737b3a79722c375..bf18d654f7cb7df106924ccf2c4e647617fb2bb5 100644 --- a/src/ringwelcomeview.cpp +++ b/src/ringwelcomeview.cpp @@ -96,7 +96,7 @@ ring_welcome_update_view(RingWelcomeView* self) { (*priv->accountInfo_)->profileInfo.uri.c_str()); } else { gtk_label_set_text(GTK_LABEL(priv->label_explanation), NULL); - ring_id = {}; + ring_id = g_strdup(""); } gtk_label_set_markup(GTK_LABEL(priv->label_ringid), ring_id); @@ -105,6 +105,8 @@ ring_welcome_update_view(RingWelcomeView* self) { gtk_widget_show(priv->label_ringid); gtk_widget_show(priv->button_qrcode); gtk_widget_show(priv->revealer_qrcode); + + g_free(ring_id); } static void @@ -255,7 +257,7 @@ draw_qrcode(G_GNUC_UNUSED GtkWidget* diese, if (!rcode) { // no rcode, no draw g_warning("Failed to generate QR code"); - return TRUE; + return FALSE; } auto margin = 5; @@ -286,7 +288,6 @@ draw_qrcode(G_GNUC_UNUSED GtkWidget* diese, QRcode_free(rcode); return TRUE; - } static void diff --git a/src/usernameregistrationbox.cpp b/src/usernameregistrationbox.cpp index d4dffe2bf746676f8149a2aabb1426556e0acfce..1a5acc6a201d98a3f4685c274f55be828242ff39 100644 --- a/src/usernameregistrationbox.cpp +++ b/src/usernameregistrationbox.cpp @@ -310,7 +310,7 @@ button_register_username_clicked(G_GNUC_UNUSED GtkButton* button, UsernameRegist (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, - "Enter the password of your Ring account" + _("Enter the password of your Ring account") ); GtkWidget* entry_password = gtk_entry_new(); diff --git a/src/video/video_widget.cpp b/src/video/video_widget.cpp index d3d012dc35f49e090c682c9fd71bd2762f291036..0d7c087e541db4c2b63dceec1e00ecbf0889c394 100644 --- a/src/video/video_widget.cpp +++ b/src/video/video_widget.cpp @@ -400,7 +400,10 @@ void video_widget_on_drag_data_received(G_GNUC_UNUSED GtkWidget *self, } } - if (!call) return; + if (!call) { + g_strfreev(uris); + return; + } if (uris && *uris){ if (auto out_media = call->firstMedia<media::Video>(media::Media::Direction::OUT)) @@ -413,7 +416,7 @@ void video_widget_on_drag_data_received(G_GNUC_UNUSED GtkWidget *self, static void switch_video_input(GtkWidget *widget, Video::Device *device) { - gpointer data = g_object_get_data(G_OBJECT(widget),JOIN_CALL_KEY ); + gpointer data = g_object_get_data(G_OBJECT(widget), JOIN_CALL_KEY); g_return_if_fail(data); Call *call = (Call*)data; @@ -491,7 +494,6 @@ switch_video_input_file(GtkWidget *item, GtkWidget *parent) parent = gtk_widget_get_toplevel(GTK_WIDGET(parent)); } - gchar *uri = NULL; GtkWidget *dialog = gtk_file_chooser_dialog_new( "Choose File", GTK_WINDOW(parent), @@ -509,16 +511,21 @@ switch_video_input_file(GtkWidget *item, GtkWidget *parent) } } - if (!call) return; + if (!call) { + gtk_widget_destroy(dialog); + return; + } - uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); + gchar *uri = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER(dialog)); - if (auto out_media = call->firstMedia<media::Video>(media::Media::Direction::OUT)) - out_media->sourceModel()->setFile(QUrl(uri)); + if (uri) { + if (auto out_media = call->firstMedia<media::Video>(media::Media::Direction::OUT)) + out_media->sourceModel()->setFile(QUrl(uri)); + g_free(uri); + } } gtk_widget_destroy(dialog); - g_free(uri); } /* diff --git a/src/webkitchatcontainer.cpp b/src/webkitchatcontainer.cpp index f40acd9a69c3346118a98b38622e38e0aeaab904..49480e92b78f2410fabd04577077fee94103b9dc 100644 --- a/src/webkitchatcontainer.cpp +++ b/src/webkitchatcontainer.cpp @@ -151,11 +151,12 @@ webview_chat_context_menu(G_GNUC_UNUSED WebKitChatContainer *self, webkit_context_menu_remove(menu, item); } } - return false; + + return true; } static void -webkit_chat_container_execute_js(WebKitChatContainer *view, gchar* function_call) +webkit_chat_container_execute_js(WebKitChatContainer *view, const gchar* function_call) { WebKitChatContainerPrivate *priv = WEBKIT_CHAT_CONTAINER_GET_PRIVATE(view); webkit_web_view_run_javascript( @@ -325,8 +326,6 @@ webview_chat_decide_policy (G_GNUC_UNUSED WebKitWebView *web_view, } case WEBKIT_POLICY_DECISION_TYPE_RESPONSE: { - //WebKitResponsePolicyDecision *response = WEBKIT_RESPONSE_POLICY_DECISION (decision); - //break; return FALSE; } default: @@ -614,15 +613,13 @@ webkit_chat_disable_send_interaction(WebKitChatContainer *view, bool isDisabled) void webkit_chat_container_clear_sender_images(WebKitChatContainer *view) { - webkit_chat_container_execute_js(view, "clearSenderImages()"); + webkit_chat_container_execute_js(view, "clearSenderImages();"); } void webkit_chat_container_clear(WebKitChatContainer *view) { - WebKitChatContainerPrivate *priv = WEBKIT_CHAT_CONTAINER_GET_PRIVATE(view); - - webkit_chat_container_execute_js(view, "clearMessages()"); + webkit_chat_container_execute_js(view, "clearMessages();"); webkit_chat_container_clear_sender_images(view); }