aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-10-06 20:21:59 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-10-06 20:21:59 +0800
commit14e3040722bdd3115777a6d4098fea87108a6f87 (patch)
tree8ed8a68fc74c67d46d7d0ebcb7c52df60ca81de2 /embed
parent8bad6a3d1faa10662b08783e49ebb3f488762973 (diff)
downloadgsoc2013-epiphany-14e3040722bdd3115777a6d4098fea87108a6f87.tar
gsoc2013-epiphany-14e3040722bdd3115777a6d4098fea87108a6f87.tar.gz
gsoc2013-epiphany-14e3040722bdd3115777a6d4098fea87108a6f87.tar.bz2
gsoc2013-epiphany-14e3040722bdd3115777a6d4098fea87108a6f87.tar.lz
gsoc2013-epiphany-14e3040722bdd3115777a6d4098fea87108a6f87.tar.xz
gsoc2013-epiphany-14e3040722bdd3115777a6d4098fea87108a6f87.tar.zst
gsoc2013-epiphany-14e3040722bdd3115777a6d4098fea87108a6f87.zip
More granular filtering update
2003-10-06 Marco Pesenti Gritti <marco@gnome.org> * src/ephy-history-window.c: (setup_filters), (site_node_selected_cb), (search_entry_search_cb), (time_optionmenu_changed_cb): More granular filtering update 2003-10-06 Marco Pesenti Gritti <marco@gnome.org> * embed/ephy-history.c: (update_host_on_child_remove), (update_hosts), (page_removed_from_host_cb), (ephy_history_init), (ephy_history_finalize): Update host last visit when removing sites from it.
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-history.c74
1 files changed, 70 insertions, 4 deletions
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 8ba9edbb8..911567dda 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -57,6 +57,7 @@ struct EphyHistoryPrivate
GHashTable *pages_hash;
GStaticRWLock *pages_hash_lock;
int autosave_timeout;
+ guint update_hosts_idle;
};
enum
@@ -357,10 +358,68 @@ periodic_save_cb (EphyHistory *eh)
return TRUE;
}
+static void
+update_host_on_child_remove (EphyNode *node)
+{
+ GPtrArray *children;
+ int i, host_last_visit, new_host_last_visit = 0;
+
+ if (ephy_node_get_n_children (node) == 0)
+ {
+ ephy_node_unref (node);
+ return;
+ }
+
+ host_last_visit = ephy_node_get_property_int
+ (node, EPHY_NODE_PAGE_PROP_LAST_VISIT);
+
+ children = ephy_node_get_children (node);
+ for (i = 0; i < children->len; i++)
+ {
+ EphyNode *kid;
+ int last_visit;
+
+ kid = g_ptr_array_index (children, i);
+
+ last_visit = ephy_node_get_property_int
+ (kid, EPHY_NODE_PAGE_PROP_LAST_VISIT);
+
+ if (last_visit > new_host_last_visit)
+ {
+ new_host_last_visit = last_visit;
+ }
+ }
+ ephy_node_thaw (node);
+
+ if (host_last_visit != new_host_last_visit)
+ {
+ GValue value = { 0, };
+
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, new_host_last_visit);
+ ephy_node_set_property (node, EPHY_NODE_PAGE_PROP_LAST_VISIT,
+ &value);
+ g_value_unset (&value);
+ }
+}
+
static gboolean
-unref_empty_host (EphyNode *node)
+update_hosts (EphyHistory *eh)
{
- ephy_node_unref (node);
+ GPtrArray *children;
+ int i;
+
+ children = ephy_node_get_children (eh->priv->hosts);
+ ephy_node_thaw (eh->priv->hosts);
+ for (i = 0; i < children->len; i++)
+ {
+ EphyNode *kid;
+
+ kid = g_ptr_array_index (children, i);
+ update_host_on_child_remove (kid);
+ }
+
+ eh->priv->update_hosts_idle = 0;
return FALSE;
}
@@ -371,9 +430,10 @@ page_removed_from_host_cb (EphyNode *node,
guint old_index,
EphyHistory *eb)
{
- if (ephy_node_get_n_children (node) == 0)
+ if (!eb->priv->update_hosts_idle)
{
- g_idle_add ((GSourceFunc)unref_empty_host, node);
+ eb->priv->update_hosts_idle = g_idle_add
+ ((GSourceFunc)update_hosts, eb);
}
}
@@ -397,6 +457,7 @@ ephy_history_init (EphyHistory *eb)
EphyNodeDb *db;
eb->priv = EPHY_HISTORY_GET_PRIVATE (eb);
+ eb->priv->update_hosts_idle = 0;
db = ephy_node_db_new (EPHY_NODE_DB_HISTORY);
eb->priv->db = db;
@@ -477,6 +538,11 @@ ephy_history_finalize (GObject *object)
{
EphyHistory *eb = EPHY_HISTORY (object);
+ if (eb->priv->update_hosts_idle)
+ {
+ g_source_remove (eb->priv->update_hosts_idle);
+ }
+
ephy_history_save (eb);
ephy_node_unref (eb->priv->pages);