[nautilus/wip/oholy/cloudproviders] sidebar: Allow to build with cloudproviders support



commit 67f33e94921b4ba1a4b736c1d3d33fc8b03db944
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Aug 5 10:23:56 2022 +0200

    sidebar: Allow to build with cloudproviders support
    
    The cloudproviders integration used to be part of GTK 3 version, but
    it is not part of GTK 4 version. This is because the sidebar codes
    are now part of Nautilus codebase and `HAVE_CLOUDPROVIDERS` is never
    set. Let's allow to build with cloudproviders support again.
    
    Related: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2392

 meson.build                        | 11 +++++++++++
 meson_options.txt                  |  6 ++++++
 src/gtk/nautilusgtkplacessidebar.c |  7 ++++---
 src/meson.build                    |  3 ++-
 4 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 51437ae45..a448946be 100644
--- a/meson.build
+++ b/meson.build
@@ -117,6 +117,16 @@ if get_option('selinux')
 endif
 tracker_sparql = dependency('tracker-sparql-3.0')
 xml = dependency('libxml-2.0', version: '>= 2.7.8')
+cloudproviders_dep = dependency('cloudproviders',
+  required: get_option('cloudproviders'),
+  version: '>= 0.3.1',
+  fallback: [
+    'libcloudproviders',
+    'libcloudproviders_dep',
+  ],
+  default_options: [
+    'vapigen=false',
+  ])
 
 ####################
 # End dependencies #
@@ -157,6 +167,7 @@ conf.set_quoted('VERSION', version_string)
 conf.set('ENABLE_PACKAGEKIT', get_option('packagekit'))
 conf.set('ENABLE_PROFILING', get_option('profiling'))
 conf.set('HAVE_SELINUX', get_option('selinux'))
+conf.set('HAVE_CLOUDPROVIDERS', cloudproviders_dep.found())
 
 #############################################################
 # config.h dependency, add to target dependencies if needed #
diff --git a/meson_options.txt b/meson_options.txt
index fce5f16f9..ee7d6d356 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -38,6 +38,12 @@ option(
   value: false,
   description: 'Enable SELinux context support in file properties dialog',
 )
+option(
+  'cloudproviders',
+  type: 'feature',
+  value: 'disabled',
+  description : 'Enable the cloudproviders support',
+)
 ################
 # End features #
 ################
diff --git a/src/gtk/nautilusgtkplacessidebar.c b/src/gtk/nautilusgtkplacessidebar.c
index 59702bbe7..41457f991 100644
--- a/src/gtk/nautilusgtkplacessidebar.c
+++ b/src/gtk/nautilusgtkplacessidebar.c
@@ -912,7 +912,7 @@ create_cloud_provider_account_row (NautilusGtkPlacesSidebar      *sidebar,
 
       g_free (tooltip);
       g_free (mount_uri);
-      g_object_unref (end_icon);
+      g_clear_object (&end_icon);
       return TRUE;
     }
   else
@@ -3260,6 +3260,9 @@ create_row_popover (NautilusGtkPlacesSidebar *sidebar,
   gboolean show_properties;
   g_autoptr (GFile) trash = NULL;
   gboolean is_trash;
+#ifdef HAVE_CLOUDPROVIDERS
+  CloudProvidersAccount *cloud_provider_account;
+#endif
 
   g_object_get (row,
                 "place-type", &type,
@@ -3284,8 +3287,6 @@ create_row_popover (NautilusGtkPlacesSidebar *sidebar,
     }
 
 #ifdef HAVE_CLOUDPROVIDERS
-  CloudProvidersAccount *cloud_provider_account;
-
   g_object_get (row, "cloud-provider-account", &cloud_provider_account, NULL);
 
   if (cloud_provider_account)
diff --git a/src/meson.build b/src/meson.build
index a0c92c92b..5883ac8ed 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -274,7 +274,8 @@ nautilus_deps = [
   nautilus_extension,
   selinux,
   tracker_sparql,
-  xml
+  xml,
+  cloudproviders_dep,
 ]
 
 libnautilus = static_library(


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