[nautilus/wip/oholy/libportal-warning] files-view: Fix warnings when building with libportal support




commit a89d00b61d6e6b4d3fbd5629857d101daa4b973d
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Dec 17 13:40:07 2020 +0100

    files-view: Fix warnings when building with libportal support
    
    The following warning is shown when building with libportal support:
    "warning: ‘set_wallpaper_fallback’ defined but not used". This is because
    wallpaper setting is handled by libportal. Let't guard this function
    with #ifdef to fix this warnings.

 src/nautilus-files-view.c | 102 +++++++++++++++++++++++-----------------------
 1 file changed, 51 insertions(+), 51 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 678ad98b6..14f384c67 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -6625,56 +6625,6 @@ action_compress (GSimpleAction *action,
     nautilus_files_view_compress_dialog_new (view);
 }
 
-
-#define BG_KEY_PRIMARY_COLOR      "primary-color"
-#define BG_KEY_SECONDARY_COLOR    "secondary-color"
-#define BG_KEY_COLOR_TYPE         "color-shading-type"
-#define BG_KEY_PICTURE_PLACEMENT  "picture-options"
-#define BG_KEY_PICTURE_URI        "picture-uri"
-
-static void
-set_uri_as_wallpaper (const char *uri)
-{
-    GSettings *settings;
-
-    settings = gnome_background_preferences;
-
-    g_settings_delay (settings);
-
-    if (uri == NULL)
-    {
-        uri = "";
-    }
-
-    g_settings_set_string (settings, BG_KEY_PICTURE_URI, uri);
-    g_settings_set_string (settings, BG_KEY_PRIMARY_COLOR, "#000000");
-    g_settings_set_string (settings, BG_KEY_SECONDARY_COLOR, "#000000");
-    g_settings_set_enum (settings, BG_KEY_COLOR_TYPE, G_DESKTOP_BACKGROUND_SHADING_SOLID);
-    g_settings_set_enum (settings, BG_KEY_PICTURE_PLACEMENT, G_DESKTOP_BACKGROUND_STYLE_ZOOM);
-
-    /* Apply changes atomically. */
-    g_settings_apply (settings);
-}
-
-static void
-wallpaper_copy_done_callback (GHashTable *debuting_files,
-                              gboolean    success,
-                              gpointer    data)
-{
-    GHashTableIter iter;
-    gpointer key, value;
-
-    g_hash_table_iter_init (&iter, debuting_files);
-    while (g_hash_table_iter_next (&iter, &key, &value))
-    {
-        char *uri;
-        uri = g_file_get_uri (G_FILE (key));
-        set_uri_as_wallpaper (uri);
-        g_free (uri);
-        break;
-    }
-}
-
 static gboolean
 can_set_wallpaper (GList *selection)
 {
@@ -6735,7 +6685,56 @@ set_wallpaper_with_portal (NautilusFile *file,
                               NULL);
     xdp_parent_free (parent);
 }
-#endif /* HAVE_LIBPORTAL */
+#else
+
+#define BG_KEY_PRIMARY_COLOR      "primary-color"
+#define BG_KEY_SECONDARY_COLOR    "secondary-color"
+#define BG_KEY_COLOR_TYPE         "color-shading-type"
+#define BG_KEY_PICTURE_PLACEMENT  "picture-options"
+#define BG_KEY_PICTURE_URI        "picture-uri"
+
+static void
+set_uri_as_wallpaper (const char *uri)
+{
+    GSettings *settings;
+
+    settings = gnome_background_preferences;
+
+    g_settings_delay (settings);
+
+    if (uri == NULL)
+    {
+        uri = "";
+    }
+
+    g_settings_set_string (settings, BG_KEY_PICTURE_URI, uri);
+    g_settings_set_string (settings, BG_KEY_PRIMARY_COLOR, "#000000");
+    g_settings_set_string (settings, BG_KEY_SECONDARY_COLOR, "#000000");
+    g_settings_set_enum (settings, BG_KEY_COLOR_TYPE, G_DESKTOP_BACKGROUND_SHADING_SOLID);
+    g_settings_set_enum (settings, BG_KEY_PICTURE_PLACEMENT, G_DESKTOP_BACKGROUND_STYLE_ZOOM);
+
+    /* Apply changes atomically. */
+    g_settings_apply (settings);
+}
+
+static void
+wallpaper_copy_done_callback (GHashTable *debuting_files,
+                              gboolean    success,
+                              gpointer    data)
+{
+    GHashTableIter iter;
+    gpointer key, value;
+
+    g_hash_table_iter_init (&iter, debuting_files);
+    while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+        char *uri;
+        uri = g_file_get_uri (G_FILE (key));
+        set_uri_as_wallpaper (uri);
+        g_free (uri);
+        break;
+    }
+}
 
 static void
 set_wallpaper_fallback (NautilusFile *file,
@@ -6765,6 +6764,7 @@ set_wallpaper_fallback (NautilusFile *file,
     g_free (target_uri);
     g_list_free_full (uris, g_free);
 }
+#endif /* HAVE_LIBPORTAL */
 
 static void
 action_set_as_wallpaper (GSimpleAction *action,


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