summaryrefslogtreecommitdiff
path: root/net-misc/warpinator/files
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/warpinator/files')
-rw-r--r--net-misc/warpinator/files/warpinator-dbus-fallback.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/net-misc/warpinator/files/warpinator-dbus-fallback.patch b/net-misc/warpinator/files/warpinator-dbus-fallback.patch
new file mode 100644
index 00000000..f4f4f094
--- /dev/null
+++ b/net-misc/warpinator/files/warpinator-dbus-fallback.patch
@@ -0,0 +1,69 @@
+diff -Nur a/src/util.py b/src/util.py
+--- a/src/util.py 2024-01-04 17:03:52.000000000 +0000
++++ b/src/util.py 2024-01-14 03:01:42.318649562 +0000
+@@ -304,7 +304,7 @@
+ # file manager might answer, if more than one is installed:
+ # https://github.com/linuxmint/nemo/commit/c9cbba6a2f08be69bf02ffcaf9b0faf4a03ace8b
+
+- bus = Gio.Application.get_default().get_dbus_connection()
++ bus = Gio.Application.get_default().get_dbus_connection() # this is likely to fail
+
+ if filename is not None:
+ method = "ShowItems"
+@@ -316,30 +316,32 @@
+ file = Gio.File.new_for_path(abs_path)
+ startup_id = str(os.getpid())
+
+- try:
+- bus.call_sync("org.freedesktop.FileManager1",
+- "/org/freedesktop/FileManager1",
+- "org.freedesktop.FileManager1",
+- method,
+- GLib.Variant("(ass)",
+- ([file.get_uri()], startup_id)),
+- None,
+- Gio.DBusCallFlags.NONE,
+- 1000,
+- None)
+- logging.debug("Opening save folder using dbus")
+- return
+- except GLib.Error as e:
+- logging.debug("Could not use dbus interface to launch file manager: %s" % e.message)
+-
+- # If dbus doesn't work, use xdg mimetype handlers.
+- app = Gio.AppInfo.get_default_for_type("inode/directory", True)
+-
+- try:
+- logging.debug("Opening save folder using Gio (mimetype)")
+- Gio.AppInfo.launch_default_for_uri(prefs.get_save_uri(), None)
+- except GLib.Error as e:
+- logging.critical("Could not open received files location: %s" % e.message)
++ if bus is not None:
++ try:
++ bus.call_sync("org.freedesktop.FileManager1",
++ "/org/freedesktop/FileManager1",
++ "org.freedesktop.FileManager1",
++ method,
++ GLib.Variant("(ass)",
++ ([file.get_uri()], startup_id)),
++ None,
++ Gio.DBusCallFlags.NONE,
++ 1000,
++ None)
++ logging.debug("Opening save folder using dbus")
++ return
++ except GLib.Error as e:
++ logging.debug("Could not use dbus interface to launch file manager: %s" % e.message)
++
++ else:
++ # If dbus doesn't work, use xdg mimetype handlers.
++ app = Gio.AppInfo.get_default_for_type("inode/directory", True)
++
++ try:
++ logging.debug("Opening save folder using Gio (mimetype)")
++ Gio.AppInfo.launch_default_for_uri(prefs.get_save_uri(), None)
++ except GLib.Error as e:
++ logging.critical("Could not open received files location: %s" % e.message)
+
+ def verify_save_folder():
+ # Forbidden locations for incoming files, relative to home.