Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gedit/ChangeLog,v
retrieving revision 1.716
diff -u -p -r1.716 ChangeLog
--- ChangeLog	20 Apr 2006 10:40:45 -0000	1.716
+++ ChangeLog	20 Apr 2006 16:20:33 -0000
@@ -1,3 +1,36 @@
+2006-04-20  Paolo Maggi  <paolo@gnome.org>
+
+	Fixes bug #338173 - Gedit show keyring store password on the window 
+	title bar
+	
+	* gedit/gedit-utils.[ch] (gedit_utils_format_uri_for_display): new
+	function similar to gnome_vfs_format_uri_for_display but that hides
+	the password if needed
+	
+	* gedit/gedit-commands-file.c (load_file_list)
+	(replace_read_only_file) (save_dialog_response_cb): use
+	gedit_utils_format_uri_for_display instead of 
+	gnome_vfs_format_uri_for_display
+
+	* gedit/gedit-io-error-message-area.c
+	(gedit_unrecoverable_loading_error_message_area_new)
+	(gedit_unrecoverable_reverting_error_message_area_new)
+	(gedit_conversion_error_while_loading_message_area_new)
+	(gedit_conversion_error_while_saving_message_area_new)
+	(gedit_file_already_open_warning_message_area_new)
+	(gedit_externally_modified_saving_error_message_area_new)
+	(gedit_no_backup_saving_error_message_area_new)
+	(gedit_unrecoverable_saving_error_message_area_new): ditto
+
+	* gedit/gedit-tab.c (show_saving_message_area): ditto
+	
+	* gedit/gedit-document.c (gedit_document_get_uri_for_display): hides
+	the password if needed
+
+	* gedit/gedit-window.c (recent_tooltip_func_gtk)
+	(recent_tooltip_func_uim): uses gedit_utils_format_uri_for_display 
+	instead of egg_recent_item_get_uri_for_display
+
 2006-04-18  Steve Frécinaux  <steve@istique.net>
 
 	* pixmaps/*.png: add Andreas Nilsson's puzzle icon (gedit-plugin.png).
Index: gedit/gedit-commands-file.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-commands-file.c,v
retrieving revision 1.6
diff -u -p -r1.6 gedit-commands-file.c
--- gedit/gedit-commands-file.c	14 Mar 2006 10:53:10 -0000	1.6
+++ gedit/gedit-commands-file.c	20 Apr 2006 16:20:33 -0000
@@ -121,7 +121,7 @@ load_file_list (GeditWindow         *win
 				/* There is only a single file to load */
 				gchar *uri_for_display;
 
-				uri_for_display = gnome_vfs_format_uri_for_display (uri);
+				uri_for_display = gedit_utils_format_uri_for_display (uri);
 
 				gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
 							       window->priv->generic_message_cid,
@@ -526,7 +526,7 @@ replace_read_only_file (GtkWindow   *par
 
 	gedit_debug (DEBUG_COMMANDS);
 
-	full_formatted_uri = gnome_vfs_format_uri_for_display (uri);
+	full_formatted_uri = gedit_utils_format_uri_for_display (uri);
 	g_return_val_if_fail (full_formatted_uri != NULL, FALSE);
 
 	/* Truncate the URI so it doesn't get insanely wide. Note that even
@@ -610,7 +610,7 @@ save_dialog_response_cb (GeditFileChoose
 		doc = gedit_tab_get_document (tab);
 		g_return_if_fail (GEDIT_IS_DOCUMENT (doc));
 
-		uri_for_display = gnome_vfs_format_uri_for_display (uri);
+		uri_for_display = gedit_utils_format_uri_for_display (uri);
 
 		gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
 					        window->priv->generic_message_cid,
Index: gedit/gedit-document.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-document.c,v
retrieving revision 1.130
diff -u -p -r1.130 gedit-document.c
--- gedit/gedit-document.c	19 Feb 2006 18:01:09 -0000	1.130
+++ gedit/gedit-document.c	20 Apr 2006 16:20:34 -0000
@@ -772,9 +772,22 @@ gedit_document_get_uri_for_display (Gedi
 
 	if (doc->priv->uri == NULL)
 		return g_strdup_printf (_("Unsaved Document %d"),
-					doc->priv->untitled_number);	      
-	else
+					doc->priv->untitled_number);
+	else if (doc->priv->vfs_uri == NULL)
 		return gnome_vfs_format_uri_for_display (doc->priv->uri);
+	else
+	{	
+		gchar *name;
+		gchar *uri_for_display;
+		
+		name = gnome_vfs_uri_to_string (doc->priv->vfs_uri, GNOME_VFS_URI_HIDE_PASSWORD);
+		g_return_val_if_fail (name != NULL, gnome_vfs_format_uri_for_display (doc->priv->uri));
+		
+		uri_for_display = gnome_vfs_format_uri_for_display (name);
+		g_free (name);
+		
+		return uri_for_display;
+	}
 }
 
 /* move to gedit-utils? */
Index: gedit/gedit-io-error-message-area.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-io-error-message-area.c,v
retrieving revision 1.4
diff -u -p -r1.4 gedit-io-error-message-area.c
--- gedit/gedit-io-error-message-area.c	19 Jan 2006 19:36:47 -0000	1.4
+++ gedit/gedit-io-error-message-area.c	20 Apr 2006 16:20:34 -0000
@@ -129,7 +129,7 @@ gedit_unrecoverable_loading_error_messag
 	g_return_val_if_fail (error != NULL, NULL);
 	g_return_val_if_fail (error->domain == GEDIT_DOCUMENT_ERROR, NULL);
 
-	full_formatted_uri = gnome_vfs_format_uri_for_display (uri);
+	full_formatted_uri = gedit_utils_format_uri_for_display (uri);
 
 	/* Truncate the URI so it doesn't get insanely wide. Note that even
 	 * though the dialog uses wrapped text, if the URI doesn't contain
@@ -357,7 +357,7 @@ gedit_unrecoverable_reverting_error_mess
 	g_return_val_if_fail (error != NULL, NULL);
 	g_return_val_if_fail (error->domain == GEDIT_DOCUMENT_ERROR, NULL);
 
-	full_formatted_uri = gnome_vfs_format_uri_for_display (uri);
+	full_formatted_uri = gedit_utils_format_uri_for_display (uri);
 
 	/* Truncate the URI so it doesn't get insanely wide. Note that even
 	 * though the dialog uses wrapped text, if the URI doesn't contain
@@ -685,7 +685,7 @@ gedit_conversion_error_while_loading_mes
 	g_return_val_if_fail ((error->domain == G_CONVERT_ERROR) ||
 			      (error->domain == GEDIT_CONVERT_ERROR), NULL);
 	
-	full_formatted_uri = gnome_vfs_format_uri_for_display (uri);
+	full_formatted_uri = gedit_utils_format_uri_for_display (uri);
 
 	/* Truncate the URI so it doesn't get insanely wide. Note that even
 	 * though the dialog uses wrapped text, if the URI doesn't contain
@@ -751,7 +751,7 @@ gedit_conversion_error_while_saving_mess
 	g_return_val_if_fail (error->domain == G_CONVERT_ERROR, NULL);
 	g_return_val_if_fail (encoding != NULL, NULL);
 	
-	full_formatted_uri = gnome_vfs_format_uri_for_display (uri);
+	full_formatted_uri = gedit_utils_format_uri_for_display (uri);
 
 	/* Truncate the URI so it doesn't get insanely wide. Note that even
 	 * though the dialog uses wrapped text, if the URI doesn't contain
@@ -815,7 +815,7 @@ gedit_file_already_open_warning_message_
        	gchar *uri_for_display;
        	gchar *temp_uri_for_display;
 	
-	full_formatted_uri = gnome_vfs_format_uri_for_display (uri);
+	full_formatted_uri = gedit_utils_format_uri_for_display (uri);
 
 	/* Truncate the URI so it doesn't get insanely wide. Note that even
 	 * though the dialog uses wrapped text, if the URI doesn't contain
@@ -907,7 +907,7 @@ gedit_externally_modified_saving_error_m
 	g_return_val_if_fail (error->domain == GEDIT_DOCUMENT_ERROR, NULL);
 	g_return_val_if_fail (error->code == GEDIT_DOCUMENT_ERROR_EXTERNALLY_MODIFIED, NULL);
 
-	full_formatted_uri = gnome_vfs_format_uri_for_display (uri);
+	full_formatted_uri = gedit_utils_format_uri_for_display (uri);
 
 	/* Truncate the URI so it doesn't get insanely wide. Note that even
 	 * though the dialog uses wrapped text, if the URI doesn't contain
@@ -1002,7 +1002,7 @@ gedit_no_backup_saving_error_message_are
 	g_return_val_if_fail (error->domain == GEDIT_DOCUMENT_ERROR, NULL);
 	g_return_val_if_fail (error->code == GEDIT_DOCUMENT_ERROR_CANT_CREATE_BACKUP, NULL);
 
-	full_formatted_uri = gnome_vfs_format_uri_for_display (uri);
+	full_formatted_uri = gedit_utils_format_uri_for_display (uri);
 
 	/* Truncate the URI so it doesn't get insanely wide. Note that even
 	 * though the dialog uses wrapped text, if the URI doesn't contain
@@ -1097,7 +1097,7 @@ gedit_unrecoverable_saving_error_message
 	g_return_val_if_fail (error != NULL, NULL);
 	g_return_val_if_fail (error->domain == GEDIT_DOCUMENT_ERROR, NULL);
 
-	full_formatted_uri = gnome_vfs_format_uri_for_display (uri);
+	full_formatted_uri = gedit_utils_format_uri_for_display (uri);
 
 	/* Truncate the URI so it doesn't get insanely wide. Note that even
 	 * though the dialog uses wrapped text, if the URI doesn't contain
Index: gedit/gedit-tab.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-tab.c,v
retrieving revision 1.10
diff -u -p -r1.10 gedit-tab.c
--- gedit/gedit-tab.c	13 Mar 2006 07:40:06 -0000	1.10
+++ gedit/gedit-tab.c	20 Apr 2006 16:20:34 -0000
@@ -734,7 +734,7 @@ show_saving_message_area (GeditTab *tab)
 
 		from = short_name;
 
-		to = gnome_vfs_format_uri_for_display (tab->priv->tmp_save_uri);
+		to = gedit_utils_format_uri_for_display (tab->priv->tmp_save_uri);
 
 		str = gedit_utils_str_middle_truncate (to, 
 						       MAX (20, MAX_MSG_LENGTH - len));
Index: gedit/gedit-utils.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-utils.c,v
retrieving revision 1.75
diff -u -p -r1.75 gedit-utils.c
--- gedit/gedit-utils.c	12 Feb 2006 16:51:32 -0000	1.75
+++ gedit/gedit-utils.c	20 Apr 2006 16:20:34 -0000
@@ -1012,3 +1012,56 @@ gedit_utils_make_canonical_uri_from_shel
 	
 	return NULL;
 }
+
+/**
+ * gedit_utils_format_uri_for_display:
+ * @uri: uri to be displayed.
+ *
+ * Filter, modify, unescape and change @uri to make it appropriate
+ * for display to users.
+ * 
+ * Rules:
+ * <ul>
+ * <li>file: uri without fragments should appear as local paths.</li>
+ * <li>file: uri with fragments should appear as file:uri.</li>
+ * <li>All other uri appear as expected.</li>
+ * </ul>
+ *
+ * This function is very similar to gnome_vfs_format_uri_for_display but remove
+ * the password from the resulting string
+ *
+ * Return value: a string which represents @uri and can be displayed.
+ */
+gchar *
+gedit_utils_format_uri_for_display (const gchar *uri)
+{
+	GnomeVFSURI *vfs_uri;
+	
+	g_return_val_if_fail (uri != NULL, NULL);
+
+	/* Note: vfs_uri may be NULL for some valid but
+	 * unsupported uris */
+	vfs_uri = gnome_vfs_uri_new (uri);
+	
+	if (vfs_uri == NULL)
+	{
+		/* We may disclose the password here, but there is nothing we
+		 * can do since we cannot get a valid vfs_uri */
+		return gnome_vfs_format_uri_for_display (uri);
+	}
+	else
+	{	
+		gchar *name;
+		gchar *uri_for_display;
+		
+		name = gnome_vfs_uri_to_string (vfs_uri, GNOME_VFS_URI_HIDE_PASSWORD);
+		g_return_val_if_fail (name != NULL, gnome_vfs_format_uri_for_display (uri));
+		
+		uri_for_display = gnome_vfs_format_uri_for_display (name);
+		g_free (name);
+		
+		gnome_vfs_uri_unref (vfs_uri);
+		
+		return uri_for_display;
+	}
+}
Index: gedit/gedit-utils.h
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-utils.h,v
retrieving revision 1.37
diff -u -p -r1.37 gedit-utils.h
--- gedit/gedit-utils.h	3 Jan 2006 17:19:10 -0000	1.37
+++ gedit/gedit-utils.h	20 Apr 2006 16:20:34 -0000
@@ -132,6 +132,11 @@ gboolean	 gedit_utils_get_glade_widgets	
 /* Return NULL if str is not a valid URI and/or filename */
 gchar		*gedit_utils_make_canonical_uri_from_shell_arg
 							(const gchar *str);
+		
+/* Like gnome_vfs_format_uri_for_display but removes the password from the 
+ * resulting string */
+gchar		*gedit_utils_format_uri_for_display 	(const gchar *uri);
+
 G_END_DECLS
 
 #endif /* __GEDIT_UTILS_H__ */
Index: gedit/gedit-window.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-window.c,v
retrieving revision 1.20
diff -u -p -r1.20 gedit-window.c
--- gedit/gedit-window.c	3 Mar 2006 16:31:17 -0000	1.20
+++ gedit/gedit-window.c	20 Apr 2006 16:20:35 -0000
@@ -850,7 +850,7 @@ recent_tooltip_func_gtk (GtkTooltips   *
 	gchar *uri_for_display;
 	gchar *trunc_uri;
 
-	uri_for_display = egg_recent_item_get_uri_for_display (item);
+	uri_for_display = gedit_utils_format_uri_for_display (egg_recent_item_peek_uri (item));
 	g_return_if_fail (uri_for_display != NULL);
 
 	trunc_uri = gedit_utils_str_middle_truncate (uri_for_display,
@@ -875,7 +875,7 @@ recent_tooltip_func_uim (EggRecentItem *
 	gchar *uri_for_display;
 	gchar *trunc_uri;
 
-	uri_for_display = egg_recent_item_get_uri_for_display (item);
+	uri_for_display = gedit_utils_format_uri_for_display (egg_recent_item_peek_uri (item));
 	g_return_val_if_fail (uri_for_display != NULL, NULL);
 
 	trunc_uri = gedit_utils_str_middle_truncate (uri_for_display,
