aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <marco@ubuntu.com>2017-05-15 11:56:26 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2017-05-15 11:56:26 +0200
commit0f55cbb5272547ea7110feb2f29fd999fced306f (patch)
treec409b1511a6cabc900fa044e1d94dcae905296ef
parent20e557b031ccb95d4c4d7c0c37187060a87b96cf (diff)
downloadlibayatana-appindicator-0f55cbb5272547ea7110feb2f29fd999fced306f.tar.gz
libayatana-appindicator-0f55cbb5272547ea7110feb2f29fd999fced306f.tar.bz2
libayatana-appindicator-0f55cbb5272547ea7110feb2f29fd999fced306f.zip
app-indicator: don't append the snap prefix if the icon is saved in a well known readable path
-rw-r--r--src/app-indicator.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/app-indicator.c b/src/app-indicator.c
index a73e9a4..875c0b1 100644
--- a/src/app-indicator.c
+++ b/src/app-indicator.c
@@ -2066,6 +2066,7 @@ get_snap_prefix ()
static gchar *
append_snap_prefix (const gchar *path)
{
+ gint i;
gchar real_path[PATH_MAX];
const gchar *snap = get_snap_prefix ();
@@ -2079,10 +2080,21 @@ append_snap_prefix (const gchar *path)
return NULL;
}
- if (g_str_has_prefix (path, snap)) {
+ if (g_str_has_prefix (path, snap) ||
+ g_str_has_prefix (path, g_get_home_dir ()) ||
+ g_str_has_prefix (path, g_get_user_cache_dir ()) ||
+ g_str_has_prefix (path, g_get_user_config_dir ()) ||
+ g_str_has_prefix (path, g_get_user_data_dir ()) ||
+ g_str_has_prefix (path, g_get_user_runtime_dir ())) {
return g_strdup (path);
}
+ for (i = 0; i < G_USER_N_DIRECTORIES; ++ i) {
+ if (g_str_has_prefix (path, g_get_user_special_dir (i))) {
+ return g_strdup (path);
+ }
+ }
+
return g_build_path (G_DIR_SEPARATOR_S, snap, path, NULL);
}