diff options
author | Gaël Bonithon <gael@xfce.org> | 2020-12-05 15:34:30 +0100 |
---|---|---|
committer | Simon Steinbeiß <ochosi@xfce.org> | 2020-12-19 00:53:41 +0100 |
commit | 082be333f9463a749e89ec53cb92dfb59c59a9d2 (patch) | |
tree | 26ce0b0f1cc531ba1fc1fb3061c5d14f52791d7b | |
parent | 78700e077ae66f8267644ba0a5e6927eef7250c7 (diff) | |
download | libxfce4util-082be333f9463a749e89ec53cb92dfb59c59a9d2.tar.gz |
Properly handle URI schemes other than "file"
-rw-r--r-- | configure.ac.in | 5 | ||||
-rw-r--r-- | libxfce4util/Makefile.am | 2 | ||||
-rw-r--r-- | libxfce4util/xfce-miscutils.c | 11 |
3 files changed, 17 insertions, 1 deletions
diff --git a/configure.ac.in b/configure.ac.in index 71a15ba..7c88976 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -120,6 +120,11 @@ dnl *** Check for GLib installed *** dnl ******************************** XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.50.0]) +dnl ******************************** +dnl *** Check for GIO installed *** +dnl ******************************** +XDT_CHECK_PACKAGE([GIO], [gio-2.0], [2.50.0]) + dnl ************************* dnl *** Check for gtk-doc *** dnl ************************* diff --git a/libxfce4util/Makefile.am b/libxfce4util/Makefile.am index e211866..996706e 100644 --- a/libxfce4util/Makefile.am +++ b/libxfce4util/Makefile.am @@ -65,6 +65,7 @@ libxfce4util_la_SOURCES = \ libxfce4util_la_CFLAGS = \ $(GLIB_CFLAGS) \ + $(GIO_CFLAGS) \ $(GOBJECT_CFLAGS) libxfce4util_la_LDFLAGS = \ @@ -75,6 +76,7 @@ libxfce4util_la_LDFLAGS = \ libxfce4util_la_LIBADD = \ $(GLIB_LIBS) \ + $(GIO_LIBS) \ $(GOBJECT_LIBS) pkgconfigdir = $(libdir)/pkgconfig diff --git a/libxfce4util/xfce-miscutils.c b/libxfce4util/xfce-miscutils.c index a3e2fea..97f81b8 100644 --- a/libxfce4util/xfce-miscutils.c +++ b/libxfce4util/xfce-miscutils.c @@ -67,6 +67,8 @@ #include <unistd.h> #endif +#include <gio/gio.h> + #include <libxfce4util/libxfce4util.h> #include <libxfce4util/libxfce4util-alias.h> @@ -501,6 +503,7 @@ xfce_expand_desktop_entry_field_codes (const gchar *command, gchar *filename; GString *string; GSList *li; + GFile *file; if (G_UNLIKELY (command == NULL)) return NULL; @@ -520,9 +523,15 @@ xfce_expand_desktop_entry_field_codes (const gchar *command, case 'F': for (li = uri_list; li != NULL; li = li->next) { - filename = g_filename_from_uri (li->data, NULL, NULL); + /* passing through a GFile seems necessary to properly handle + * all URI schemes, in particular g_filename_from_uri() is not + * able to do so */ + file = g_file_new_for_uri (li->data); + filename = g_file_get_path (file); if (G_LIKELY (filename != NULL)) xfce_append_quoted (string, filename); + + g_object_unref (file); g_free (filename); if (*p == 'f') |