aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--embed/ephy-adblock-manager.c34
-rw-r--r--embed/ephy-adblock-manager.h6
-rw-r--r--lib/ephy-adblock.c12
-rw-r--r--lib/ephy-adblock.h8
5 files changed, 72 insertions, 0 deletions
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 <jframeau@cvs.gnome.org>
+
+ * 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 <gnome@flowerday.cx>
* 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