From ed6c79ecfa0d5303694015cb7509091038b98c76 Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Thu, 22 Jun 2023 10:03:07 +0200 Subject: [PATCH] sidebar: Make cloudproviders dependency optional again This partially reverts commit 673e6b157a125e321049d4abea3bb5a6ddc7570e. It turns out that the cloudproviders dependency is not desired for RHEL. --- meson.build | 6 +++++- meson_options.txt | 6 ++++++ src/gtk/nautilusgtkplacessidebar.c | 30 ++++++++++++++++++++++++++++++ src/gtk/nautilusgtksidebarrow.c | 10 ++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 51f8350ad..a123b5062 100644 --- a/meson.build +++ b/meson.build @@ -114,7 +114,10 @@ if get_option('selinux') endif tracker_sparql = dependency('tracker-sparql-3.0') xml = dependency('libxml-2.0', version: '>= 2.7.8') -cloudproviders = dependency('cloudproviders', version: '>= 0.3.1') +cloudproviders = [] +if get_option('cloudproviders') + cloudproviders = dependency('cloudproviders', version: '>= 0.3.1') +endif gi_docgen = find_program('gi-docgen', required: get_option('docs')) #################### @@ -156,6 +159,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', get_option('cloudproviders')) ############################################################# # config.h dependency, add to target dependencies if needed # diff --git a/meson_options.txt b/meson_options.txt index fce5f16f9..ebc0ed640 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: 'boolean', + value: true, + description: 'Enable the cloudproviders support', +) ################ # End features # ################ diff --git a/src/gtk/nautilusgtkplacessidebar.c b/src/gtk/nautilusgtkplacessidebar.c index f270588bb..0ae39f12c 100644 --- a/src/gtk/nautilusgtkplacessidebar.c +++ b/src/gtk/nautilusgtkplacessidebar.c @@ -27,7 +27,9 @@ #include "nautilus-enum-types.h" #include +#ifdef HAVE_CLOUDPROVIDERS #include +#endif #include "nautilusgtkplacessidebarprivate.h" #include "nautilusgtksidebarrowprivate.h" @@ -109,8 +111,10 @@ struct _NautilusGtkPlacesSidebar { GActionGroup *row_actions; +#ifdef HAVE_CLOUDPROVIDERS CloudProvidersCollector *cloud_manager; GList *unready_accounts; +#endif GVolumeMonitor *volume_monitor; GtkSettings *gtk_settings; @@ -395,7 +399,11 @@ add_place (NautilusGtkPlacesSidebar *sidebar, GDrive *drive, GVolume *volume, GMount *mount, +#ifdef HAVE_CLOUDPROVIDERS CloudProvidersAccount *cloud_provider_account, +#else + gpointer *cloud_provider_account, +#endif const int index, const char *tooltip) { @@ -435,7 +443,9 @@ add_place (NautilusGtkPlacesSidebar *sidebar, "drive", drive, "volume", volume, "mount", mount, +#ifdef HAVE_CLOUDPROVIDERS "cloud-provider-account", cloud_provider_account, +#endif NULL); eject_button = nautilus_gtk_sidebar_row_get_eject_button (NAUTILUS_GTK_SIDEBAR_ROW (row)); @@ -852,6 +862,8 @@ update_trash_icon (NautilusGtkPlacesSidebar *sidebar) } } +#ifdef HAVE_CLOUDPROVIDERS + static gboolean create_cloud_provider_account_row (NautilusGtkPlacesSidebar *sidebar, CloudProvidersAccount *account) @@ -929,6 +941,8 @@ on_account_updated (GObject *object, } } +#endif + static void update_places (NautilusGtkPlacesSidebar *sidebar) { @@ -949,10 +963,12 @@ update_places (NautilusGtkPlacesSidebar *sidebar) GList *network_mounts, *network_volumes; GIcon *new_bookmark_icon; GtkWidget *child; +#ifdef HAVE_CLOUDPROVIDERS GList *cloud_providers; GList *cloud_providers_accounts; CloudProvidersAccount *cloud_provider_account; CloudProvidersProvider *cloud_provider; +#endif /* save original selection */ selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (sidebar->list_box)); @@ -1057,6 +1073,7 @@ update_places (NautilusGtkPlacesSidebar *sidebar) add_application_shortcuts (sidebar); /* Cloud providers */ +#ifdef HAVE_CLOUDPROVIDERS cloud_providers = cloud_providers_collector_get_providers (sidebar->cloud_manager); for (l = sidebar->unready_accounts; l != NULL; l = l->next) { @@ -1091,6 +1108,7 @@ update_places (NautilusGtkPlacesSidebar *sidebar) } } +#endif /* go through all connected drives */ drives = g_volume_monitor_get_connected_drives (sidebar->volume_monitor); @@ -3193,6 +3211,7 @@ on_row_popover_destroy (GtkWidget *row_popover, sidebar->popover = NULL; } +#ifdef HAVE_CLOUDPROVIDERS static void build_popup_menu_using_gmenu (NautilusGtkSidebarRow *row) { @@ -3258,6 +3277,7 @@ build_popup_menu_using_gmenu (NautilusGtkSidebarRow *row) g_object_unref (cloud_provider_account); } } +#endif /* Constructs the popover for the sidebar row if needed */ static void @@ -3278,7 +3298,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, @@ -3302,6 +3324,7 @@ create_row_popover (NautilusGtkPlacesSidebar *sidebar, is_trash = FALSE; } +#ifdef HAVE_CLOUDPROVIDERS g_object_get (row, "cloud-provider-account", &cloud_provider_account, NULL); if (cloud_provider_account) @@ -3309,6 +3332,7 @@ create_row_popover (NautilusGtkPlacesSidebar *sidebar, build_popup_menu_using_gmenu (row); return; } +#endif action = g_action_map_lookup_action (G_ACTION_MAP (sidebar->row_actions), "remove"); g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (type == NAUTILUS_GTK_PLACES_BOOKMARK)); @@ -3979,11 +4003,13 @@ nautilus_gtk_places_sidebar_init (NautilusGtkPlacesSidebar *sidebar) sidebar->show_desktop = show_desktop; /* Cloud providers */ +#ifdef HAVE_CLOUDPROVIDERS sidebar->cloud_manager = cloud_providers_collector_dup_singleton (); g_signal_connect_swapped (sidebar->cloud_manager, "providers-changed", G_CALLBACK (update_places), sidebar); +#endif /* populate the sidebar */ update_places (sidebar); @@ -4100,7 +4126,9 @@ static void nautilus_gtk_places_sidebar_dispose (GObject *object) { NautilusGtkPlacesSidebar *sidebar; +#ifdef HAVE_CLOUDPROVIDERS GList *l; +#endif sidebar = NAUTILUS_GTK_PLACES_SIDEBAR (object); @@ -4164,6 +4192,7 @@ nautilus_gtk_places_sidebar_dispose (GObject *object) g_clear_handle_id (&sidebar->hover_timer_id, g_source_remove); +#ifdef HAVE_CLOUDPROVIDERS for (l = sidebar->unready_accounts; l != NULL; l = l->next) { g_signal_handlers_disconnect_by_data (l->data, sidebar); @@ -4181,6 +4210,7 @@ nautilus_gtk_places_sidebar_dispose (GObject *object) g_object_unref (sidebar->cloud_manager); sidebar->cloud_manager = NULL; } +#endif G_OBJECT_CLASS (nautilus_gtk_places_sidebar_parent_class)->dispose (object); } diff --git a/src/gtk/nautilusgtksidebarrow.c b/src/gtk/nautilusgtksidebarrow.c index 4fa69358b..f7e2f7657 100644 --- a/src/gtk/nautilusgtksidebarrow.c +++ b/src/gtk/nautilusgtksidebarrow.c @@ -26,7 +26,9 @@ /* For section and place type enums */ #include "nautilusgtkplacessidebarprivate.h" +#ifdef HAVE_CLOUDPROVIDERS #include +#endif struct _NautilusGtkSidebarRow { @@ -83,6 +85,8 @@ enum static GParamSpec *properties [LAST_PROP]; +#ifdef HAVE_CLOUDPROVIDERS + static void cloud_row_update (NautilusGtkSidebarRow *self) { @@ -124,6 +128,8 @@ cloud_row_update (NautilusGtkSidebarRow *self) g_object_unref (end_icon); } +#endif + static void nautilus_gtk_sidebar_row_get_property (GObject *object, guint prop_id, @@ -322,6 +328,7 @@ nautilus_gtk_sidebar_row_set_property (GObject *object, break; case PROP_CLOUD_PROVIDER_ACCOUNT: +#ifdef HAVE_CLOUDPROVIDERS if (self->cloud_provider_account != NULL) g_signal_handlers_disconnect_by_data (self->cloud_provider_account, self); @@ -336,6 +343,7 @@ nautilus_gtk_sidebar_row_set_property (GObject *object, g_signal_connect_swapped (self->cloud_provider_account, "notify::status-details", G_CALLBACK (cloud_row_update), self); } +#endif break; case PROP_PLACEHOLDER: @@ -464,9 +472,11 @@ nautilus_gtk_sidebar_row_finalize (GObject *object) g_clear_object (&self->drive); g_clear_object (&self->volume); g_clear_object (&self->mount); +#ifdef HAVE_CLOUDPROVIDERS if (self->cloud_provider_account != NULL) g_signal_handlers_disconnect_by_data (self->cloud_provider_account, self); g_clear_object (&self->cloud_provider_account); +#endif G_OBJECT_CLASS (nautilus_gtk_sidebar_row_parent_class)->finalize (object); } -- 2.40.0