From 2097f11220e25f83dda2026d07cc66e7a0a31544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Rameau?= Date: Sun, 15 Jan 2006 21:05:31 +0000 Subject: Add a method to EphyAdblock interface, ephy_adblock_manager_edit_rule, so MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2006-01-15 Jean-François Rameau * lib/ephy-adblock.h: * lib/ephy-adblock.c: * embed/ephy-adblock-manager.h: * embed/ephy-adblock-manager.c: Add a method to EphyAdblock interface, ephy_adblock_manager_edit_rule, so one can allow/disallow an url. Add a method to EphyAdblockManager, ephy_adblock_manager_has_blocker, so one can ask it whether a blocker is running. --- ChangeLog | 12 ++++++++++++ embed/ephy-adblock-manager.c | 34 ++++++++++++++++++++++++++++++++++ embed/ephy-adblock-manager.h | 6 ++++++ lib/ephy-adblock.c | 12 ++++++++++++ lib/ephy-adblock.h | 8 ++++++++ 5 files changed, 72 insertions(+) diff --git a/ChangeLog b/ChangeLog index 37aa3f167..0694b63d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-01-15 Jean-François Rameau + + * lib/ephy-adblock.h: + * lib/ephy-adblock.c: + * embed/ephy-adblock-manager.h: + * embed/ephy-adblock-manager.c: + + Add a method to EphyAdblock interface, ephy_adblock_manager_edit_rule, + so one can allow/disallow an url. + Add a method to EphyAdblockManager, ephy_adblock_manager_has_blocker, + so one can ask it whether a blocker is running. + 2006-01-15 Crispin Flowerday * data/chrome/Makefile.am: diff --git a/embed/ephy-adblock-manager.c b/embed/ephy-adblock-manager.c index cb4e6dda5..a4ba57e25 100644 --- a/embed/ephy-adblock-manager.c +++ b/embed/ephy-adblock-manager.c @@ -98,4 +98,38 @@ ephy_adblock_manager_class_init (EphyAdBlockManagerClass *klass) g_type_class_add_private (object_class, sizeof (EphyAdBlockManagerPrivate)); } +/** + * ephy_adblock_manager_edit_rule: + * @shell: a #EphyAdBlockManager + * @url: the target url on which the rule is based + * @allowed: TRUE if the url has to be blocked. + * + * Ask to the blocker a new rule based on @url. + * + **/ +void +ephy_adblock_manager_edit_rule (EphyAdBlockManager *self, + const char *url, + gboolean allowed) +{ + if (self->priv->blocker != NULL) + { + ephy_adblock_edit_rule (self->priv->blocker, + url, + allowed); + } +} +/** + * ephy_adblock_manager_has_blocker: + * @shell: a #EphyAdBlockManager + * + * Check if Epiphany has currently an active blocker + * + * ReturnValue: TRUE if an active blocker is running + **/ +gboolean +ephy_adblock_manager_has_blocker (EphyAdBlockManager *self) +{ + return self->priv->blocker != NULL; +} diff --git a/embed/ephy-adblock-manager.h b/embed/ephy-adblock-manager.h index a499ad810..021143a0a 100644 --- a/embed/ephy-adblock-manager.h +++ b/embed/ephy-adblock-manager.h @@ -59,6 +59,12 @@ gboolean ephy_adblock_manager_should_load (EphyAdBlockManager *self, void ephy_adblock_manager_set_blocker (EphyAdBlockManager *self, EphyAdBlock *blocker); +void ephy_adblock_manager_edit_rule (EphyAdBlockManager *self, + const char *url, + gboolean allowed); + +gboolean ephy_adblock_manager_has_blocker (EphyAdBlockManager *self); + G_END_DECLS #endif diff --git a/lib/ephy-adblock.c b/lib/ephy-adblock.c index 9ba768c4b..4307737df 100644 --- a/lib/ephy-adblock.c +++ b/lib/ephy-adblock.c @@ -59,3 +59,15 @@ ephy_adblock_should_load (EphyAdBlock *adblock, return TRUE; } + +void +ephy_adblock_edit_rule (EphyAdBlock *adblock, + const char *url, + gboolean allowed) +{ + EphyAdBlockIface *iface = EPHY_ADBLOCK_GET_IFACE (adblock); + if (iface->edit_rule) + { + iface->edit_rule (adblock, url, allowed); + } +} diff --git a/lib/ephy-adblock.h b/lib/ephy-adblock.h index f102a1961..3e4bb50ba 100644 --- a/lib/ephy-adblock.h +++ b/lib/ephy-adblock.h @@ -66,6 +66,10 @@ struct _EphyAdBlockIface gboolean (* should_load) (EphyAdBlock *adblock, const char *url, AdUriCheckType check_type); + + void (* edit_rule) (EphyAdBlock *adblock, + const char *url, + gboolean allowed); }; GType ephy_adblock_get_type (void); @@ -74,6 +78,10 @@ gboolean ephy_adblock_should_load (EphyAdBlock *adblock, const char *url, AdUriCheckType check_type); +void ephy_adblock_edit_rule (EphyAdBlock *adblock, + const char *url, + gboolean allowed); + G_END_DECLS #endif -- cgit v1.2.3