From 75b2ce17335253696b6e064e093af57902a7d39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Rameau?= Date: Mon, 19 Dec 2005 21:33:41 +0000 Subject: Add some code so ad blocking should be more easy. Based on the fact that MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2005-12-19 Jean-François Rameau * embed/Makefile.am: * embed/ephy-adblock-manager.c: * embed/ephy-adblock-manager.h: * embed/ephy-embed-shell.c: (ephy_embed_shell_finalize): * embed/ephy-embed-shell.h: * embed/mozilla/EphyContentPolicy.cpp: (EphyContentPolicy::ShouldLoad): * lib/Makefile.am: * lib/ephy-adblock.h: * lib/ephy-adblock.c: * src/ephy-shell.c: (ephy_shell_get_extensions_manager): Add some code so ad blocking should be more easy. Based on the fact that Epiphany already has its own content policy component (EphyContentPolicy). The new design adds: - an interface, EphyAdBlock - a manager, EphyAdBlockManager, pointing to a blocker (possibly no one). --- embed/ephy-embed-shell.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'embed/ephy-embed-shell.c') diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index acee03562..9e50c59fc 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -31,6 +31,7 @@ #include "downloader-view.h" #include "ephy-encodings.h" #include "ephy-debug.h" +#include "ephy-adblock-manager.h" #define EPHY_EMBED_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_SHELL, EphyEmbedShellPrivate)) @@ -41,6 +42,7 @@ struct _EphyEmbedShellPrivate EphyFaviconCache *favicon_cache; EphyEmbedSingle *embed_single; EphyEncodings *encodings; + EphyAdBlockManager *adblock_manager; }; enum @@ -136,6 +138,13 @@ ephy_embed_shell_finalize (GObject *object) g_object_unref (G_OBJECT (shell->priv->embed_single)); } + if (shell->priv->adblock_manager != NULL) + { + LOG ("Unref adblock manager"); + g_object_unref (shell->priv->adblock_manager); + shell->priv->adblock_manager = NULL; + } + G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -284,3 +293,25 @@ ephy_embed_shell_get_default (void) { return embed_shell; } + +/** + * ephy_embed_shell_get_adblock_manager: + * @shell: the #EphyEmbedShell + * + * Returns the adblock manager. + * + * Return value: the adblock manager + **/ +GObject * +ephy_embed_shell_get_adblock_manager (EphyEmbedShell *shell) +{ + g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), NULL); + + if (shell->priv->adblock_manager == NULL) + { + shell->priv->adblock_manager = g_object_new (EPHY_TYPE_ADBLOCK_MANAGER, NULL); + } + + return G_OBJECT (shell->priv->adblock_manager); +} + -- cgit v1.2.3