0003-build-Make-grilo-and-gnome-online-accounts-optional.patch 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. From b7726d558c10c2c3b6c987954a0367116ccdfc18 Mon Sep 17 00:00:00 2001
  2. From: Mart Raudsepp <leio@gentoo.org>
  3. Date: Mon, 4 Mar 2019 01:22:13 +0200
  4. Subject: [PATCH 3/5] build: Make grilo and gnome-online-accounts optional
  5. grilo requires goa
  6. ---
  7. meson.build | 15 ++++++++++++++-
  8. meson_options.txt | 2 ++
  9. panels/background/bg-pictures-source.c | 20 ++++++++++++++++++++
  10. panels/background/meson.build | 7 +++++--
  11. panels/meson.build | 5 ++++-
  12. shell/cc-panel-loader.c | 4 ++++
  13. 6 files changed, 49 insertions(+), 4 deletions(-)
  14. diff --git a/meson.build b/meson.build
  15. index acf68a1da..24f54815f 100644
  16. --- a/meson.build
  17. +++ b/meson.build
  18. @@ -124,7 +124,7 @@ gio_dep = dependency('gio-2.0')
  19. glib_dep = dependency('glib-2.0', version: '>= 2.56.0')
  20. gnome_desktop_dep = dependency('gnome-desktop-3.0', version: '>= 3.33.4')
  21. gnome_settings_dep = dependency('gnome-settings-daemon', version: '>= 3.27.90')
  22. -goa_dep = dependency('goa-1.0', version: goa_req_version)
  23. +goa_dep = dependency('goa-1.0', version: goa_req_version, required: get_option('goa'))
  24. gsettings_desktop_dep = dependency('gsettings-desktop-schemas', version: '>= 3.37.1')
  25. libxml_dep = dependency('libxml-2.0')
  26. polkit_gobject_dep = dependency('polkit-gobject-1', version: '>= 0.114')
  27. @@ -138,6 +138,19 @@ epoxy_dep = dependency('epoxy')
  28. m_dep = cc.find_library('m')
  29. +enable_goa = goa_dep.found()
  30. +config_h.set('BUILD_GOA', enable_goa,
  31. + description: 'Define to 1 to build the Online Accounts panel')
  32. +
  33. +grilo_dep = dependency('grilo-0.3', version: '>= 0.3.0', required: get_option('grilo'))
  34. +enable_grilo = grilo_dep.found()
  35. +config_h.set('HAVE_GRILO', enable_grilo,
  36. + description: 'Define to 1 to enable grilo support')
  37. +
  38. +if enable_grilo and not enable_goa
  39. + error('Grilo support requires goa')
  40. +endif
  41. +
  42. common_deps = [
  43. gio_dep,
  44. glib_dep,
  45. diff --git a/meson_options.txt b/meson_options.txt
  46. index 5c558557d..17e3551fa 100644
  47. --- a/meson_options.txt
  48. +++ b/meson_options.txt
  49. @@ -1,6 +1,8 @@
  50. option('bluetooth', type: 'boolean', value: true, description: 'build with Bluetooth support')
  51. option('cheese', type: 'boolean', value: true, description: 'build with cheese webcam support')
  52. option('documentation', type: 'boolean', value: false, description: 'build documentation')
  53. +option('goa', type: 'feature', value: 'auto', description: 'build with gnome-online-accounts support')
  54. +option('grilo', type: 'feature', value: 'auto', description: 'build with grilo support (background panel)')
  55. option('ibus', type: 'boolean', value: true, description: 'build with IBus support')
  56. option('kerberos', type: 'feature', value: 'auto', description: 'build with kerberos support')
  57. option('network_manager', type: 'boolean', value: true, description: 'build with NetworkManager support')
  58. diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c
  59. index 3a3027b13..edc6c3247 100644
  60. --- a/panels/background/bg-pictures-source.c
  61. +++ b/panels/background/bg-pictures-source.c
  62. @@ -23,13 +23,17 @@
  63. #include "bg-pictures-source.h"
  64. +#ifdef HAVE_GRILO
  65. #include "cc-background-grilo-miner.h"
  66. +#endif
  67. #include "cc-background-item.h"
  68. #include <string.h>
  69. #include <cairo-gobject.h>
  70. #include <gio/gio.h>
  71. +#ifdef HAVE_GRILO
  72. #include <grilo.h>
  73. +#endif
  74. #include <libgnome-desktop/gnome-desktop-thumbnail.h>
  75. #include <gdesktop-enums.h>
  76. @@ -43,7 +47,9 @@ struct _BgPicturesSource
  77. GCancellable *cancellable;
  78. +#ifdef HAVE_GRILO
  79. CcBackgroundGriloMiner *grl_miner;
  80. +#endif
  81. GFileMonitor *picture_dir_monitor;
  82. GFileMonitor *cache_dir_monitor;
  83. @@ -83,7 +89,9 @@ bg_pictures_source_dispose (GObject *object)
  84. g_clear_object (&source->cancellable);
  85. }
  86. +#ifdef HAVE_GRILO
  87. g_clear_object (&source->grl_miner);
  88. +#endif
  89. G_OBJECT_CLASS (bg_pictures_source_parent_class)->dispose (object);
  90. }
  91. @@ -392,7 +400,9 @@ add_single_file (BgPicturesSource *bg_source,
  92. const gchar *pictures_path;
  93. g_autoptr(GFile) pictures_dir = NULL;
  94. g_autoptr(GFile) cache_dir = NULL;
  95. +#ifdef HAVE_GRILO
  96. GrlMedia *media;
  97. +#endif
  98. /* find png and jpeg files */
  99. if (!content_type)
  100. @@ -432,14 +442,17 @@ add_single_file (BgPicturesSource *bg_source,
  101. "source-url", source_uri,
  102. NULL);
  103. +#ifdef HAVE_GRILO
  104. media = g_object_get_data (G_OBJECT (file), "grl-media");
  105. if (media == NULL)
  106. +#endif
  107. {
  108. g_object_set_data_full (G_OBJECT (file), "item", g_object_ref (item), g_object_unref);
  109. g_file_read_async (file, G_PRIORITY_DEFAULT,
  110. bg_source->cancellable,
  111. picture_opened_for_read, bg_source);
  112. }
  113. +#ifdef HAVE_GRILO
  114. else
  115. {
  116. g_autoptr(GFile) native_file = NULL;
  117. @@ -476,6 +489,7 @@ add_single_file (BgPicturesSource *bg_source,
  118. picture_copied_for_read,
  119. bg_source);
  120. }
  121. +#endif
  122. retval = TRUE;
  123. @@ -496,6 +510,7 @@ add_single_file_from_info (BgPicturesSource *bg_source,
  124. return add_single_file (bg_source, file, content_type, mtime);
  125. }
  126. +#ifdef HAVE_GRILO
  127. static gboolean
  128. add_single_file_from_media (BgPicturesSource *bg_source,
  129. GFile *file,
  130. @@ -520,6 +535,7 @@ add_single_file_from_media (BgPicturesSource *bg_source,
  131. return add_single_file (bg_source, file, content_type, (guint64) mtime_unix);
  132. }
  133. +#endif
  134. gboolean
  135. bg_pictures_source_add (BgPicturesSource *bg_source,
  136. @@ -804,6 +820,7 @@ monitor_path (BgPicturesSource *self,
  137. return monitor;
  138. }
  139. +#ifdef HAVE_GRILO
  140. static void
  141. media_found_cb (BgPicturesSource *self, GrlMedia *media)
  142. {
  143. @@ -815,6 +832,7 @@ media_found_cb (BgPicturesSource *self, GrlMedia *media)
  144. g_object_set_data_full (G_OBJECT (file), "grl-media", g_object_ref (media), g_object_unref);
  145. add_single_file_from_media (self, file, media);
  146. }
  147. +#endif
  148. static void
  149. bg_pictures_source_init (BgPicturesSource *self)
  150. @@ -837,9 +855,11 @@ bg_pictures_source_init (BgPicturesSource *self)
  151. cache_path = bg_pictures_source_get_cache_path ();
  152. self->cache_dir_monitor = monitor_path (self, cache_path);
  153. +#ifdef HAVE_GRILO
  154. self->grl_miner = cc_background_grilo_miner_new ();
  155. g_signal_connect_object (self->grl_miner, "media-found", G_CALLBACK (media_found_cb), self, G_CONNECT_SWAPPED);
  156. cc_background_grilo_miner_start (self->grl_miner);
  157. +#endif
  158. }
  159. BgPicturesSource *
  160. diff --git a/panels/background/meson.build b/panels/background/meson.build
  161. index e9fa398d4..db18ffd8c 100644
  162. --- a/panels/background/meson.build
  163. +++ b/panels/background/meson.build
  164. @@ -81,20 +81,23 @@ sources = common_sources + files(
  165. 'bg-source.c',
  166. 'bg-wallpapers-source.c',
  167. 'cc-background-chooser.c',
  168. - 'cc-background-grilo-miner.c',
  169. 'cc-background-item.c',
  170. 'cc-background-panel.c',
  171. 'cc-background-preview.c',
  172. 'cc-background-xml.c',
  173. )
  174. +if enable_grilo
  175. + sources += files('cc-background-grilo-miner.c')
  176. +endif
  177. +
  178. deps = common_deps + [
  179. gdk_pixbuf_dep,
  180. gnome_desktop_dep,
  181. goa_dep,
  182. libxml_dep,
  183. dependency('cairo-gobject'),
  184. - dependency('grilo-0.3', version: '>= 0.3.0')
  185. + grilo_dep
  186. ]
  187. cflags += [
  188. diff --git a/panels/meson.build b/panels/meson.build
  189. index 6798f6997..90bb3deef 100644
  190. --- a/panels/meson.build
  191. +++ b/panels/meson.build
  192. @@ -16,7 +16,6 @@ panels = [
  193. 'microphone',
  194. 'mouse',
  195. 'notifications',
  196. - 'online-accounts',
  197. 'power',
  198. 'printers',
  199. 'region',
  200. @@ -29,6 +28,10 @@ panels = [
  201. 'user-accounts'
  202. ]
  203. +if enable_goa
  204. + panels += ['online-accounts']
  205. +endif
  206. +
  207. if enable_network_manager
  208. panels += ['network']
  209. endif
  210. diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
  211. index f20384394..b10611c80 100644
  212. --- a/shell/cc-panel-loader.c
  213. +++ b/shell/cc-panel-loader.c
  214. @@ -48,7 +48,9 @@ extern GType cc_network_panel_get_type (void);
  215. extern GType cc_wifi_panel_get_type (void);
  216. #endif /* BUILD_NETWORK */
  217. extern GType cc_notifications_panel_get_type (void);
  218. +#ifdef BUILD_GOA
  219. extern GType cc_goa_panel_get_type (void);
  220. +#endif /* BUILD_GOA */
  221. extern GType cc_power_panel_get_type (void);
  222. extern GType cc_printers_panel_get_type (void);
  223. extern GType cc_region_panel_get_type (void);
  224. @@ -112,7 +114,9 @@ static CcPanelLoaderVtable default_panels[] =
  225. PANEL_TYPE("wifi", cc_wifi_panel_get_type, cc_wifi_panel_static_init_func),
  226. #endif
  227. PANEL_TYPE("notifications", cc_notifications_panel_get_type, NULL),
  228. +#ifdef BUILD_GOA
  229. PANEL_TYPE("online-accounts", cc_goa_panel_get_type, NULL),
  230. +#endif
  231. PANEL_TYPE("power", cc_power_panel_get_type, NULL),
  232. PANEL_TYPE("printers", cc_printers_panel_get_type, NULL),
  233. PANEL_TYPE("region", cc_region_panel_get_type, NULL),
  234. --
  235. 2.26.3