From e666bbea4fe922948b8133f6d6554b30f811d3ba Mon Sep 17 00:00:00 2001
From: Alexander Schwinn <alexxcons@xfce.org>
Date: Wed, 2 Nov 2022 23:37:24 +0100
Subject: [PATCH] Set style to reasonable value when setting wallpaper (Issue
 #907)

Set it to "Zoomed" in case it is unset, or set to "None".
---
 plugins/thunar-wallpaper/twp-provider.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/plugins/thunar-wallpaper/twp-provider.c b/plugins/thunar-wallpaper/twp-provider.c
index 887ae6460..0b20acc82 100644
--- a/plugins/thunar-wallpaper/twp-provider.c
+++ b/plugins/thunar-wallpaper/twp-provider.c
@@ -239,11 +239,12 @@ twp_action_set_wallpaper (ThunarxMenuItem *item,
       xfconf_channel_set_string (channel, image_path_prop, file_name);
       xfconf_channel_set_bool (channel, image_show_prop, TRUE);
 
-      /* If there isn't a wallpaper style set, then set one */
+      /* If there isn't a wallpaper style set (-1), or it is set to 'None' (which is 0) then set one */
       current_image_style = xfconf_channel_get_int (channel, image_style_prop, -1);
-      if (current_image_style == -1)
+      if (current_image_style <= 0 )
         {
-          xfconf_channel_set_int (channel, image_style_prop, 0);
+          /* Lets hope that 5 = 'Zoomed' works fine for the selected picture */
+          xfconf_channel_set_int (channel, image_style_prop, 5);
         }
 
       g_free(image_path_prop);
@@ -281,10 +282,11 @@ twp_action_set_wallpaper (ThunarxMenuItem *item,
 
       xfconf_channel_set_string (channel, image_path_prop, file_name);
 
-      /* If there isn't a wallpaper style set, then set one */
+      /* If there isn't a wallpaper style set (-1), or it is set to 'None' (which is 0) then set one */
       current_image_style = xfconf_channel_get_int (channel, image_style_prop, -1);
-      if (current_image_style == -1)
+      if (current_image_style <= 0)
         {
+          /* Lets hope that 5 = 'Zoomed' works fine for the selected picture */
           xfconf_channel_set_int (channel, image_style_prop, 5);
         }
 
-- 
GitLab