summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Meeks <michael@ximian.com>2002-01-25 12:22:25 +0000
committerMichael Meeks <michael@src.gnome.org>2002-01-25 12:22:25 +0000
commit45d43076d643603a851a65b5aa8972311a30338a (patch)
tree54bbee974039865136c87cb889eeaf47df623094 /src
parentcae57667952819daaf1e6b5ad67b83f255a0b84b (diff)
downloadnautilus-45d43076d643603a851a65b5aa8972311a30338a.tar.gz
return a 'changed' boolean.
2002-01-25 Michael Meeks <michael@ximian.com> * libnautilus-private/nautilus-bookmark.c (nautilus_bookmark_set_name): return a 'changed' boolean. * src/nautilus-window-manage-views.c (update_title): only re-send history if it changed. * src/nautilus-window.c (add_to_history_list): prune the end of the list more succinctly, don't fire send_history_list_changed if we didn't change the list.
Diffstat (limited to 'src')
-rw-r--r--src/nautilus-navigation-window.c37
-rw-r--r--src/nautilus-object-window.c37
-rw-r--r--src/nautilus-spatial-window.c37
-rw-r--r--src/nautilus-window-manage-views.c8
-rw-r--r--src/nautilus-window.c37
5 files changed, 93 insertions, 63 deletions
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index adbecdbdc..a40465a48 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -1734,7 +1734,7 @@ void
nautilus_send_history_list_changed (void)
{
g_signal_emit_by_name (nautilus_signaller_get_current (),
- "history_list_changed");
+ "history_list_changed");
}
static void
@@ -1776,8 +1776,9 @@ add_to_history_list (NautilusBookmark *bookmark)
* this is not a NautilusWindow function. Perhaps it belongs
* in its own file.
*/
+ int i;
+ GList *l, *next;
static gboolean free_history_list_is_set_up;
- int extra_count, index;
g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
@@ -1786,21 +1787,27 @@ add_to_history_list (NautilusBookmark *bookmark)
free_history_list_is_set_up = TRUE;
}
- g_object_ref (bookmark);
- remove_from_history_list (bookmark);
- history_list = g_list_prepend (history_list, bookmark);
-
- 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) {
- g_object_unref (history_list->data);
- history_list = g_list_remove (history_list, history_list->data);
+/* g_warning ("Add to history list '%s' '%s'",
+ nautilus_bookmark_get_name (bookmark),
+ nautilus_bookmark_get_uri (bookmark)); */
+
+ if (!history_list ||
+ nautilus_bookmark_compare_uris (history_list->data, bookmark)) {
+ g_object_ref (bookmark);
+ remove_from_history_list (bookmark);
+ history_list = g_list_prepend (history_list, bookmark);
+
+ for (i = 0, l = history_list; l; l = next) {
+ next = l->next;
+
+ if (i++ >= MAX_HISTORY_ITEMS) {
+ g_object_unref (l->data);
+ history_list = g_list_delete_link (history_list, l);
+ }
}
- history_list = g_list_reverse (history_list);
- }
- nautilus_send_history_list_changed ();
+ nautilus_send_history_list_changed ();
+ }
}
void
diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c
index adbecdbdc..a40465a48 100644
--- a/src/nautilus-object-window.c
+++ b/src/nautilus-object-window.c
@@ -1734,7 +1734,7 @@ void
nautilus_send_history_list_changed (void)
{
g_signal_emit_by_name (nautilus_signaller_get_current (),
- "history_list_changed");
+ "history_list_changed");
}
static void
@@ -1776,8 +1776,9 @@ add_to_history_list (NautilusBookmark *bookmark)
* this is not a NautilusWindow function. Perhaps it belongs
* in its own file.
*/
+ int i;
+ GList *l, *next;
static gboolean free_history_list_is_set_up;
- int extra_count, index;
g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
@@ -1786,21 +1787,27 @@ add_to_history_list (NautilusBookmark *bookmark)
free_history_list_is_set_up = TRUE;
}
- g_object_ref (bookmark);
- remove_from_history_list (bookmark);
- history_list = g_list_prepend (history_list, bookmark);
-
- 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) {
- g_object_unref (history_list->data);
- history_list = g_list_remove (history_list, history_list->data);
+/* g_warning ("Add to history list '%s' '%s'",
+ nautilus_bookmark_get_name (bookmark),
+ nautilus_bookmark_get_uri (bookmark)); */
+
+ if (!history_list ||
+ nautilus_bookmark_compare_uris (history_list->data, bookmark)) {
+ g_object_ref (bookmark);
+ remove_from_history_list (bookmark);
+ history_list = g_list_prepend (history_list, bookmark);
+
+ for (i = 0, l = history_list; l; l = next) {
+ next = l->next;
+
+ if (i++ >= MAX_HISTORY_ITEMS) {
+ g_object_unref (l->data);
+ history_list = g_list_delete_link (history_list, l);
+ }
}
- history_list = g_list_reverse (history_list);
- }
- nautilus_send_history_list_changed ();
+ nautilus_send_history_list_changed ();
+ }
}
void
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index adbecdbdc..a40465a48 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -1734,7 +1734,7 @@ void
nautilus_send_history_list_changed (void)
{
g_signal_emit_by_name (nautilus_signaller_get_current (),
- "history_list_changed");
+ "history_list_changed");
}
static void
@@ -1776,8 +1776,9 @@ add_to_history_list (NautilusBookmark *bookmark)
* this is not a NautilusWindow function. Perhaps it belongs
* in its own file.
*/
+ int i;
+ GList *l, *next;
static gboolean free_history_list_is_set_up;
- int extra_count, index;
g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
@@ -1786,21 +1787,27 @@ add_to_history_list (NautilusBookmark *bookmark)
free_history_list_is_set_up = TRUE;
}
- g_object_ref (bookmark);
- remove_from_history_list (bookmark);
- history_list = g_list_prepend (history_list, bookmark);
-
- 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) {
- g_object_unref (history_list->data);
- history_list = g_list_remove (history_list, history_list->data);
+/* g_warning ("Add to history list '%s' '%s'",
+ nautilus_bookmark_get_name (bookmark),
+ nautilus_bookmark_get_uri (bookmark)); */
+
+ if (!history_list ||
+ nautilus_bookmark_compare_uris (history_list->data, bookmark)) {
+ g_object_ref (bookmark);
+ remove_from_history_list (bookmark);
+ history_list = g_list_prepend (history_list, bookmark);
+
+ for (i = 0, l = history_list; l; l = next) {
+ next = l->next;
+
+ if (i++ >= MAX_HISTORY_ITEMS) {
+ g_object_unref (l->data);
+ history_list = g_list_delete_link (history_list, l);
+ }
}
- history_list = g_list_reverse (history_list);
- }
- nautilus_send_history_list_changed ();
+ nautilus_send_history_list_changed ();
+ }
}
void
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 6bed77b3b..a05c0399c 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -263,10 +263,12 @@ update_title (NautilusWindow *window)
if (window->sidebar != NULL) {
nautilus_sidebar_set_title (window->sidebar, title);
}
- nautilus_bookmark_set_name (window->current_location_bookmark, title);
- /* Name of item in history list may have changed, tell listeners. */
- nautilus_send_history_list_changed ();
+ if (title [0] != '\0' &&
+ nautilus_bookmark_set_name (window->current_location_bookmark, title)) {
+ /* Name of item in history list changed, tell listeners. */
+ nautilus_send_history_list_changed ();
+ }
/* warn all views and sidebar panels of the potential title change */
if (window->content_view != NULL) {
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index adbecdbdc..a40465a48 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1734,7 +1734,7 @@ void
nautilus_send_history_list_changed (void)
{
g_signal_emit_by_name (nautilus_signaller_get_current (),
- "history_list_changed");
+ "history_list_changed");
}
static void
@@ -1776,8 +1776,9 @@ add_to_history_list (NautilusBookmark *bookmark)
* this is not a NautilusWindow function. Perhaps it belongs
* in its own file.
*/
+ int i;
+ GList *l, *next;
static gboolean free_history_list_is_set_up;
- int extra_count, index;
g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
@@ -1786,21 +1787,27 @@ add_to_history_list (NautilusBookmark *bookmark)
free_history_list_is_set_up = TRUE;
}
- g_object_ref (bookmark);
- remove_from_history_list (bookmark);
- history_list = g_list_prepend (history_list, bookmark);
-
- 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) {
- g_object_unref (history_list->data);
- history_list = g_list_remove (history_list, history_list->data);
+/* g_warning ("Add to history list '%s' '%s'",
+ nautilus_bookmark_get_name (bookmark),
+ nautilus_bookmark_get_uri (bookmark)); */
+
+ if (!history_list ||
+ nautilus_bookmark_compare_uris (history_list->data, bookmark)) {
+ g_object_ref (bookmark);
+ remove_from_history_list (bookmark);
+ history_list = g_list_prepend (history_list, bookmark);
+
+ for (i = 0, l = history_list; l; l = next) {
+ next = l->next;
+
+ if (i++ >= MAX_HISTORY_ITEMS) {
+ g_object_unref (l->data);
+ history_list = g_list_delete_link (history_list, l);
+ }
}
- history_list = g_list_reverse (history_list);
- }
- nautilus_send_history_list_changed ();
+ nautilus_send_history_list_changed ();
+ }
}
void