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.
This commit is contained in:
Michael Meeks 2002-01-25 12:22:25 +00:00 committed by Michael Meeks
parent cae5766795
commit 45d43076d6
8 changed files with 112 additions and 66 deletions

View file

@ -1,3 +1,16 @@
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.
2002-01-24 Darin Adler <darin@bentspoon.com>
GNOME2_CONVERSION_COMPLETE eradication campaign

View file

@ -152,7 +152,7 @@ nautilus_bookmark_compare_with (gconstpointer a, gconstpointer b)
}
if (!eel_uris_match (bookmark_a->details->uri,
bookmark_b->details->uri)) {
bookmark_b->details->uri)) {
return 1;
}
@ -182,7 +182,7 @@ nautilus_bookmark_compare_uris (gconstpointer a, gconstpointer b)
bookmark_b = NAUTILUS_BOOKMARK (b);
return !eel_uris_match (bookmark_a->details->uri,
bookmark_b->details->uri);
bookmark_b->details->uri);
}
NautilusBookmark *
@ -284,21 +284,24 @@ nautilus_bookmark_get_uri (NautilusBookmark *bookmark)
* Change the user-displayed name of a bookmark.
* @new_name: The new user-displayed name for this bookmark, mustn't be NULL.
*
* Returns: TRUE if the name changed else FALSE.
**/
void
gboolean
nautilus_bookmark_set_name (NautilusBookmark *bookmark, const char *new_name)
{
g_return_if_fail(NAUTILUS_IS_BOOKMARK (bookmark));
g_return_if_fail (new_name != NULL);
g_return_val_if_fail (new_name != NULL, FALSE);
g_return_val_if_fail (NAUTILUS_IS_BOOKMARK (bookmark), FALSE);
if (strcmp (new_name, bookmark->details->name) == 0) {
return;
return FALSE;
}
g_free (bookmark->details->name);
bookmark->details->name = g_strdup (new_name);
g_signal_emit (bookmark, signals[APPEARANCE_CHANGED], 0);
return TRUE;
}
static gboolean

View file

@ -79,7 +79,7 @@ NautilusBookmark * nautilus_bookmark_copy (NautilusBookmark
char * nautilus_bookmark_get_name (NautilusBookmark *bookmark);
char * nautilus_bookmark_get_uri (NautilusBookmark *bookmark);
NautilusScalableIcon *nautilus_bookmark_get_icon (NautilusBookmark *bookmark);
void nautilus_bookmark_set_name (NautilusBookmark *bookmark,
gboolean nautilus_bookmark_set_name (NautilusBookmark *bookmark,
const char *new_name);
gboolean nautilus_bookmark_uri_known_not_to_exist (NautilusBookmark *bookmark);
int nautilus_bookmark_compare_with (gconstpointer a,

View file

@ -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);
/* g_warning ("Add to history list '%s' '%s'",
nautilus_bookmark_get_name (bookmark),
nautilus_bookmark_get_uri (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);
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

View file

@ -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);
/* g_warning ("Add to history list '%s' '%s'",
nautilus_bookmark_get_name (bookmark),
nautilus_bookmark_get_uri (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);
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

View file

@ -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);
/* g_warning ("Add to history list '%s' '%s'",
nautilus_bookmark_get_name (bookmark),
nautilus_bookmark_get_uri (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);
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

View file

@ -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) {

View file

@ -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);
/* g_warning ("Add to history list '%s' '%s'",
nautilus_bookmark_get_name (bookmark),
nautilus_bookmark_get_uri (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);
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