diff --git a/meson.build b/meson.build index 9b432ea..1d4d7c9 100644 --- a/meson.build +++ b/meson.build @@ -13,7 +13,7 @@ glib_dep = dependency('glib-2.0') granite_dep = dependency('granite', version: '>= 5.3.0') gdk_pixbuf_dep = dependency('gdk-pixbuf-2.0') gexiv2_dep = dependency('gexiv2') -pk_dep = dependency('packagekit-glib2') +pk_dep = dependency('packagekit-glib2', required: false) i18n = import('i18n') gettext_name = meson.project_name() diff --git a/src/Application.vala b/src/Application.vala index 018b7b9..c15385d 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -78,9 +78,11 @@ public sealed class SettingsDaemon.Application : Gtk.Application { protected override bool dbus_register (DBusConnection connection, string object_path) throws Error { base.dbus_register (connection, object_path); +#if PK_AVAILABLE connection.register_object (object_path, new Backends.SystemUpdate ()); +#endif -#if UBUNTU_DRIVERS +#if UBUNTU_DRIVERS && PK_AVAILABLE connection.register_object (object_path, new Backends.UbuntuDrivers ()); #endif diff --git a/src/meson.build b/src/meson.build index 472148b..39b7525 100644 --- a/src/meson.build +++ b/src/meson.build @@ -9,12 +9,18 @@ sources = files( 'Backends/NightLightSettings.vala', 'Backends/PowerProfilesSync.vala', 'Backends/PrefersColorSchemeSettings.vala', - 'Backends/SystemUpdate.vala', - 'Utils/PkUtils.vala', 'Utils/SessionUtils.vala', 'Utils/SunriseSunsetCalculator.vala', ) +if pk_dep.found() + sources += files( + 'Backends/SystemUpdate.vala', + 'Utils/PkUtils.vala', + ) + args += '--define=PK_AVAILABLE' +endif + args = [] if get_option('ubuntu_drivers')