From bb9797c14470641b082ebf635e2ae3cfd5f27a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Mon, 10 Apr 2023 15:07:19 +0200 Subject: New upstream version 0.30.18 --- src/DesktopIntegration.vala | 72 +++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 45 deletions(-) (limited to 'src/DesktopIntegration.vala') diff --git a/src/DesktopIntegration.vala b/src/DesktopIntegration.vala index 024bc8b..68d1ec6 100644 --- a/src/DesktopIntegration.vala +++ b/src/DesktopIntegration.vala @@ -21,12 +21,6 @@ private bool set_screensaver = false; public void init() { if (init_count++ != 0) return; - try{ - Portal.get_instance(); - send_to_installed = true; - } catch (Error error) { - send_to_installed = false; - } } public void terminate() { @@ -93,45 +87,31 @@ public string? get_app_open_command(AppInfo app_info) { } public bool is_send_to_installed() { - // FIXME: Check if portal is available - return send_to_installed; + return true; } public async void files_send_to(File[] files) { if (files.length == 0) return; - + var parent = Xdp.parent_new_gtk(AppWindow.get_instance()); + var file_names = new StringBuilder(); - var files_builder = new VariantBuilder (new VariantType ("ah")); - var file_descriptors = new UnixFDList (); + var file_paths = new string[files.length]; for (int i=0; i (str_hash, str_equal); - options.insert ("subject", _("Send files per Mail: ") + file_names.str); - options.insert ("attachment_fds", files_builder.end()); - options.insert ("addresses", new Variant ("as", null)); AppWindow.get_instance().set_busy_cursor(); try{ - var response = yield Portal.get_instance().compose_email (options, file_descriptors); - if (response == null){ - throw new DBusError.FAILED("Did not get response"); - } + var portal = new Xdp.Portal(); + + // Use empty list for addresses instead of null to word around bug in xdg-desktop-portal-gtk + yield portal.compose_email(parent, {null}, null, null, + _("Send files per Mail: ") + file_names.str, null, file_paths, Xdp.EmailFlags.NONE, null); } catch (Error e){ AppWindow.error_message(_("Unable to send file %s, %s").printf( file_names.str, e.message)); @@ -193,14 +173,15 @@ public void set_background(Photo photo, bool desktop, bool screensaver) { return; } - - if (desktop) { - Config.Facade.get_instance().set_desktop_background(save_as.get_path()); - } - if (screensaver) { - Config.Facade.get_instance().set_screensaver(save_as.get_path()); - } - + + var parent = Xdp.parent_new_gtk(AppWindow.get_instance()); + var portal = new Xdp.Portal(); + Xdp.WallpaperFlags flags = Xdp.WallpaperFlags.PREVIEW; + if (desktop) flags |= Xdp.WallpaperFlags.BACKGROUND; + if (screensaver) flags |= Xdp.WallpaperFlags.LOCKSCREEN; + + portal.set_wallpaper.begin(parent, save_as.get_uri(), flags, null); + GLib.FileUtils.chmod(save_as.get_parse_name(), 0644); } @@ -226,7 +207,7 @@ private class BackgroundSlideshowXMLBuilder { public void open() throws Error { outs = new DataOutputStream(tmp_file.replace(null, false, FileCreateFlags.NONE, null)); - outs.put_string("\n"); + outs.put_string("\n\n"); } private void write_transition(File from, File to) throws Error { @@ -331,12 +312,13 @@ private void on_desktop_slideshow_exported(Exporter exporter, bool is_cancelled) return; } - if (set_desktop_background) { - Config.Facade.get_instance().set_desktop_background(xml_file.get_path()); - } - if (set_screensaver) { - Config.Facade.get_instance().set_screensaver(xml_file.get_path()); - } + var parent = Xdp.parent_new_gtk(AppWindow.get_instance()); + var portal = new Xdp.Portal(); + Xdp.WallpaperFlags flags = Xdp.WallpaperFlags.PREVIEW; + if (set_desktop_background) flags |= Xdp.WallpaperFlags.BACKGROUND; + if (set_screensaver) flags |= Xdp.WallpaperFlags.LOCKSCREEN; + + portal.set_wallpaper.begin(parent, xml_file.get_uri(), flags, null); } } -- cgit v1.2.3 From d443a3c2509889533ca812c163056bace396b586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 14 Jun 2023 20:35:58 +0200 Subject: New upstream version 0.32.1 --- src/DesktopIntegration.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/DesktopIntegration.vala') diff --git a/src/DesktopIntegration.vala b/src/DesktopIntegration.vala index 68d1ec6..754d9a1 100644 --- a/src/DesktopIntegration.vala +++ b/src/DesktopIntegration.vala @@ -9,7 +9,6 @@ namespace DesktopIntegration { private const string DESKTOP_SLIDESHOW_XML_FILENAME = "wallpaper.xml"; private int init_count = 0; -private bool send_to_installed = false; private ExporterUI send_to_exporter = null; private ExporterUI desktop_slideshow_exporter = null; private double desktop_slideshow_transition = 0.0; @@ -113,6 +112,7 @@ public async void files_send_to(File[] files) { yield portal.compose_email(parent, {null}, null, null, _("Send files per Mail: ") + file_names.str, null, file_paths, Xdp.EmailFlags.NONE, null); } catch (Error e){ + // Translators: The first %s is the name of the file, the second %s is the reason why it could not be sent AppWindow.error_message(_("Unable to send file %s, %s").printf( file_names.str, e.message)); } -- cgit v1.2.3