[gthumb] avoid duplicates in the history
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] avoid duplicates in the history
- Date: Sun, 16 May 2010 07:50:09 +0000 (UTC)
commit 7399c6c0a567f1c4c21453befb4b6404a5b32158
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun May 16 09:49:16 2010 +0200
avoid duplicates in the history
[bug #615442]
gthumb/gth-browser.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 66e67de..c66f468 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -750,6 +750,21 @@ _gth_browser_add_to_history (GthBrowser *browser,
return;
if ((browser->priv->history_current == NULL) || ! g_file_equal (file, browser->priv->history_current->data)) {
+ GList *scan;
+
+ /* remove all the occurrences of file from the history */
+ for (scan = browser->priv->history_current; scan; /* void */) {
+ GList *next = scan->next;
+ GFile *file_in_history = scan->data;
+
+ if (g_file_equal (file, file_in_history)) {
+ browser->priv->history_current = g_list_remove_link (browser->priv->history_current, scan);
+ _g_object_list_unref (scan);
+ }
+
+ scan = next;
+ }
+
browser->priv->history = g_list_prepend (browser->priv->history, g_object_ref (file));
browser->priv->history_current = browser->priv->history;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]