diff options
author | John Sullivan <sullivan@src.gnome.org> | 2001-04-03 20:23:05 +0000 |
---|---|---|
committer | John Sullivan <sullivan@src.gnome.org> | 2001-04-03 20:23:05 +0000 |
commit | 28b5c6daf7ca9c9d892246b96f28259da37e8e04 (patch) | |
tree | ba22736341260be96ef9f3bfbcce4adf2c6ea83e /src | |
parent | 2e58e0b20b47dff49c9f2a664e2258b624b77844 (diff) | |
download | nautilus-28b5c6daf7ca9c9d892246b96f28259da37e8e04.tar.gz |
reviewed by: Darin Adler <darin@eazel.com>
* src/nautilus-window.c: (add_to_history_list):
Imposed a 50-item limit on the length of the
history list. Perhaps someday we'll save it to
disk and organize old items by date, but this
fixes the immediate problem of the list getting
unboundedly long.
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-navigation-window.c | 18 | ||||
-rw-r--r-- | src/nautilus-object-window.c | 18 | ||||
-rw-r--r-- | src/nautilus-spatial-window.c | 18 | ||||
-rw-r--r-- | src/nautilus-window.c | 18 |
4 files changed, 52 insertions, 20 deletions
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c index 68868be9e..a565562dc 100644 --- a/src/nautilus-navigation-window.c +++ b/src/nautilus-navigation-window.c @@ -87,8 +87,8 @@ */ #include "nautilus-desktop-window.h" -/* Milliseconds */ -#define STATUS_BAR_CLEAR_TIMEOUT 10000 +#define STATUS_BAR_CLEAR_TIMEOUT 10000 /* milliseconds */ +#define MAX_HISTORY_ITEMS 50 /* dock items */ #define LOCATION_BAR_PATH "/Location Bar" @@ -1611,6 +1611,7 @@ add_to_history_list (NautilusBookmark *bookmark) * in its own file. */ static gboolean free_history_list_is_set_up; + int extra_count, index; g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark)); @@ -1623,9 +1624,16 @@ add_to_history_list (NautilusBookmark *bookmark) remove_from_history_list (bookmark); history_list = g_list_prepend (history_list, bookmark); - /* Tell world that history list has changed. At least all the - * NautilusWindows (not just this one) are listening. - */ + extra_count = g_list_length (history_list) - MAX_HISTORY_ITEMS; + if (extra_count > 0) { + history_list = g_list_reverse (history_list); + for (index = 0; index < extra_count; ++index) { + gtk_object_unref (history_list->data); + history_list = g_list_remove (history_list, history_list->data); + } + history_list = g_list_reverse (history_list); + } + nautilus_send_history_list_changed (); } diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c index 68868be9e..a565562dc 100644 --- a/src/nautilus-object-window.c +++ b/src/nautilus-object-window.c @@ -87,8 +87,8 @@ */ #include "nautilus-desktop-window.h" -/* Milliseconds */ -#define STATUS_BAR_CLEAR_TIMEOUT 10000 +#define STATUS_BAR_CLEAR_TIMEOUT 10000 /* milliseconds */ +#define MAX_HISTORY_ITEMS 50 /* dock items */ #define LOCATION_BAR_PATH "/Location Bar" @@ -1611,6 +1611,7 @@ add_to_history_list (NautilusBookmark *bookmark) * in its own file. */ static gboolean free_history_list_is_set_up; + int extra_count, index; g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark)); @@ -1623,9 +1624,16 @@ add_to_history_list (NautilusBookmark *bookmark) remove_from_history_list (bookmark); history_list = g_list_prepend (history_list, bookmark); - /* Tell world that history list has changed. At least all the - * NautilusWindows (not just this one) are listening. - */ + extra_count = g_list_length (history_list) - MAX_HISTORY_ITEMS; + if (extra_count > 0) { + history_list = g_list_reverse (history_list); + for (index = 0; index < extra_count; ++index) { + gtk_object_unref (history_list->data); + history_list = g_list_remove (history_list, history_list->data); + } + history_list = g_list_reverse (history_list); + } + nautilus_send_history_list_changed (); } diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c index 68868be9e..a565562dc 100644 --- a/src/nautilus-spatial-window.c +++ b/src/nautilus-spatial-window.c @@ -87,8 +87,8 @@ */ #include "nautilus-desktop-window.h" -/* Milliseconds */ -#define STATUS_BAR_CLEAR_TIMEOUT 10000 +#define STATUS_BAR_CLEAR_TIMEOUT 10000 /* milliseconds */ +#define MAX_HISTORY_ITEMS 50 /* dock items */ #define LOCATION_BAR_PATH "/Location Bar" @@ -1611,6 +1611,7 @@ add_to_history_list (NautilusBookmark *bookmark) * in its own file. */ static gboolean free_history_list_is_set_up; + int extra_count, index; g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark)); @@ -1623,9 +1624,16 @@ add_to_history_list (NautilusBookmark *bookmark) remove_from_history_list (bookmark); history_list = g_list_prepend (history_list, bookmark); - /* Tell world that history list has changed. At least all the - * NautilusWindows (not just this one) are listening. - */ + extra_count = g_list_length (history_list) - MAX_HISTORY_ITEMS; + if (extra_count > 0) { + history_list = g_list_reverse (history_list); + for (index = 0; index < extra_count; ++index) { + gtk_object_unref (history_list->data); + history_list = g_list_remove (history_list, history_list->data); + } + history_list = g_list_reverse (history_list); + } + nautilus_send_history_list_changed (); } diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 68868be9e..a565562dc 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -87,8 +87,8 @@ */ #include "nautilus-desktop-window.h" -/* Milliseconds */ -#define STATUS_BAR_CLEAR_TIMEOUT 10000 +#define STATUS_BAR_CLEAR_TIMEOUT 10000 /* milliseconds */ +#define MAX_HISTORY_ITEMS 50 /* dock items */ #define LOCATION_BAR_PATH "/Location Bar" @@ -1611,6 +1611,7 @@ add_to_history_list (NautilusBookmark *bookmark) * in its own file. */ static gboolean free_history_list_is_set_up; + int extra_count, index; g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark)); @@ -1623,9 +1624,16 @@ add_to_history_list (NautilusBookmark *bookmark) remove_from_history_list (bookmark); history_list = g_list_prepend (history_list, bookmark); - /* Tell world that history list has changed. At least all the - * NautilusWindows (not just this one) are listening. - */ + extra_count = g_list_length (history_list) - MAX_HISTORY_ITEMS; + if (extra_count > 0) { + history_list = g_list_reverse (history_list); + for (index = 0; index < extra_count; ++index) { + gtk_object_unref (history_list->data); + history_list = g_list_remove (history_list, history_list->data); + } + history_list = g_list_reverse (history_list); + } + nautilus_send_history_list_changed (); } |