summaryrefslogtreecommitdiff
path: root/src/util/system.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-09-30 14:09:32 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-09-30 14:09:32 +0200
commit0537caaf4af94a9ead8b292679f6b34c90b55e06 (patch)
tree6761cfdf959926be7af3147cf770e7f253390fe8 /src/util/system.vala
parenteca5837e235a356c8db9416bbbc13577db3e6f76 (diff)
parent5e9f4eea451a77ba3b93db3747841ed2bd969e9f (diff)
Update upstream source from tag 'upstream/0.30.1'
Update to upstream version '0.30.1' with Debian dir dc242531effff8d9c6fab093414edee28b403c6a
Diffstat (limited to 'src/util/system.vala')
-rw-r--r--src/util/system.vala30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/util/system.vala b/src/util/system.vala
index 38abf1e..1e69304 100644
--- a/src/util/system.vala
+++ b/src/util/system.vala
@@ -21,15 +21,29 @@ File? get_sys_install_dir(File exec_dir) {
return null;
}
-string get_nautilus_install_location() {
- return Environment.find_program_in_path("nautilus");
+[DBus (name = "org.freedesktop.FileManager1")]
+public interface org.freedesktop.FileManager1 : Object {
+ public const string NAME = "org.freedesktop.FileManager1";
+ public const string PATH = "/org/freedesktop/FileManager1";
+
+ public abstract async void show_folders(string[] uris, string startup_id) throws IOError, DBusError;
+ public abstract async void show_items(string[] uris, string startup_id) throws IOError, DBusError;
+ public abstract async void show_item_properties(string[] uris, string startup_id) throws IOError, DBusError;
}
-void sys_show_uri(Gdk.Screen screen, string uri) throws Error {
- Gtk.show_uri(screen, uri, Gdk.CURRENT_TIME);
-}
-
-void show_file_in_nautilus(string filename) throws Error {
- GLib.Process.spawn_command_line_async(get_nautilus_install_location() + " " + filename);
+async void show_file_in_filemanager(File file) throws Error {
+ try {
+ org.freedesktop.FileManager1? manager = yield Bus.get_proxy (BusType.SESSION,
+ org.freedesktop.FileManager1.NAME,
+ org.freedesktop.FileManager1.PATH,
+ DBusProxyFlags.DO_NOT_LOAD_PROPERTIES |
+ DBusProxyFlags.DO_NOT_CONNECT_SIGNALS);
+ var id = "%s_%s_%d_%s".printf(Environment.get_prgname(), Environment.get_host_name(),
+ Posix.getpid(), TimeVal().to_iso8601());
+ yield manager.show_items({file.get_uri()}, id);
+ } catch (Error e) {
+ warning("Failed to launch file manager using DBus, using fall-back: %s", e.message);
+ Gtk.show_uri_on_window(AppWindow.get_instance(), file.get_parent().get_uri(), Gdk.CURRENT_TIME);
+ }
}