[gedit] Bug 584271 - Fix showing mounts who's uri is a file name



commit c59e67e27ea11c6756c7291236338fcf44f24c73
Author: Garrett Regier <alias301 gmail com>
Date:   Sat May 22 00:50:29 2010 -0700

    Bug 584271 - Fix showing mounts who's uri is a file name

 gedit/gedit-utils.c |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/gedit/gedit-utils.c b/gedit/gedit-utils.c
index 618491c..880021e 100644
--- a/gedit/gedit-utils.c
+++ b/gedit/gedit-utils.c
@@ -716,30 +716,39 @@ gedit_utils_location_get_dirname_for_display (GFile *location)
 	if (mount != NULL)
 	{
 		gchar *mount_name;
-		gchar *path;
+		gchar *path = NULL;
+		gchar *dirname;
 
 		mount_name = g_mount_get_name (mount);
 		g_object_unref (mount);
 
-		/* obtain the "path" patrt of the uri */
-		if (gedit_utils_decode_uri (uri,
-					    NULL, NULL,
-					    NULL, NULL,
-					    &path))
-		{
-			gchar *dirname;
-			
-			dirname = gedit_utils_uri_get_dirname (path);
-			res = g_strdup_printf ("%s %s", mount_name, dirname);
+		/* obtain the "path" part of the uri */
+		gedit_utils_decode_uri (uri,
+					NULL, NULL,
+					NULL, NULL,
+					&path);
 
-			g_free (path);
-			g_free (dirname);
-			g_free (mount_name);
+		if (path == NULL)
+		{
+			dirname = gedit_utils_uri_get_dirname (uri);
 		}
 		else
 		{
+			dirname = gedit_utils_uri_get_dirname (path);
+		}
+		
+		if (dirname == NULL || strcmp (dirname, ".") == 0)
+		{
 			res = mount_name;
 		}
+		else
+		{
+			res = g_strdup_printf ("%s %s", mount_name, dirname);
+			g_free (mount_name);
+		}
+		
+		g_free (path);
+		g_free (dirname);
 	}
 	else
 	{



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