[epiphany/pgriffis/web-extension-alarms: 2/4] WebExtensions: Remove ephy_shell_get_web_extension_manager()




commit 5363265772c76c9207d05aa089a913824dd3f005
Author: Patrick Griffis <pgriffis igalia com>
Date:   Sat May 28 13:43:15 2022 -0500

    WebExtensions: Remove ephy_shell_get_web_extension_manager()

 src/ephy-shell.c                              | 12 ------------
 src/ephy-shell.h                              |  2 --
 src/ephy-web-extension-dialog.c               |  7 +++----
 src/ephy-window.c                             |  4 ++--
 src/webextension/api/pageaction.c             |  2 +-
 src/webextension/api/runtime.c                |  3 +--
 src/webextension/ephy-web-extension-manager.c |  6 +++---
 7 files changed, 10 insertions(+), 26 deletions(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index bda5dbec1..c8d95a31c 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -1537,18 +1537,6 @@ ephy_shell_startup_finished (EphyShell *shell)
   return shell->startup_finished;
 }
 
-EphyWebExtensionManager *
-ephy_shell_get_web_extension_manager (EphyShell *shell)
-{
-  g_assert (EPHY_IS_SHELL (shell));
-
-  if (shell->web_extension_manager == NULL)
-    shell->web_extension_manager = ephy_web_extension_manager_get_default ();
-
-  return shell->web_extension_manager;
-}
-
-
 /* Helper functions: better place for this? */
 EphyWebView *
 ephy_shell_get_web_view (EphyShell *shell,
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 64012311c..0a5686950 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -131,8 +131,6 @@ void                     ephy_shell_send_notification       (EphyShell        *s
 
 gboolean                 ephy_shell_startup_finished        (EphyShell *shell);
 
-EphyWebExtensionManager  *ephy_shell_get_web_extension_manager (EphyShell        *shell);
-
 EphyWebView              *ephy_shell_get_web_view              (EphyShell        *shell,
                                                                 guint64           id);
 
diff --git a/src/ephy-web-extension-dialog.c b/src/ephy-web-extension-dialog.c
index d0344c950..6d06a7f27 100644
--- a/src/ephy-web-extension-dialog.c
+++ b/src/ephy-web-extension-dialog.c
@@ -104,7 +104,7 @@ toggle_state_set_cb (GtkSwitch *widget,
                      gboolean   state,
                      gpointer   user_data)
 {
-  EphyWebExtensionManager *manager = ephy_shell_get_web_extension_manager (ephy_shell_get_default ());
+  EphyWebExtensionManager *manager = ephy_web_extension_manager_get_default ();
   EphyWebExtension *web_extension = EPHY_WEB_EXTENSION (user_data);
 
   ephy_web_extension_manager_set_active (manager, web_extension, state);
@@ -140,7 +140,7 @@ create_row (EphyWebExtensionDialog *self,
   GtkWidget *author;
   GtkWidget *version;
   g_autoptr (GdkPixbuf) icon = NULL;
-  EphyWebExtensionManager *manager = ephy_shell_get_web_extension_manager (ephy_shell_get_default ());
+  EphyWebExtensionManager *manager = ephy_web_extension_manager_get_default ();
 
   row = hdy_expander_row_new ();
   g_object_set_data (G_OBJECT (row), "web_extension", web_extension);
@@ -317,8 +317,7 @@ ephy_web_extension_dialog_init (EphyWebExtensionDialog *self)
 
   gtk_widget_init_template (GTK_WIDGET (self));
 
-  manager = ephy_shell_get_web_extension_manager (ephy_shell_get_default ());
-  g_assert (manager != NULL);
+  manager = ephy_web_extension_manager_get_default ();
 
   g_set_weak_pointer (&self->web_extension_manager, manager);
   g_signal_connect_object (self->web_extension_manager, "changed", G_CALLBACK 
(on_web_extension_manager_changed), self, 0);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 7c82554e0..801fdb5fb 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1272,7 +1272,7 @@ sync_tab_page_action (EphyWebView *view,
 {
   EphyWebExtensionManager *manager;
 
-  manager = ephy_shell_get_web_extension_manager (ephy_shell_get_default ());
+  manager = ephy_web_extension_manager_get_default ();
   ephy_web_extension_manager_update_location_entry (manager, window);
 }
 
@@ -3790,7 +3790,7 @@ ephy_window_constructed (GObject *object)
 
   ephy_window_set_chrome (window, chrome);
 
-  ephy_web_extension_manager_install_actions (ephy_shell_get_web_extension_manager (ephy_shell_get_default 
()), window);
+  ephy_web_extension_manager_install_actions (ephy_web_extension_manager_get_default (), window);
 }
 
 static void
diff --git a/src/webextension/api/pageaction.c b/src/webextension/api/pageaction.c
index 686b70e15..4840a77b5 100644
--- a/src/webextension/api/pageaction.c
+++ b/src/webextension/api/pageaction.c
@@ -32,7 +32,7 @@ pageaction_get_action (EphyWebExtension *self,
 {
   EphyWebView *web_view = NULL;
   EphyShell *shell = ephy_shell_get_default ();
-  EphyWebExtensionManager *manager = ephy_shell_get_web_extension_manager (shell);
+  EphyWebExtensionManager *manager = ephy_web_extension_manager_get_default ();
   g_autoptr (JSCValue) tab_id = NULL;
   gint32 nr;
 
diff --git a/src/webextension/api/runtime.c b/src/webextension/api/runtime.c
index 9e49c68ee..85e2898d9 100644
--- a/src/webextension/api/runtime.c
+++ b/src/webextension/api/runtime.c
@@ -52,8 +52,7 @@ runtime_handler_send_message (EphyWebExtension  *self,
                               JSCValue          *args,
                               GError           **error)
 {
-  EphyShell *shell = ephy_shell_get_default ();
-  EphyWebExtensionManager *manager = ephy_shell_get_web_extension_manager (shell);
+  EphyWebExtensionManager *manager = ephy_web_extension_manager_get_default ();
   WebKitWebView *view = ephy_web_extension_manager_get_background_web_view (manager, self);
   g_autoptr (JSCValue) value = jsc_value_object_get_property_at_index (args, 0);
   g_autofree char *script = NULL;
diff --git a/src/webextension/ephy-web-extension-manager.c b/src/webextension/ephy-web-extension-manager.c
index a1cae22cd..1dde9d88f 100644
--- a/src/webextension/ephy-web-extension-manager.c
+++ b/src/webextension/ephy-web-extension-manager.c
@@ -404,7 +404,7 @@ page_action_clicked (GtkWidget      *event_box,
   g_autoptr (JsonNode) root = NULL;
   g_autofree char *json = NULL;
   g_autofree char *script = NULL;
-  EphyWebExtensionManager *self = ephy_shell_get_web_extension_manager (shell);
+  EphyWebExtensionManager *self = ephy_web_extension_manager_get_default ();
   WebKitWebView *web_view = ephy_web_extension_manager_get_background_web_view (self, web_extension);
 
   json_builder_begin_object (builder);
@@ -664,7 +664,7 @@ page_attached_cb (HdyTabView *tab_view,
   GtkWidget *child = hdy_tab_page_get_child (page);
   EphyWebView *web_view = ephy_embed_get_web_view (EPHY_EMBED (child));
   EphyWindow *window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (tab_view)));
-  EphyWebExtensionManager *self = ephy_shell_get_web_extension_manager (ephy_shell_get_default ());
+  EphyWebExtensionManager *self = ephy_web_extension_manager_get_default ();
 
   ephy_web_extension_manager_add_web_extension_to_webview (self, web_extension, window, web_view);
   ephy_web_extension_manager_update_location_entry (self, window);
@@ -842,7 +842,7 @@ on_browser_action_clicked (GtkWidget *event_box,
                            gpointer   user_data)
 {
   EphyWebExtension *web_extension = EPHY_WEB_EXTENSION (user_data);
-  EphyWebExtensionManager *self = ephy_shell_get_web_extension_manager (ephy_shell_get_default ());
+  EphyWebExtensionManager *self = ephy_web_extension_manager_get_default ();
   g_autofree char *script = NULL;
   WebKitWebView *web_view = ephy_web_extension_manager_get_background_web_view (self, web_extension);
 


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