Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saboya/aad7bfdabee50caa8bc412e25d795f91 to your computer and use it in GitHub Desktop.
Save saboya/aad7bfdabee50caa8bc412e25d795f91 to your computer and use it in GitHub Desktop.
Make support for gnome-online-accounts optional in gnome-control-center 3.30
From 672876ab3eb866bcc71b804389cab71620a283dd Mon Sep 17 00:00:00 2001
From: Rodrigo Saboya <saboya@gmail.com>
Date: Tue, 2 Oct 2018 02:00:53 -0300
Subject: [PATCH] Making goa dependency optional
---
meson.build | 9 ++++++++-
meson_options.txt | 3 ++-
panels/background/bg-pictures-source.c | 26 ++++++++++++++++++--------
panels/background/meson.build | 15 +++++++++++----
panels/meson.build | 5 ++++-
shell/cc-panel-loader.c | 4 ++++
6 files changed, 47 insertions(+), 15 deletions(-)
diff --git a/meson.build b/meson.build
index 49816d185..d9de0b9fd 100644
--- a/meson.build
+++ b/meson.build
@@ -107,7 +107,6 @@ gio_dep = dependency('gio-2.0')
glib_dep = dependency('glib-2.0', version: '>= 2.53.0')
gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 3.27.90')
gnome_settings_dep = dependency('gnome-settings-daemon', version: '>= 3.25.90')
-goa_dep = dependency('goa-1.0', version: goa_req_version)
gsettings_desktop_dep = dependency('gsettings-desktop-schemas', version: '>= 3.27.2')
libxml_dep = dependency('libxml-2.0')
polkit_gobject_dep = dependency('polkit-gobject-1', version: '>= 0.103')
@@ -148,6 +147,13 @@ foreach header: check_headers
assert(cc.has_header(header[1], args: cups_cflags), 'CUPS headers not found: ' + header[1])
endforeach
+# Optional online accounts support
+enable_online_accounts = get_option('online_accounts')
+
+if enable_online_accounts
+ goa_dep = dependency('goa-1.0', version: goa_req_version)
+endif
+
# Optional dependency for the user accounts panel
enable_cheese = get_option('cheese')
if enable_cheese
@@ -279,6 +285,7 @@ output += ' GNOME Bluetooth (Bluetooth panel) .......... ' + host_is_linux_n
output += ' Cheese (Users panel webcam support) ........ ' + enable_cheese.to_string() + '\n'
output += ' IBus (Region panel IBus support) ........... ' + enable_ibus.to_string() + '\n'
output += ' NetworkManager (Network panel) ............. ' + host_is_linux.to_string() + '\n'
+output += ' Online Accounts (Online accounts support)... ' + enable_online_accounts.to_string() + '\n'
output += ' Wacom (Wacom tablet panel) ................. ' + host_is_linux_not_s390.to_string() + '\n'
output += ' Wayland .................................... ' + enable_wayland.to_string() + '\n'
diff --git a/meson_options.txt b/meson_options.txt
index a347168b7..3555999d0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,5 +2,6 @@ option('cheese', type: 'boolean', value: true, description: 'build with cheese w
option('documentation', type: 'boolean', value: false, description: 'build documentation')
option('gnome_session_libexecdir', type: 'string', value: '', description: 'Directory for gnome-session\'s libexecdir')
option('ibus', type: 'boolean', value: true, description: 'build with IBus support')
+option('online_accounts', type: 'boolean', value: true, description: 'build with online accounts support')
option('tracing', type: 'boolean', value: false, description: 'add extra debugging information')
-option('wayland', type: 'boolean', value: true, description: 'build with Wayland support')
\ No newline at end of file
+option('wayland', type: 'boolean', value: true, description: 'build with Wayland support')
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
index a37682d63..ed6852eed 100644
--- a/panels/background/bg-pictures-source.c
+++ b/panels/background/bg-pictures-source.c
@@ -29,7 +29,11 @@
#include <string.h>
#include <cairo-gobject.h>
#include <gio/gio.h>
+
+#ifdef HAVE_ONLINE_ACCOUNTS
#include <grilo.h>
+#endif
+
#include <libgnome-desktop/gnome-desktop-thumbnail.h>
#include <gdesktop-enums.h>
@@ -42,9 +46,9 @@ struct _BgPicturesSource
BgSource parent_instance;
GCancellable *cancellable;
-
+#ifdef HAVE_ONLINE_ACCOUNTS
CcBackgroundGriloMiner *grl_miner;
-
+#endif
GnomeDesktopThumbnailFactory *thumb_factory;
GFileMonitor *picture_dir_monitor;
@@ -84,8 +88,9 @@ bg_pictures_source_dispose (GObject *object)
g_cancellable_cancel (source->cancellable);
g_clear_object (&source->cancellable);
}
-
+#ifdef HAVE_ONLINE_ACCOUNTS
g_clear_object (&source->grl_miner);
+#endif
g_clear_object (&source->thumb_factory);
G_OBJECT_CLASS (bg_pictures_source_parent_class)->dispose (object);
@@ -460,7 +465,9 @@ add_single_file (BgPicturesSource *bg_source,
gboolean retval = FALSE;
g_autoptr(GFile) pictures_dir = NULL;
g_autoptr(GFile) cache_dir = NULL;
+#ifdef HAVE_ONLINE_ACCOUNTS
GrlMedia *media;
+#endif
/* find png and jpeg files */
if (!content_type)
@@ -515,7 +522,7 @@ add_single_file (BgPicturesSource *bg_source,
read_file:
-
+#ifdef HAVE_ONLINE_ACCOUNTS
media = g_object_get_data (G_OBJECT (file), "grl-media");
if (media == NULL)
{
@@ -560,7 +567,7 @@ add_single_file (BgPicturesSource *bg_source,
picture_copied_for_read,
bg_source);
}
-
+#endif
retval = TRUE;
out:
@@ -589,7 +596,7 @@ add_single_file_from_info (BgPicturesSource *bg_source,
mtime = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
return add_single_file (bg_source, file, content_type, mtime, ret_row_ref);
}
-
+#ifdef HAVE_ONLINE_ACCOUNTS
static gboolean
add_single_file_from_media (BgPicturesSource *bg_source,
GFile *file,
@@ -614,7 +621,7 @@ add_single_file_from_media (BgPicturesSource *bg_source,
return add_single_file (bg_source, file, content_type, (guint64) mtime_unix, NULL);
}
-
+#endif
gboolean
bg_pictures_source_add (BgPicturesSource *bg_source,
const char *uri,
@@ -930,6 +937,7 @@ monitor_path (BgPicturesSource *self,
return monitor;
}
+#ifdef HAVE_ONLINE_ACCOUNTS
static void
media_found_cb (BgPicturesSource *self, GrlMedia *media)
{
@@ -941,6 +949,7 @@ media_found_cb (BgPicturesSource *self, GrlMedia *media)
g_object_set_data_full (G_OBJECT (file), "grl-media", g_object_ref (media), g_object_unref);
add_single_file_from_media (self, file, media);
}
+#endif
static void
bg_pictures_source_init (BgPicturesSource *self)
@@ -963,10 +972,11 @@ bg_pictures_source_init (BgPicturesSource *self)
cache_path = bg_pictures_source_get_cache_path ();
self->cache_dir_monitor = monitor_path (self, cache_path);
-
+#ifdef HAVE_ONLINE_ACCOUNTS
self->grl_miner = cc_background_grilo_miner_new ();
g_signal_connect_swapped (self->grl_miner, "media-found", G_CALLBACK (media_found_cb), self);
cc_background_grilo_miner_start (self->grl_miner);
+#endif
self->thumb_factory =
gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
diff --git a/panels/background/meson.build b/panels/background/meson.build
index bb34b69fb..ccc3324f5 100644
--- a/panels/background/meson.build
+++ b/panels/background/meson.build
@@ -75,7 +75,6 @@ sources = common_sources + files(
'bg-source.c',
'bg-wallpapers-source.c',
'cc-background-chooser-dialog.c',
- 'cc-background-grilo-miner.c',
'cc-background-item.c',
'cc-background-xml.c'
)
@@ -83,12 +82,20 @@ sources = common_sources + files(
deps = common_deps + [
gdk_pixbuf_dep,
gnome_desktop_dep,
- goa_dep,
libxml_dep,
- dependency('cairo-gobject'),
- dependency('grilo-0.3', version: '>= 0.3.0')
+ dependency('cairo-gobject')
]
+if enable_online_accounts
+ deps += [
+ goa_dep,
+ dependency('grilo-0.3', version: '>= 0.3.0')
+ ]
+ sources = sources + files(
+ 'cc-background-grilo-miner.c'
+ )
+endif
+
cflags += [
'-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir),
'-DDATADIR="@0@"'.format(control_center_datadir),
diff --git a/panels/meson.build b/panels/meson.build
index 37a343642..ba42b1a14 100644
--- a/panels/meson.build
+++ b/panels/meson.build
@@ -9,7 +9,6 @@ panels = [
'keyboard',
'mouse',
'notifications',
- 'online-accounts',
'power',
'printers',
'privacy',
@@ -21,6 +20,10 @@ panels = [
'user-accounts'
]
+if enable_online_accounts
+ panels += ['online-accounts']
+endif
+
if host_is_linux
panels += ['network']
endif
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 6b5c6e3d0..a08773f74 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -47,7 +47,9 @@ extern GType cc_network_panel_get_type (void);
extern GType cc_wifi_panel_get_type (void);
#endif /* BUILD_NETWORK */
extern GType cc_notifications_panel_get_type (void);
+#ifdef HAVE_ONLINE_ACCOUNTS
extern GType cc_goa_panel_get_type (void);
+#endif
extern GType cc_power_panel_get_type (void);
extern GType cc_printers_panel_get_type (void);
extern GType cc_privacy_panel_get_type (void);
@@ -104,7 +106,9 @@ static struct {
PANEL_TYPE("wifi", cc_wifi_panel_get_type, cc_wifi_panel_static_init_func),
#endif
PANEL_TYPE("notifications", cc_notifications_panel_get_type, NULL),
+#ifdef HAVE_ONLINE_ACCOUNTS
PANEL_TYPE("online-accounts", cc_goa_panel_get_type, NULL),
+#endif
PANEL_TYPE("power", cc_power_panel_get_type, NULL),
PANEL_TYPE("printers", cc_printers_panel_get_type, NULL),
PANEL_TYPE("privacy", cc_privacy_panel_get_type, NULL),
--
2.16.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment