summaryrefslogtreecommitdiff
path: root/pluma/pluma-utils.c
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-07-14 10:35:22 +0300
committermonsta <[email protected]>2015-07-14 11:01:41 +0300
commit4fd854985045f9a661b3b4767907bde80a993c63 (patch)
treecfda7b748e0bc5a17bd3c9c014b67c84e0d26310 /pluma/pluma-utils.c
parent9d5f3b25353cc72b11f88477c715c8e6acd0ccc6 (diff)
downloadpluma-4fd854985045f9a661b3b4767907bde80a993c63.tar.bz2
pluma-4fd854985045f9a661b3b4767907bde80a993c63.tar.xz
window title: display full path to files on mounted drives
when opening a file on some mounted drive (local harddisk, usb flash drive, etc.), pluma now displays full path to file in the window title. previously it displayed only the mount name (like "100 GB Volume"). adapted from: https://git.gnome.org/browse/gedit/commit?id=c59e67e27ea11c6756c7291236338fcf44f24c73 credits to @jsenin for https://github.com/mate-desktop/pluma/pull/108
Diffstat (limited to 'pluma/pluma-utils.c')
-rw-r--r--pluma/pluma-utils.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/pluma/pluma-utils.c b/pluma/pluma-utils.c
index 7879e71d..ddfeee4a 100644
--- a/pluma/pluma-utils.c
+++ b/pluma/pluma-utils.c
@@ -749,30 +749,39 @@ pluma_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 (pluma_utils_decode_uri (uri,
- NULL, NULL,
- NULL, NULL,
- &path))
+ /* obtain the "path" part of the uri */
+ pluma_utils_decode_uri (uri,
+ NULL, NULL,
+ NULL, NULL,
+ &path);
+
+ if (path == NULL)
+ {
+ dirname = pluma_utils_uri_get_dirname (uri);
+ }
+ else
{
- gchar *dirname;
-
dirname = pluma_utils_uri_get_dirname (path);
- res = g_strdup_printf ("%s %s", mount_name, dirname);
+ }
- g_free (path);
- g_free (dirname);
- g_free (mount_name);
+ if (dirname == NULL || strcmp (dirname, ".") == 0)
+ {
+ res = mount_name;
}
else
{
- res = mount_name;
+ res = g_strdup_printf ("%s %s", mount_name, dirname);
+ g_free (mount_name);
}
+
+ g_free (path);
+ g_free (dirname);
}
else
{