diff options
author | Darin Adler <darin@src.gnome.org> | 2001-02-27 23:25:53 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2001-02-27 23:25:53 +0000 |
commit | 27d4785eb3c19e2b8f2c1777cea8b1916ce89908 (patch) | |
tree | dee9770f7d722ae79d69809de90258d5e90cf412 /src/nautilus-window.c | |
parent | c05003831fc379d8e743cb8392c0b9175707a367 (diff) | |
download | nautilus-27d4785eb3c19e2b8f2c1777cea8b1916ce89908.tar.gz |
reviewed by: John Sullivan <sullivan@eazel.com>
Finished bug 6950 (need new report_redirect call in addition to
report_location_change).
* src/nautilus-window-manage-views.c: (update_history): Split
out this part of update_for_new_location, since it really was
begging for a case statement. Added a redirect case, which does
nothing (just like reload, but it needs a separate case to make
sense anyway).
(update_for_new_location): Use the new update_history.
(report_redirect_callback): Do nothing if we are no longer at the
"from" location of the redirect. In the case where we do redirect,
make sure we update history properly, but don't update the back
and forward lists at all.
* src/nautilus-window-private.h:
* src/nautilus-window.c: (remove_from_history_list): New function
shared by the normal add case and the new remove call.
(add_to_history_list): New name for nautilus_add_to_history_list
to help emphasize it's a private function. Change to use
remove_from_history_list.
(nautilus_remove_from_history_list_no_notify): New call for use by
the redirect code.
(real_add_current_location_to_history_list),
(nautilus_window_add_current_location_to_history_list): Moved
these functions down to avoid adding a prototype for
add_to_history_list.
Diffstat (limited to 'src/nautilus-window.c')
-rw-r--r-- | src/nautilus-window.c | 82 |
1 files changed, 50 insertions, 32 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 89f563d31..e978d876e 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -1509,32 +1509,39 @@ free_history_list (void) history_list = NULL; } +/* Remove the this URI from the history list. + * Do not sent out a change notice. + * We pass in a bookmark for convenience. + */ static void -real_add_current_location_to_history_list (NautilusWindow *window) -{ - g_assert (NAUTILUS_IS_WINDOW (window)); - - nautilus_add_to_history_list (window->current_location_bookmark); -} - -void -nautilus_window_add_current_location_to_history_list (NautilusWindow *window) +remove_from_history_list (NautilusBookmark *bookmark) { - g_assert (NAUTILUS_IS_WINDOW (window)); + GList *node; - NAUTILUS_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window, - add_current_location_to_history_list, (window)); + /* Compare only the uris here. Comparing the names also is not + * necessary and can cause problems due to the asynchronous + * nature of when the title of the window is set. + */ + node = g_list_find_custom (history_list, + bookmark, + nautilus_bookmark_compare_uris); + + /* Remove any older entry for this same item. There can be at most 1. */ + if (node != NULL) { + history_list = g_list_remove_link (history_list, node); + gtk_object_unref (node->data); + g_list_free_1 (node); + } } -void -nautilus_add_to_history_list (NautilusBookmark *bookmark) +static void +add_to_history_list (NautilusBookmark *bookmark) { /* Note that the history is shared amongst all windows so * this is not a NautilusWindow function. Perhaps it belongs * in its own file. */ static gboolean free_history_list_is_set_up; - GList *found_link; g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark)); @@ -1544,23 +1551,7 @@ nautilus_add_to_history_list (NautilusBookmark *bookmark) } gtk_object_ref (GTK_OBJECT (bookmark)); - - /* Compare only the uris here. Comparing the names also is not necessary - * and can cause problems due to the asynchronous nature of when the title - * of the window is set. - */ - found_link = g_list_find_custom (history_list, - bookmark, - nautilus_bookmark_compare_uris); - - /* Remove any older entry for this same item. There can be at most 1. */ - if (found_link != NULL) { - history_list = g_list_remove_link (history_list, found_link); - gtk_object_unref (found_link->data); - g_list_free_1 (found_link); - } - - /* New item goes first. */ + remove_from_history_list (bookmark); history_list = g_list_prepend (history_list, bookmark); /* Tell world that history list has changed. At least all the @@ -1570,6 +1561,33 @@ nautilus_add_to_history_list (NautilusBookmark *bookmark) } void +nautilus_remove_from_history_list_no_notify (const char *uri) +{ + NautilusBookmark *bookmark; + + bookmark = nautilus_bookmark_new (uri, ""); + remove_from_history_list (bookmark); + gtk_object_unref (GTK_OBJECT (bookmark)); +} + +static void +real_add_current_location_to_history_list (NautilusWindow *window) +{ + g_assert (NAUTILUS_IS_WINDOW (window)); + + add_to_history_list (window->current_location_bookmark); +} + +void +nautilus_window_add_current_location_to_history_list (NautilusWindow *window) +{ + g_assert (NAUTILUS_IS_WINDOW (window)); + + NAUTILUS_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window, + add_current_location_to_history_list, (window)); +} + +void nautilus_window_clear_forward_list (NautilusWindow *window) { nautilus_gtk_object_list_free (window->forward_list); |