From 51b03dbcdfdc984834867a04792781ad8f073f65 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Fri, 22 Feb 2002 20:55:51 +0000 Subject: New helper function to remove all the matching URIs from the history. * e-shell-view.c (remove_uri_from_history): New helper function to remove all the matching URIs from the history. (history_uri_matching_func): Compare function for using e_history_remove_matching. (storage_set_removed_folder_callback): Call `remove_uri_from_history()'. * e-history.c (e_history_remove_matching): New. svn path=/trunk/; revision=15803 --- shell/e-history.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'shell/e-history.c') diff --git a/shell/e-history.c b/shell/e-history.c index 99579871e1..16df6cfc10 100644 --- a/shell/e-history.c +++ b/shell/e-history.c @@ -234,5 +234,29 @@ e_history_add (EHistory *history, priv->current_item = priv->current_item->next; } +void +e_history_remove_matching (EHistory *history, + const void *data, + GCompareFunc compare_func) +{ + EHistoryPrivate *priv; + GList *p; + + g_return_if_fail (history != NULL); + g_return_if_fail (E_IS_HISTORY (history)); + g_return_if_fail (compare_func != NULL); + + priv = history->priv; + + for (p = priv->items; p != NULL; p = p->next) { + if ((* compare_func) (data, p->data) == 0) { + if (priv->items == priv->current_item) + priv->items = priv->current_item = g_list_remove_link (priv->items, p); + else + priv->items = g_list_remove_link (priv->items, p); + } + } +} + E_MAKE_TYPE (e_history, "EHistory", EHistory, class_init, init, GTK_TYPE_OBJECT) -- cgit v1.2.3