Commit 19a014a4 authored by Sophie Herold's avatar Sophie Herold

Use org.freedesktop.FileManager1 dbus api

Closes #19
parent ee9601bc
Pipeline #206864 passed with stage
in 22 minutes and 15 seconds
......@@ -7,6 +7,7 @@ homepage = "https://gitlab.gnome.org/sophie-h/pika-backup"
edition = "2018"
[dependencies]
dbus = "0.8"
chrono = { version = "0.4", features = ["serde"] }
chrono-humanize = "0.0.11"
ctrlc = { version = "3.1", features = ["termination"] }
......
......@@ -30,6 +30,9 @@ finish-args:
- --talk-name=org.freedesktop.Flatpak.*
# inhibit shutdown and sleep
- --system-talk-name=org.freedesktop.login1
# open folder in filebrowser, work around buggy OpenURI portal
# https://gitlab.gnome.org/sophie-h/pika-backup/-/issues/19
- --talk-name=org.freedesktop.FileManager1
modules:
- name: borg
......
......@@ -28,6 +28,9 @@ finish-args:
- --talk-name=org.freedesktop.Flatpak.*
# inhibit shutdown and sleep
- --system-talk-name=org.freedesktop.login1
# open folder in filebrowser, work around buggy OpenURI portal
# https://gitlab.gnome.org/sophie-h/pika-backup/-/issues/19
- --talk-name=org.freedesktop.FileManager1
modules:
- name: borg
......
......@@ -65,7 +65,6 @@ fn on_browse_archive() {
path.push(archive.name.clone());
let open_archive = || {
let none: Option<&gio::AppLaunchContext> = None;
ui::utils::async_react(
"open_archive",
move || find_first_populated_dir(&path),
......@@ -74,8 +73,22 @@ fn on_browse_archive() {
// only open if app isn't closing in this moment
if !**IS_SHUTDOWN.load() {
let show_folder = || -> Result<(), _> {
let conn = dbus::blocking::Connection::new_session()?;
let proxy = conn.with_proxy(
"org.freedesktop.FileManager1",
"/org/freedesktop/FileManager1",
std::time::Duration::from_millis(5000),
);
proxy.method_call(
"org.freedesktop.FileManager1",
"ShowFolders",
(vec![uri.as_str()], ""),
)
};
ui::utils::dialog_catch_err(
gio::AppInfo::launch_default_for_uri(&uri, none),
show_folder(),
gettext("Failed to open archive."),
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment