[evince] Make "Open Containing Folder" work in flatpak



commit 5bab224509ad89937af46c53129d481e75065c7d
Author: Casey Jao <casey jao gmail com>
Date:   Sat Jul 13 21:11:38 2019 -0400

    Make "Open Containing Folder" work in flatpak
    
    It doesn't seem possible to find the default application for files of
    type "inode/directory" from inside the sandbox. Try the
    org.freedesktop.FileManager1 dbus interface should this lookup fail.
    
    Closes #1147.

 build-aux/flatpak/org.gnome.Evince.json |  1 +
 shell/ev-window.c                       | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Evince.json b/build-aux/flatpak/org.gnome.Evince.json
index f4ad9d16..5501f0e7 100644
--- a/build-aux/flatpak/org.gnome.Evince.json
+++ b/build-aux/flatpak/org.gnome.Evince.json
@@ -22,6 +22,7 @@
         "--talk-name=org.gtk.vfs",
         "--talk-name=org.gtk.vfs.*",
         "--talk-name=org.gnome.SessionManager",
+        "--talk-name=org.freedesktop.FileManager1",
         "--own-name=org.gnome.evince",
         "--own-name=org.gnome.evince.Daemon"
     ],
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 53ed9660..3a7d05b8 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -41,6 +41,7 @@
 #include <gio/gio.h>
 #include <gtk/gtk.h>
 
+#include "dzl-file-manager.h"
 #include "ev-find-sidebar.h"
 #include "ev-annotations-toolbar.h"
 #include "ev-application.h"
@@ -3174,12 +3175,23 @@ ev_window_cmd_open_containing_folder (GSimpleAction *action,
        GError *error = NULL;
 
        app =  g_app_info_get_default_for_type ("inode/directory", FALSE);
-
+       file = g_file_new_for_uri (priv->uri);
        if (app == NULL) {
+               dzl_file_manager_show (file, &error);
+               if (error) {
+                       gchar *uri;
+                       uri = g_file_get_uri (file);
+                       g_warning ("Could not show containing folder for \"%s\": %s",
+                                  uri, error->message);
+
+                       g_error_free (error);
+                       g_free (uri);
+               }
+               g_object_unref (file);
                return;
        }
 
-       file = g_file_new_for_uri (priv->uri);
+
        list.next = list.prev = NULL;
        list.data = file;
 


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