[gnome-contacts] Build: make Maps optional.



commit b499b306734d4f7f94a7d4d197cd034270a307ab
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Fri Dec 29 15:52:48 2017 +0100

    Build: make Maps optional.
    
    This is a wanted feature for several reasons:
    * In an X11 session, this feature makes Contacts crash (for some).
    * In a Wayland session, it has trouble being properly rendered.
    * The status of what tile provider we can use is still unclear.

 meson.build                     |   10 +++++++---
 meson_options.txt               |    1 +
 src/contacts-contact-sheet.vala |   14 ++++++++------
 src/meson.build                 |   25 ++++++++++++++-----------
 4 files changed, 30 insertions(+), 20 deletions(-)
---
diff --git a/meson.build b/meson.build
index f6077dd..b9ce3cb 100644
--- a/meson.build
+++ b/meson.build
@@ -30,13 +30,10 @@ min_eds_version = '3.13.90'
 min_folks_version = '0.11.4'
 min_glib_version = '2.44.0'
 
-champlain = dependency('champlain-0.12')
-clutter_gtk = dependency('clutter-gtk-1.0')
 folks = dependency('folks', version: '>=' + min_folks_version)
 folks_eds = dependency('folks-eds', version: '>=' + min_folks_version)
 folks_telepathy = dependency('folks-telepathy', version: '>=' + min_folks_version)
 gee = dependency('gee-0.8')
-geocode_glib = dependency('geocode-glib-1.0', version: '>= 3.15.3')
 gio_unix = dependency('gio-unix-2.0', version: '>=' + min_glib_version)
 glib = dependency('glib-2.0', version: '>=' + min_glib_version)
 gmodule_export = dependency('gmodule-export-2.0', version: '>=' + min_glib_version)
@@ -60,6 +57,13 @@ if cheese_enabled
   cheese_enabled = cheese.found() and cheese_gtk.found()
 endif
 
+maps_enabled = get_option('maps')
+if maps_enabled
+  champlain = dependency('champlain-0.12')
+  clutter_gtk = dependency('clutter-gtk-1.0')
+  geocode_glib = dependency('geocode-glib-1.0', version: '>= 3.15.3')
+endif
+
 manpage_enabled = get_option('with-manpage')
 
 # Configuration
diff --git a/meson_options.txt b/meson_options.txt
index 040299d..2aa5cc6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,3 @@
 option('with-cheese', type: 'combo', choices: ['yes', 'no', 'auto'], value: 'auto', description: 'enable 
cheese webcam support')
+option('maps', type: 'boolean', value: true, description: 'Enable built-in support for maps.')
 option('with-manpage', type: 'boolean', value: true, description: 'enable building man pages')
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index 44a3cbe..9e21a89 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -225,12 +225,14 @@ public class Contacts.ContactSheet : Grid {
          add_row_with_label (ref i, TypeSet.general.format_type (addr), all_strs);
        }
 
-       if (addr_details.postal_addresses.size > 0) {
-         var map = new AddressMap (c, addr_details.postal_addresses);
-         map.load ();
-         attach (map, 1, i, 1, 1);
-         i++;
-       }
+#if HAVE_MAPS
+        if (addr_details.postal_addresses.size > 0) {
+          var map = new AddressMap (c, addr_details.postal_addresses);
+          map.load ();
+          attach (map, 1, i);
+          i++;
+        }
+#endif
       }
 
       if (i != 3)
diff --git a/src/meson.build b/src/meson.build
index f54b6eb..e5e6dec 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -7,7 +7,6 @@ install_data('org.gnome.Contacts.gschema.xml',
 # The gnome-contacts binary
 contacts_vala_sources = [
   'contacts-accounts-list.vala',
-  'contacts-address-map.vala',
   'contacts-app.vala',
   'contacts-avatar-dialog.vala',
   'contacts-contact-editor.vala',
@@ -46,20 +45,11 @@ contacts_c_args = [
   '-DLOCALEDIR="@0@"'.format(locale_dir),
 ]
 
-contacts_sources = [
-  contacts_c_sources,
-  contacts_vala_sources,
-  resources,
-]
-
 contacts_deps = [
-  champlain,
-  clutter_gtk,
   folks,
   folks_eds,
   folks_telepathy,
   gee,
-  geocode_glib,
   gio_unix,
   glib,
   gnome_desktop,
@@ -72,13 +62,26 @@ contacts_deps = [
   telepathy_glib,
 ]
 
-# Add extra stuff if cheese is enabled
+# Add extra stuff given a certain set of options
 if cheese_enabled
   contacts_deps += [ cheese, cheese_gtk ]
   contacts_vala_args += [ '-D', 'HAVE_CHEESE' ]
   contacts_c_sources += 'cheese-flash.c'
 endif
 
+if maps_enabled
+  contacts_deps += [ champlain, clutter_gtk, geocode_glib ]
+  contacts_vala_args += [ '-D', 'HAVE_MAPS' ]
+  contacts_vala_sources += 'contacts-address-map.vala'
+endif
+
+contacts_sources = [
+  contacts_c_sources,
+  contacts_vala_sources,
+  resources,
+]
+
+
 executable('gnome-contacts', contacts_sources,
   include_directories: config_h_dir,
   vala_args: contacts_vala_args,


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