[evolution/wip/mcrha/webkit-jsc-api: 267/292] Remove some leftover artifacts of WebExtension D-Bus API, which are not used anymore



commit d52c7fca9543c0621bc73e92f8aedb62cd290b73
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 22 17:47:57 2020 +0100

    Remove some leftover artifacts of WebExtension D-Bus API, which are not used anymore

 data/webkit/e-editor.js                     |    4 +
 src/e-util/CMakeLists.txt                   |    2 -
 src/e-util/e-misc-utils.c                   |  270 ------
 src/e-util/e-misc-utils.h                   |   35 -
 src/e-util/e-util.h                         |    1 -
 src/e-util/e-web-extension-container.c      | 1280 ---------------------------
 src/e-util/e-web-extension-container.h      |  103 ---
 src/e-util/e-web-view.c                     |    1 -
 src/modules/webkit-editor/e-webkit-editor.c |   13 +-
 9 files changed, 11 insertions(+), 1698 deletions(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index 1b3c0c9a91..8a1315e0b6 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -3739,6 +3739,10 @@ EvoEditor.PasteText = function(text, isHTML, quote)
 {
 }
 
+EvoEditor.WrapSelection = function()
+{
+}
+
 EvoEditor.onContextMenu = function(event)
 {
        var node = event.target;
diff --git a/src/e-util/CMakeLists.txt b/src/e-util/CMakeLists.txt
index 6551eb26a7..19632d07f2 100644
--- a/src/e-util/CMakeLists.txt
+++ b/src/e-util/CMakeLists.txt
@@ -271,7 +271,6 @@ set(SOURCES
        e-url-entry.c
        e-util-private.h
        e-webdav-browser.c
-       e-web-extension-container.c
        e-web-view.c
        e-web-view-jsc-utils.c
        e-web-view-preview.c
@@ -544,7 +543,6 @@ set(HEADERS
        e-url-entry.h
        e-util-enums.h
        e-webdav-browser.h
-       e-web-extension-container.h
        e-web-view.h
        e-web-view-jsc-utils.h
        e-web-view-preview.h
diff --git a/src/e-util/e-misc-utils.c b/src/e-util/e-misc-utils.c
index 9639784dbf..ab8906ed7f 100644
--- a/src/e-util/e-misc-utils.c
+++ b/src/e-util/e-misc-utils.c
@@ -3691,276 +3691,6 @@ e_util_check_gtk_bindings_in_key_press_event_cb (GtkWidget *widget,
        return FALSE;
 }
 
-/**
- * e_util_claim_dbus_proxy_call_error:
- * @dbus_proxy: a #GDBusProxy instance
- * @method_name: a method name of the @dbus_proxy
- * @in_error: (allow-none): a #GError with the failure, or %NULL
- *
- * Claims the @in_error on the console as a failure to call
- * method @method_name of the @dbus_proxy. It's safe to call this
- * with a %NULL @in_error, then the function does nothing.
- * Some errors can be ignored, like the G_IO_ERROR_CANCELLED is.
- *
- * Since: 3.22
- **/
-void
-e_util_claim_dbus_proxy_call_error (GDBusProxy *dbus_proxy,
-                                   const gchar *method_name,
-                                   const GError *in_error)
-{
-       g_return_if_fail (G_IS_DBUS_PROXY (dbus_proxy));
-       g_return_if_fail (method_name != NULL);
-
-       if (in_error &&
-           !g_error_matches (in_error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
-           !g_error_matches (in_error, G_IO_ERROR, G_IO_ERROR_CLOSED) &&
-           !g_error_matches (in_error, G_IO_ERROR, G_IO_ERROR_CONNECTION_CLOSED) &&
-           !g_error_matches (in_error, G_DBUS_ERROR, G_DBUS_ERROR_DISCONNECTED))
-               g_message ("Failed to call a DBus Proxy method %s::%s: %s",
-                       g_dbus_proxy_get_name (dbus_proxy), method_name, in_error->message);
-}
-
-static void
-e_util_finish_dbus_proxy_call_cb (GObject *source_object,
-                                 GAsyncResult *result,
-                                 gpointer user_data)
-{
-       gchar *method_name = user_data;
-       GDBusProxy *dbus_proxy;
-       GVariant *ret;
-       GError *error = NULL;
-
-       g_return_if_fail (G_IS_DBUS_PROXY (source_object));
-
-       dbus_proxy = G_DBUS_PROXY (source_object);
-
-       ret = g_dbus_proxy_call_finish (dbus_proxy, result, &error);
-
-       if (ret)
-               g_variant_unref (ret);
-
-       if (error)
-               g_dbus_error_strip_remote_error (error);
-
-       e_util_claim_dbus_proxy_call_error (dbus_proxy, method_name, error);
-
-       g_clear_error (&error);
-       g_free (method_name);
-}
-
-/**
- * e_util_invoke_g_dbus_proxy_call_with_error_check:
- * @dbus_proxy: a #GDBusProxy instance
- * @method_name: a method name to invoke
- * @parameters: (allow-none): parameters of the method, or %NULL
- * @cancellable: (allow-none): a #GCancellable, or %NULL
- *
- * Calls g_dbus_proxy_call() on the @dbus_proxy for the @method_name with @parameters
- * and adds its own callback for the result. Then, if an error is returned, passes this
- * error into e_util_claim_dbus_proxy_call_error().
- *
- * See: e_util_invoke_g_dbus_proxy_call_with_error_check_full()
- *
- * Since: 3.22
- **/
-void
-e_util_invoke_g_dbus_proxy_call_with_error_check (GDBusProxy *dbus_proxy,
-                                                 const gchar *method_name,
-                                                 GVariant *parameters,
-                                                 GCancellable *cancellable)
-{
-       g_return_if_fail (G_IS_DBUS_PROXY (dbus_proxy));
-       g_return_if_fail (method_name != NULL);
-
-       e_util_invoke_g_dbus_proxy_call_with_error_check_full (
-               dbus_proxy, method_name, parameters,
-               G_DBUS_CALL_FLAGS_NONE, -1, cancellable);
-}
-
-/**
- * e_util_invoke_g_dbus_proxy_call_with_error_check_full:
- * @dbus_proxy: a #GDBusProxy instance
- * @method_name: a method name to invoke
- * @parameters: (allow-none): parameters of the method, or %NULL
- * @flags: a bit-or of #GDBusCallFlags, with the same meaning as in the g_dbus_proxy_call()
- * @timeout_msec: timeout in milliseconds, with the same meaning as in the g_dbus_proxy_call().
- * @cancellable: (allow-none): a #GCancellable, or %NULL
- *
- * Calls g_dbus_proxy_call() on the @dbus_proxy for the @method_name with @parameters
- * and adds its own callback for the result. Then, if an error is returned, passes this
- * error into e_util_claim_dbus_proxy_call_error().
- *
- * See: e_util_invoke_g_dbus_proxy_call_with_error_check()
- *
- * Since: 3.22
- **/
-void
-e_util_invoke_g_dbus_proxy_call_with_error_check_full (GDBusProxy *dbus_proxy,
-                                                      const gchar *method_name,
-                                                      GVariant *parameters,
-                                                      GDBusCallFlags flags,
-                                                      gint timeout_msec,
-                                                      GCancellable *cancellable)
-{
-       g_return_if_fail (G_IS_DBUS_PROXY (dbus_proxy));
-       g_return_if_fail (method_name != NULL);
-
-       g_dbus_proxy_call (dbus_proxy, method_name, parameters,
-               flags, timeout_msec, cancellable,
-               e_util_finish_dbus_proxy_call_cb, g_strdup (method_name));
-}
-
-/**
- * e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check:
- * @dbus_proxy: a #GDBusProxy instance
- * @method_name: a method name to invoke
- * @parameters: (allow-none): parameters of the method, or %NULL
- * @cancellable: (allow-none): a #GCancellable, or %NULL
- *
- * Calls e_util_invoke_g_dbus_proxy_call_sync_wrapper_full() with some default
- * values for flags and timeout_msec, while also providing its own GError and
- * after the call is finished it calls e_util_claim_dbus_proxy_call_error()
- * with the returned error, if any.
- *
- * Returns: (transfer full): The result of the method call, or %NULL on error. Free with g_variant_unref().
- *
- * Since: 3.22
- **/
-GVariant *
-e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check (GDBusProxy *dbus_proxy,
-                                                              const gchar *method_name,
-                                                              GVariant *parameters,
-                                                              GCancellable *cancellable)
-{
-       GVariant *result;
-       GError *error = NULL;
-
-       g_return_val_if_fail (G_IS_DBUS_PROXY (dbus_proxy), NULL);
-       g_return_val_if_fail (method_name != NULL, NULL);
-
-       /* Reference the D-Bus proxy, to not have it disappeared under its hands */
-       g_object_ref (dbus_proxy);
-
-       result = e_util_invoke_g_dbus_proxy_call_sync_wrapper_full (dbus_proxy, method_name, parameters,
-               G_DBUS_CALL_FLAGS_NONE, -1, cancellable, &error);
-
-       if (error)
-               g_dbus_error_strip_remote_error (error);
-
-       e_util_claim_dbus_proxy_call_error (dbus_proxy, method_name, error);
-       g_clear_error (&error);
-
-       g_object_unref (dbus_proxy);
-
-       return result;
-}
-
-/**
- * e_util_invoke_g_dbus_proxy_call_sync_wrapper:
- * @dbus_proxy: a #GDBusProxy instance
- * @method_name: a method name to invoke
- * @parameters: (allow-none): parameters of the method, or %NULL
- * @cancellable: (allow-none): a #GCancellable, or %NULL
- * @error: (allow-none): Return location for error, or %NULL
- *
- * Wraps GDBusProxy synchronous call into an asynchronous without blocking
- * the main context. This can be useful when doing calls on a WebExtension,
- * because it can avoid freeze when this is called in the UI process and
- * the WebProcess also does its own IPC call.
- *
- * This function should be called only from the main thread.
- *
- * See e_util_invoke_g_dbus_proxy_call_sync_wrapper_full().
- *
- * Returns: (transfer full): The result of the method call, or %NULL on error. Free with g_variant_unref().
- *
- * Since: 3.34
- **/
-GVariant *
-e_util_invoke_g_dbus_proxy_call_sync_wrapper (GDBusProxy *dbus_proxy,
-                                             const gchar *method_name,
-                                             GVariant *parameters,
-                                             GCancellable *cancellable,
-                                             GError **error)
-{
-       return e_util_invoke_g_dbus_proxy_call_sync_wrapper_full (dbus_proxy, method_name, parameters,
-               G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error);
-}
-
-static void
-sync_wrapper_result_callback (GObject *source_object,
-                             GAsyncResult *result,
-                             gpointer user_data)
-{
-       GAsyncResult **out_async_result = user_data;
-
-       g_return_if_fail (out_async_result != NULL);
-       g_return_if_fail (*out_async_result == NULL);
-
-       *out_async_result = g_object_ref (result);
-}
-
-/**
- * e_util_invoke_g_dbus_proxy_call_sync_wrapper_full:
- * @dbus_proxy: a #GDBusProxy instance
- * @method_name: a method name to invoke
- * @parameters: (allow-none): parameters of the method, or %NULL
- * @flags: a bit-or of #GDBusCallFlags, with the same meaning as in the g_dbus_proxy_call()
- * @timeout_msec: timeout in milliseconds, with the same meaning as in the g_dbus_proxy_call().
- * @cancellable: (allow-none): a #GCancellable, or %NULL
- * @error: (allow-none): Return location for error, or %NULL
- *
- * Wraps GDBusProxy synchronous call into an asynchronous without blocking
- * the main context. This can be useful when doing calls on a WebExtension,
- * because it can avoid freeze when this is called in the UI process and
- * the WebProcess also does its own IPC call.
- *
- * This function should be called only from the main thread.
- *
- * Returns: (transfer full): The result of the method call, or %NULL on error. Free with g_variant_unref().
- *
- * Since: 3.22
- **/
-GVariant *
-e_util_invoke_g_dbus_proxy_call_sync_wrapper_full (GDBusProxy *dbus_proxy,
-                                                  const gchar *method_name,
-                                                  GVariant *parameters,
-                                                  GDBusCallFlags flags,
-                                                  gint timeout_msec,
-                                                  GCancellable *cancellable,
-                                                  GError **error)
-{
-       GAsyncResult *async_result = NULL;
-       GVariant *var_result;
-       GMainContext *main_context;
-
-       g_return_val_if_fail (G_IS_DBUS_PROXY (dbus_proxy), NULL);
-       g_return_val_if_fail (method_name != NULL, NULL);
-
-       g_warn_if_fail (e_util_is_main_thread (g_thread_self ()));
-
-       /* Reference the D-Bus proxy, to not have it disappeared under its hands */
-       g_object_ref (dbus_proxy);
-
-       g_dbus_proxy_call (
-               dbus_proxy, method_name, parameters, flags, timeout_msec, cancellable,
-               sync_wrapper_result_callback, &async_result);
-
-       main_context = g_main_context_get_thread_default ();
-
-       while (!async_result) {
-               g_main_context_iteration (main_context, TRUE);
-       }
-
-       var_result = g_dbus_proxy_call_finish (dbus_proxy, async_result, error);
-
-       g_clear_object (&async_result);
-       g_object_unref (dbus_proxy);
-
-       return var_result;
-}
-
 /**
  * e_util_save_file_chooser_folder:
  * @file_chooser: a #GtkFileChooser
diff --git a/src/e-util/e-misc-utils.h b/src/e-util/e-misc-utils.h
index 9b1efc389b..28fbd86fe1 100644
--- a/src/e-util/e-misc-utils.h
+++ b/src/e-util/e-misc-utils.h
@@ -303,41 +303,6 @@ gchar *            e_util_save_image_from_clipboard
 gboolean       e_util_check_gtk_bindings_in_key_press_event_cb
                                                (GtkWidget *widget,
                                                 GdkEvent *event);
-void           e_util_claim_dbus_proxy_call_error
-                                               (GDBusProxy *dbus_proxy,
-                                                const gchar *method_name,
-                                                const GError *in_error);
-void           e_util_invoke_g_dbus_proxy_call_with_error_check
-                                               (GDBusProxy *dbus_proxy,
-                                                const gchar *method_name,
-                                                GVariant *parameters,
-                                                GCancellable *cancellable);
-void           e_util_invoke_g_dbus_proxy_call_with_error_check_full
-                                               (GDBusProxy *dbus_proxy,
-                                                const gchar *method_name,
-                                                GVariant *parameters,
-                                                GDBusCallFlags flags,
-                                                gint timeout_msec,
-                                                GCancellable *cancellable);
-GVariant *     e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check
-                                               (GDBusProxy *dbus_proxy,
-                                                const gchar *method_name,
-                                                GVariant *parameters,
-                                                GCancellable *cancellable);
-GVariant *     e_util_invoke_g_dbus_proxy_call_sync_wrapper
-                                               (GDBusProxy *dbus_proxy,
-                                                const gchar *method_name,
-                                                GVariant *parameters,
-                                                GCancellable *cancellable,
-                                                GError **error);
-GVariant *     e_util_invoke_g_dbus_proxy_call_sync_wrapper_full
-                                               (GDBusProxy *dbus_proxy,
-                                                const gchar *method_name,
-                                                GVariant *parameters,
-                                                GDBusCallFlags flags,
-                                                gint timeout_msec,
-                                                GCancellable *cancellable,
-                                                GError **error);
 void           e_util_save_file_chooser_folder (GtkFileChooser *file_chooser);
 void           e_util_load_file_chooser_folder (GtkFileChooser *file_chooser);
 gboolean       e_util_get_webkit_developer_mode_enabled
diff --git a/src/e-util/e-util.h b/src/e-util/e-util.h
index 4df98d7f6e..fa1243a79e 100644
--- a/src/e-util/e-util.h
+++ b/src/e-util/e-util.h
@@ -263,7 +263,6 @@
 #include <e-util/e-util-enums.h>
 #include <e-util/e-util-enumtypes.h>
 #include <e-util/e-webdav-browser.h>
-#include <e-util/e-web-extension-container.h>
 #ifndef E_UTIL_INCLUDE_WITHOUT_WEBKIT
 #include <e-util/e-web-view.h>
 #include <e-util/e-web-view-jsc-utils.h>
diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c
index 1c8ea78dc2..873324d635 100644
--- a/src/e-util/e-web-view.c
+++ b/src/e-util/e-web-view.c
@@ -38,7 +38,6 @@
 #include "e-popup-action.h"
 #include "e-selectable.h"
 #include "e-stock-request.h"
-#include "e-web-extension-container.h"
 #include "e-web-view-jsc-utils.h"
 
 #include "e-web-view.h"
diff --git a/src/modules/webkit-editor/e-webkit-editor.c b/src/modules/webkit-editor/e-webkit-editor.c
index 6fb0e24c2a..f86835357c 100644
--- a/src/modules/webkit-editor/e-webkit-editor.c
+++ b/src/modules/webkit-editor/e-webkit-editor.c
@@ -2346,6 +2346,8 @@ webkit_editor_select_all (EContentEditor *editor)
 {
        EWebKitEditor *wk_editor;
 
+       g_return_if_fail (E_IS_WEBKIT_EDITOR (editor));
+
        wk_editor = E_WEBKIT_EDITOR (editor);
 
        webkit_web_view_execute_editing_command (
@@ -2355,15 +2357,14 @@ webkit_editor_select_all (EContentEditor *editor)
 static void
 webkit_editor_selection_wrap (EContentEditor *editor)
 {
-       /*EWebKitEditor *wk_editor;
-       guint64 page_id;
+       EWebKitEditor *wk_editor;
 
-       wk_editor = E_WEBKIT_EDITOR (editor);
+       g_return_if_fail (E_IS_WEBKIT_EDITOR (editor));
 
-       page_id = current_page_id (wk_editor);          
+       wk_editor = E_WEBKIT_EDITOR (editor);
 
-       e_web_extension_container_call_simple (wk_editor->priv->web_extension_proxy, page_id, 
wk_editor->priv->stamp,
-               "DOMSelectionWrap", g_variant_new ("(t)", page_id));*/
+       e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (wk_editor), wk_editor->priv->cancellable,
+               "EvoEditor.WrapSelection();");
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]