[gnome-control-center/wip/exalm/dark-wallpapers: 1/2] fixup! background: Support dark wallpapers




commit 967f4abead69327239322f90374a4ccc789d6c28
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Feb 7 15:46:20 2022 +0500

    fixup! background: Support dark wallpapers

 panels/background/cc-background-panel.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/panels/background/cc-background-panel.c b/panels/background/cc-background-panel.c
index 8e92f408f..8fff61f72 100644
--- a/panels/background/cc-background-panel.c
+++ b/panels/background/cc-background-panel.c
@@ -222,27 +222,33 @@ create_save_dir (void)
 static void
 set_background (CcBackgroundPanel *panel,
                 GSettings         *settings,
-                CcBackgroundItem  *item)
+                CcBackgroundItem  *item,
+                gboolean           set_dark)
 {
   GDesktopBackgroundStyle style;
   CcBackgroundItemFlags flags;
   g_autofree gchar *filename = NULL;
   const char *uri;
-  const char *uri_dark;
 
   if (item == NULL)
     return;
 
   uri = cc_background_item_get_uri (item);
   flags = cc_background_item_get_flags (item);
-  uri_dark = cc_background_item_get_uri_dark (item);
 
   g_settings_set_string (settings, WP_URI_KEY, uri);
 
-  if (uri_dark && uri_dark[0])
-    g_settings_set_string (settings, WP_URI_DARK_KEY, uri_dark);
-  else
-    g_settings_set_string (settings, WP_URI_DARK_KEY, uri);
+  if (set_dark)
+    {
+      const char *uri_dark;
+
+      uri_dark = cc_background_item_get_uri_dark (item);
+
+      if (uri_dark && uri_dark[0])
+        g_settings_set_string (settings, WP_URI_DARK_KEY, uri_dark);
+      else
+        g_settings_set_string (settings, WP_URI_DARK_KEY, uri);
+    }
 
   /* Also set the placement if we have a URI and the previous value was none */
   if (flags & CC_BACKGROUND_ITEM_HAS_PLACEMENT)
@@ -275,8 +281,8 @@ static void
 on_chooser_background_chosen_cb (CcBackgroundPanel *self,
                                  CcBackgroundItem  *item)
 {
-  set_background (self, self->settings, item);
-//  set_background (self, self->lock_settings, item);
+  set_background (self, self->settings, item, TRUE);
+  set_background (self, self->lock_settings, item, FALSE);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]