aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-history.c48
-rw-r--r--embed/ephy-history.h3
2 files changed, 16 insertions, 35 deletions
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 51dd68936..4c5cf6cbe 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -258,7 +258,7 @@ remove_obsolete_pages (EphyHistory *eb)
if (page_is_obsolete (kid, &current_date))
{
- ephy_history_remove (eb, kid);
+ ephy_node_unref (kid);
}
}
}
@@ -354,12 +354,27 @@ pages_removed_cb (EphyNode *node,
EphyNode *child,
EphyHistory *eb)
{
+ EphyNode *host;
+ int host_id;
+ int children;
+
g_static_rw_lock_writer_lock (eb->priv->pages_hash_lock);
g_hash_table_remove (eb->priv->pages_hash,
ephy_node_get_property_string (child, EPHY_NODE_PAGE_PROP_LOCATION));
g_static_rw_lock_writer_unlock (eb->priv->pages_hash_lock);
+
+ host_id = ephy_node_get_property_int (child, EPHY_NODE_PAGE_PROP_HOST_ID);
+ host = ephy_node_get_from_id (host_id);
+ children = ephy_node_get_n_children (host);
+
+ LOG ("Check host children: %d", children)
+
+ if (children == 0)
+ {
+ ephy_node_unref (host);
+ }
}
static gboolean
@@ -835,34 +850,3 @@ ephy_history_get_last_page (EphyHistory *gh)
return ephy_node_get_property_string
(gh->priv->last_page, EPHY_NODE_PAGE_PROP_LOCATION);
}
-
-void
-ephy_history_remove (EphyHistory *gh, EphyNode *node)
-{
- EphyNode *host;
- int host_id;
-
- LOG ("Remove history item")
-
- host_id = ephy_node_get_property_int (node, EPHY_NODE_PAGE_PROP_HOST_ID);
- if (host_id < 0)
- {
- EphyNode *tmp;
- while ((tmp = ephy_node_get_nth_child (node, 0)) != NULL)
- {
- ephy_node_unref (tmp);
- }
- ephy_node_unref (node);
- return;
- }
-
- host = ephy_node_get_from_id (host_id);
- if (ephy_node_get_n_children (host) == 1)
- {
- ephy_node_unref (host);
- }
- else
- {
- ephy_node_unref (node);
- }
-}
diff --git a/embed/ephy-history.h b/embed/ephy-history.h
index 4308e7adc..7d1d66ee4 100644
--- a/embed/ephy-history.h
+++ b/embed/ephy-history.h
@@ -91,9 +91,6 @@ void ephy_history_set_icon (EphyHistory *gh,
const char *url,
const char *icon);
-void ephy_history_remove (EphyHistory *gh,
- EphyNode *node);
-
void ephy_history_clear (EphyHistory *gh);
G_END_DECLS