diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2003-10-06 20:21:59 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2003-10-06 20:21:59 +0800 |
commit | 14e3040722bdd3115777a6d4098fea87108a6f87 (patch) | |
tree | 8ed8a68fc74c67d46d7d0ebcb7c52df60ca81de2 | |
parent | 8bad6a3d1faa10662b08783e49ebb3f488762973 (diff) | |
download | gsoc2013-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.
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | embed/ephy-history.c | 74 | ||||
-rw-r--r-- | src/ephy-history-window.c | 33 |
3 files changed, 106 insertions, 17 deletions
@@ -1,5 +1,21 @@ 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. + +2003-10-06 Marco Pesenti Gritti <marco@gnome.org> + * src/ephy-history-window.c: (search_entry_search_cb): update priv->select_node, signals are blocked so it would 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); diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index 596ac01da..5406e5895 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -937,24 +937,31 @@ add_by_word_filter (EphyHistoryWindow *editor, EphyNodeFilter *filter, int level } static void -setup_filters (EphyHistoryWindow *editor) +setup_filters (EphyHistoryWindow *editor, + gboolean pages, gboolean sites) { GDK_THREADS_ENTER (); - ephy_node_filter_empty (editor->priv->pages_filter); + if (pages) + { + ephy_node_filter_empty (editor->priv->pages_filter); - add_by_date_filter (editor, editor->priv->pages_filter, 0, NULL); - add_by_word_filter (editor, editor->priv->pages_filter, 1); - add_by_site_filter (editor, editor->priv->pages_filter, 2); + add_by_date_filter (editor, editor->priv->pages_filter, 0, NULL); + add_by_word_filter (editor, editor->priv->pages_filter, 1); + add_by_site_filter (editor, editor->priv->pages_filter, 2); - ephy_node_filter_done_changing (editor->priv->pages_filter); + ephy_node_filter_done_changing (editor->priv->pages_filter); + } - ephy_node_filter_empty (editor->priv->sites_filter); + if (sites) + { + ephy_node_filter_empty (editor->priv->sites_filter); - add_by_date_filter (editor, editor->priv->sites_filter, 0, - ephy_history_get_pages (editor->priv->history)); + add_by_date_filter (editor, editor->priv->sites_filter, 0, + ephy_history_get_pages (editor->priv->history)); - ephy_node_filter_done_changing (editor->priv->sites_filter); + ephy_node_filter_done_changing (editor->priv->sites_filter); + } GDK_THREADS_LEAVE (); } @@ -978,7 +985,7 @@ site_node_selected_cb (EphyNodeView *view, else { ephy_search_entry_clear (EPHY_SEARCH_ENTRY (editor->priv->search_entry)); - setup_filters (editor); + setup_filters (editor, TRUE, FALSE); } } @@ -1000,13 +1007,13 @@ search_entry_search_cb (GtkWidget *entry, char *search_text, EphyHistoryWindow * G_CALLBACK (site_node_selected_cb), editor); - setup_filters (editor); + setup_filters (editor, TRUE, FALSE); } static void time_optionmenu_changed_cb (GtkWidget *optionmenu, EphyHistoryWindow *editor) { - setup_filters (editor); + setup_filters (editor, TRUE, TRUE); } static GtkWidget * |