aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-01-11 00:35:56 +0800
committerChristian Persch <chpe@src.gnome.org>2004-01-11 00:35:56 +0800
commite3396ef5e3ae7fd5674eda19a893e7dca88bce35 (patch)
tree6315e5bc2549ec9db6109607fbb29596363d969e /src
parent80bc591b9024029ee12957944593053db6763c41 (diff)
downloadgsoc2013-epiphany-e3396ef5e3ae7fd5674eda19a893e7dca88bce35.tar
gsoc2013-epiphany-e3396ef5e3ae7fd5674eda19a893e7dca88bce35.tar.gz
gsoc2013-epiphany-e3396ef5e3ae7fd5674eda19a893e7dca88bce35.tar.bz2
gsoc2013-epiphany-e3396ef5e3ae7fd5674eda19a893e7dca88bce35.tar.lz
gsoc2013-epiphany-e3396ef5e3ae7fd5674eda19a893e7dca88bce35.tar.xz
gsoc2013-epiphany-e3396ef5e3ae7fd5674eda19a893e7dca88bce35.tar.zst
gsoc2013-epiphany-e3396ef5e3ae7fd5674eda19a893e7dca88bce35.zip
Implement history disabling.
2004-01-10 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-history.c: (ephy_history_get_type), (ephy_history_set_enabled), (ephy_history_set_property), (ephy_history_get_property), (ephy_history_class_init), (page_removed_from_host_cb), (disable_history_notifier), (ephy_history_init), (ephy_history_finalize), (ephy_history_new), (ephy_history_get_host), (ephy_history_visited), (ephy_history_add_page), (ephy_history_set_page_title), (ephy_history_clear), (ephy_history_is_enabled): * embed/ephy-history.h: * lib/ephy-node-db.c: (ephy_node_db_get_property), (ephy_node_db_set_property), (ephy_node_db_set_immutable): * lib/ephy-node-db.h: * lib/ephy-prefs.h: * src/bookmarks/ephy-bookmarks.c: (clear_favorites), (history_cleared_cb), (ephy_setup_history_notifiers): Implement history disabling.
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 1a8a703d5..b0b1190fa 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -391,14 +391,56 @@ history_site_visited_cb (EphyHistory *gh, const char *url, EphyBookmarks *eb)
}
static void
+clear_favorites (EphyBookmarks *bookmarks)
+{
+ EphyNode *node;
+ GPtrArray *children;
+ int i;
+ gboolean was_immutable;
+
+ /* clear the favourites */
+
+ was_immutable = ephy_node_db_is_immutable (bookmarks->priv->db);
+ ephy_node_db_set_immutable (bookmarks->priv->db, FALSE);
+
+ node = bookmarks->priv->favorites;
+ children = ephy_node_get_children (node);
+ for (i = children->len - 1; i >= 0; i--)
+ {
+ EphyNode *kid;
+
+ kid = g_ptr_array_index (children, i);
+
+ ephy_node_remove_child (node, kid);
+ }
+
+ ephy_node_db_set_immutable (bookmarks->priv->db, was_immutable);
+
+ ephy_bookmarks_update_favorites (bookmarks);
+}
+
+static void
+history_cleared_cb (EphyHistory *history, EphyBookmarks *bookmarks)
+{
+ clear_favorites (bookmarks);
+}
+
+static void
ephy_setup_history_notifiers (EphyBookmarks *eb)
{
EphyHistory *history;
history = EPHY_HISTORY (ephy_embed_shell_get_global_history (embed_shell));
+ if (ephy_history_is_enabled (history) == FALSE)
+ {
+ clear_favorites (eb);
+ }
+
g_signal_connect (history, "visited",
G_CALLBACK (history_site_visited_cb), eb);
+ g_signal_connect (history, "cleared",
+ G_CALLBACK (history_cleared_cb), eb);
}
static void