summaryrefslogtreecommitdiff
path: root/src/DesktopIntegration.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-07-02 12:17:06 +0200
committerJörg Frings-Fürst <debian@jff.email>2024-07-02 12:17:06 +0200
commit61f9dce95c1523ae06c0a608e17676659412b64c (patch)
tree6d8390c1c32b05e048599e529e2aef9d345d4160 /src/DesktopIntegration.vala
parentdcfb4504919bc8bc36e8b38d2a88349e4f549b10 (diff)
parent1de91b6c81b1cff3c922eae852e5bb08f32cd2d3 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/DesktopIntegration.vala')
-rw-r--r--src/DesktopIntegration.vala22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/DesktopIntegration.vala b/src/DesktopIntegration.vala
index 754d9a1..d29e0f7 100644
--- a/src/DesktopIntegration.vala
+++ b/src/DesktopIntegration.vala
@@ -105,13 +105,13 @@ public async void files_send_to(File[] files) {
}
AppWindow.get_instance().set_busy_cursor();
- try{
- var portal = new Xdp.Portal();
+ try {
+ var portal = new Xdp.Portal.initable_new();
// 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){
+ } 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));
@@ -175,12 +175,16 @@ public void set_background(Photo photo, bool desktop, bool screensaver) {
}
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);
+ try {
+ var portal = new Xdp.Portal.initable_new();
+ portal.set_wallpaper.begin(parent, save_as.get_uri(), flags, null);
+ } catch (Error err) {
+ AppWindow.error_message(_("Unable to set background: %s").printf(err.message));
+ }
GLib.FileUtils.chmod(save_as.get_parse_name(), 0644);
}
@@ -313,12 +317,16 @@ private void on_desktop_slideshow_exported(Exporter exporter, bool is_cancelled)
}
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);
+ try {
+ var portal = new Xdp.Portal.initable_new();
+ portal.set_wallpaper.begin(parent, xml_file.get_uri(), flags, null);
+ } catch (Error err) {
+ AppWindow.error_message(_("Unable to set background: %s").printf(err.message));
+ }
}
}