[PATCH] fix handling of subsequently visited bookmarks with equal basenames



Bug 331383 [1] contains the details, proposed patch attached.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=331383
Index: src/nautilus-navigation-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-navigation-window.c,v
retrieving revision 1.442
diff -u -p -r1.442 nautilus-navigation-window.c
--- src/nautilus-navigation-window.c	20 Dec 2005 09:11:07 -0000	1.442
+++ src/nautilus-navigation-window.c	27 Feb 2006 11:47:03 -0000
@@ -814,21 +814,26 @@ real_load_view_as_menu (NautilusWindow *
 	load_view_as_menu (window);
 }
 
-static void
+static gboolean
 real_set_title (NautilusWindow *window, const char *title)
 {
 	char *full_title;
 	char *window_title;
-	
-	EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
-			 set_title, (window, title));
-	
-	full_title = g_strdup_printf (_("%s - File Browser"), title);
+	gboolean changed;
 
-	window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH);
-	gtk_window_set_title (GTK_WINDOW (window), window_title);
-	g_free (window_title);
-	g_free (full_title);
+	changed = EEL_CALL_PARENT_WITH_RETURN_VALUE
+		(NAUTILUS_WINDOW_CLASS, set_title, (window, title));
+
+	if (changed) {
+		full_title = g_strdup_printf (_("%s - File Browser"), title);
+
+		window_title = eel_str_middle_truncate (full_title, MAX_TITLE_LENGTH);
+		gtk_window_set_title (GTK_WINDOW (window), window_title);
+		g_free (window_title);
+		g_free (full_title);
+	}
+
+	return changed;
 }
 
 static char *
Index: src/nautilus-spatial-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-spatial-window.c,v
retrieving revision 1.456
diff -u -p -r1.456 nautilus-spatial-window.c
--- src/nautilus-spatial-window.c	16 Jan 2006 23:48:19 -0000	1.456
+++ src/nautilus-spatial-window.c	27 Feb 2006 11:47:05 -0000
@@ -394,22 +394,25 @@ real_get_icon_name (NautilusWindow *wind
 	return nautilus_icon_factory_get_icon_for_file (window->details->viewed_file, FALSE);
 }
 
-static void
+static gboolean
 real_set_title (NautilusWindow *window, const char *title)
 {
+	gboolean changed;
 
-	EEL_CALL_PARENT (NAUTILUS_WINDOW_CLASS,
-			 set_title, (window, title));
-	
-	if (title[0] == '\0') {
+	changed = EEL_CALL_PARENT_WITH_RETURN_VALUE
+		(NAUTILUS_WINDOW_CLASS, set_title, (window, title));
+
+	if (changed && title[0] == '\0') {
 		gtk_window_set_title (GTK_WINDOW (window), _("Nautilus"));
-	} else {
+	} else if (changed) {
 		char *window_title;
 
 		window_title = eel_str_middle_truncate (title, MAX_TITLE_LENGTH);
 		gtk_window_set_title (GTK_WINDOW (window), window_title);
 		g_free (window_title);
 	}
+
+	return changed;
 }
 
 static void
Index: src/nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.460
diff -u -p -r1.460 nautilus-window.c
--- src/nautilus-window.c	31 Jan 2006 00:23:54 -0000	1.460
+++ src/nautilus-window.c	27 Feb 2006 11:47:11 -0000
@@ -1095,25 +1095,38 @@ nautilus_window_get_title (NautilusWindo
 						  get_title, (window));
 }
 
-static void
+static gboolean
 real_set_title (NautilusWindow *window,
 		const char *title)
 {
+	gboolean changed;
 	char *copy;
 
-	g_free (window->details->title);
-        window->details->title = g_strdup (title);
+	changed = FALSE;
+
+	if (eel_strcmp (title, window->details->title) != 0) {
+		changed = TRUE;
+
+		g_free (window->details->title);
+		window->details->title = g_strdup (title);
+	}
 
         if (eel_strlen (window->details->title) > 0 && window->current_location_bookmark &&
             nautilus_bookmark_set_name (window->current_location_bookmark, window->details->title)) {
+		changed = TRUE;
+
                 /* Name of item in history list changed, tell listeners. */
                 nautilus_send_history_list_changed ();
         }
 
-	copy = g_strdup (window->details->title);
-	g_signal_emit_by_name (window, "title_changed",
-			       copy);
-	g_free (copy);
+	if (changed) {
+		copy = g_strdup (window->details->title);
+		g_signal_emit_by_name (window, "title_changed",
+				       copy);
+		g_free (copy);
+	}
+
+	return changed;
 }
 
 /* Sets window->details->title, and the actual GtkWindow title which
@@ -1124,11 +1137,6 @@ nautilus_window_set_title (NautilusWindo
 {
 	g_return_if_fail (NAUTILUS_IS_WINDOW (window));
 
-	if (window->details->title != NULL
-	    && strcmp (title, window->details->title) == 0) {
-		return;
-	}
-
 	EEL_CALL_METHOD (NAUTILUS_WINDOW_CLASS, window,
                          set_title, (window, title));
 
Index: src/nautilus-window.h
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.h,v
retrieving revision 1.124
diff -u -p -r1.124 nautilus-window.h
--- src/nautilus-window.h	12 Dec 2005 16:59:11 -0000	1.124
+++ src/nautilus-window.h	27 Feb 2006 11:47:12 -0000
@@ -67,7 +67,7 @@ typedef struct {
         void   (* add_current_location_to_history_list) (NautilusWindow *window);
 
         char * (* get_title) (NautilusWindow *window);
-        void   (* set_title) (NautilusWindow *window, const char *title);
+        gboolean (* set_title) (NautilusWindow *window, const char *title);
         char * (* get_icon_name) (NautilusWindow *window);
 
         void   (* load_view_as_menu) (NautilusWindow *window);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]