Blob Blame History Raw
From 767bbcdce0f3a3189003ed2a6b4b2a6b16b2c9ba Mon Sep 17 00:00:00 2001
From: Fabio Valentini <decathorpe@users.noreply.github.com>
Date: Tue, 6 Nov 2018 19:04:05 +0100
Subject: [PATCH] Add conditional compilation for Ubuntu's GSD modifications
 (#182)

---
 meson.build             | 6 ++++++
 meson_options.txt       | 1 +
 src/SettingsDaemon.vala | 5 ++++-
 src/meson.build         | 8 +++++++-
 4 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 meson_options.txt

diff --git a/meson.build b/meson.build
index fadcf2a..27b24be 100644
--- a/meson.build
+++ b/meson.build
@@ -8,8 +8,14 @@ project(
 gnome = import('gnome')
 i18n = import('i18n')
 
+ubuntu_patched_gsd = get_option('ubuntu-patched-gsd')
+
 add_project_arguments(['--vapidir', join_paths(meson.current_source_dir(), 'vapi')], language: 'vala')
 
+if ubuntu_patched_gsd
+    add_project_arguments(['--define', 'UBUNTU_PATCHED_GSD'], language: 'vala')
+endif
+
 add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), language:'c')
 
 greeter_resources = gnome.compile_resources(
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..2222fed
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1 @@
+option('ubuntu-patched-gsd', type: 'boolean', value: true) 
diff --git a/src/SettingsDaemon.vala b/src/SettingsDaemon.vala
index 21209ab..7f71b5a 100644
--- a/src/SettingsDaemon.vala
+++ b/src/SettingsDaemon.vala
@@ -22,6 +22,7 @@ public class SettingsDaemon : Object {
     private int n_names = 0;
 
     public void start () {
+#if UBUNTU_PATCHED_GSD
         string[] disabled = { "org.gnome.settings-daemon.plugins.background",
                               "org.gnome.settings-daemon.plugins.clipboard",
                               "org.gnome.settings-daemon.plugins.font",
@@ -52,7 +53,7 @@ public class SettingsDaemon : Object {
         foreach (var schema in enabled) {
             set_plugin_enabled (schema, true);
         }
-
+#endif
         /* Pretend to be GNOME session */
         session_manager = new SessionManagerInterface ();
         n_names++;
@@ -71,6 +72,7 @@ public class SettingsDaemon : Object {
                            () => debug ("Failed to acquire name org.gnome.SessionManager"));
     }
 
+#if UBUNTU_PATCHED_GSD
     private void set_plugin_enabled (string schema_name, bool enabled) {
         var source = SettingsSchemaSource.get_default ();
         var schema = source.lookup (schema_name, false);
@@ -79,6 +81,7 @@ public class SettingsDaemon : Object {
             settings.set_boolean ("active", enabled);
         }
     }
+#endif
 
     private void start_settings_daemon () {
         n_names--;
diff --git a/src/meson.build b/src/meson.build
index e5ee6e0..b2bdf74 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,7 +1,13 @@
 conf_data = configuration_data()
 conf_data.set('CONF_DIR', join_paths(get_option('sysconfdir'), 'lightdm'))
 conf_data.set('GETTEXT_PACKAGE', meson.project_name())
-conf_data.set('GSD_DIR', '/usr/lib/gnome-settings-daemon/')
+
+if ubuntu_patched_gsd
+    conf_data.set('GSD_DIR', '/usr/lib/gnome-settings-daemon/')
+else
+    conf_data.set('GSD_DIR', join_paths(get_option('prefix'), get_option('libexecdir')))
+endif
+
 conf_data.set('VERSION', meson.project_version())
 config_header = configure_file (
     input: 'config.vala.in',