diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2016-01-04 09:38:01 -0600 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2021-08-28 10:17:14 +0200 |
commit | 1182c7fb79942c14f2a713063182778e6af94cd1 (patch) | |
tree | 8868f158ed71d8e97e79220a42c590fa6a44666d | |
parent | 5d038638f58765ec3859797704c5d0e1c0fa7903 (diff) | |
download | ayatana-indicator-power-1182c7fb79942c14f2a713063182778e6af94cd1.tar.gz ayatana-indicator-power-1182c7fb79942c14f2a713063182778e6af94cd1.tar.bz2 ayatana-indicator-power-1182c7fb79942c14f2a713063182778e6af94cd1.zip |
add build-dep to accountsservice-ubuntu-schemas instead of bundling com.ubuntu.touch.AccountsService.Sound.xml into our source tree
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rw-r--r-- | src/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/com.ubuntu.touch.AccountsService.Sound.xml | 47 | ||||
-rw-r--r-- | src/notifier.c | 23 |
5 files changed, 35 insertions, 54 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d59545..bc5729a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,13 @@ pkg_check_modules( ) include_directories(${URLDISPATCHER_INCLUDE_DIRS}) +if(EXISTS "/usr/share/accountsservice/interfaces/com.ubuntu.touch.AccountsService.Sound.xml") + set (HAVE_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS ON) + add_definitions ( -DHAS_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS ) +else() + set (HAVE_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS OFF) +endif() + ## ## custom targets ## diff --git a/debian/control b/debian/control index a70647f..534e197 100644 --- a/debian/control +++ b/debian/control @@ -10,6 +10,7 @@ Build-Depends: cmake, libnotify-dev (>= 0.7.6), libglib2.0-dev (>= 2.36), liblomiri-url-dispatcher-dev | hello, + accountsservice-ubuntu-schemas | hello, # for packaging debhelper (>= 9), dpkg-dev (>= 1.16.1.1), diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 01a0558..4654380 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,10 +39,13 @@ add_gdbus_codegen_with_namespace(SERVICE_GENERATED_SOURCES dbus-testing org.ayatana.indicator.power Dbus ${CMAKE_SOURCE_DIR}/data/org.ayatana.indicator.power.Testing.xml) -add_gdbus_codegen_with_namespace(SERVICE_GENERATED_SOURCES dbus-accounts-sound - com.ubuntu.touch - Dbus - ${CMAKE_SOURCE_DIR}/src/com.ubuntu.touch.AccountsService.Sound.xml) + +if (HAVE_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS) + add_gdbus_codegen_with_namespace(SERVICE_GENERATED_SOURCES dbus-accounts-sound + com.ubuntu.touch + Dbus + /usr/share/accountsservice/interfaces/com.ubuntu.touch.AccountsService.Sound.xml) +endif() # add the bin dir to our include path so the code can find the generated header files include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/src/com.ubuntu.touch.AccountsService.Sound.xml b/src/com.ubuntu.touch.AccountsService.Sound.xml deleted file mode 100644 index 6e2ca5f..0000000 --- a/src/com.ubuntu.touch.AccountsService.Sound.xml +++ /dev/null @@ -1,47 +0,0 @@ -<node> - <interface name="com.ubuntu.touch.AccountsService.Sound"> - - <annotation name="org.freedesktop.Accounts.VendorExtension" value="true"/> - - <!-- Muted is all sound, SilentMode is only non-user-initiated sounds --> - <property name="SilentMode" type="b" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue" value="false"/> - </property> - - <property name="IncomingCallSound" type="s" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue.String" - value="/usr/share/sounds/ubuntu/ringtones/Ubuntu.ogg"/> - </property> - - <property name="IncomingMessageSound" type="s" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue.String" - value="/usr/share/sounds/ubuntu/notifications/Xylo.ogg"/> - </property> - - <property name="IncomingCallVibrate" type="b" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/> - </property> - - <property name="IncomingCallVibrateSilentMode" type="b" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/> - </property> - - <property name="IncomingMessageVibrate" type="b" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/> - </property> - - <property name="IncomingMessageVibrateSilentMode" type="b" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/> - </property> - - <!-- "Other vibrations" should cover all vibrations except for those relating to phone calls and messages --> - <property name="OtherVibrate" type="b" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/> - </property> - - <property name="DialpadSoundsEnabled" type="b" access="readwrite"> - <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/> - </property> - - </interface> -</node> diff --git a/src/notifier.c b/src/notifier.c index ad7efb0..487f889 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -18,7 +18,11 @@ */ #include "datafiles.h" + +#ifdef HAS_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS #include "dbus-accounts-sound.h" +#endif + #include "dbus-battery.h" #include "dbus-shared.h" #include "notifier.h" @@ -89,7 +93,9 @@ typedef struct IndicatorPowerSoundPlayer * sound_player; GCancellable * cancellable; + #ifdef HAS_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS DbusAccountsServiceSound * accounts_service_sound_proxy; + #endif } IndicatorPowerNotifierPrivate; @@ -147,16 +153,18 @@ get_battery_power_level (IndicatorPowerDevice * battery) **** Sounds ***/ +#ifdef HAS_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS static void on_sound_proxy_ready (GObject * source_object G_GNUC_UNUSED, GAsyncResult * res, gpointer gself) { GError * error; - DbusAccountsServiceSound * proxy; - error = NULL; + + DbusAccountsServiceSound * proxy; proxy = dbus_accounts_service_sound_proxy_new_for_bus_finish (res, &error); + if (error != NULL) { if (!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -172,6 +180,7 @@ on_sound_proxy_ready (GObject * source_object G_GNUC_UNUSED, } } + static gboolean silent_mode (IndicatorPowerNotifier * self) { @@ -180,6 +189,7 @@ silent_mode (IndicatorPowerNotifier * self) return (p->accounts_service_sound_proxy != NULL) && (dbus_accounts_service_sound_get_silent_mode(p->accounts_service_sound_proxy)); } +#endif static void play_low_battery_sound (IndicatorPowerNotifier * self) @@ -191,9 +201,11 @@ play_low_battery_sound (IndicatorPowerNotifier * self) /* can't play? */ g_return_if_fail (p->sound_player != NULL); + #ifdef HAS_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS /* won't play? */ if (silent_mode(self)) return; + #endif filename = datafile_find(DATAFILE_TYPE_SOUND, key); if (filename != NULL) @@ -459,7 +471,10 @@ my_dispose (GObject * o) notification_clear (self); indicator_power_notifier_set_battery (self, NULL); g_clear_object (&p->dbus_battery); + + #ifdef HAS_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS g_clear_object (&p->accounts_service_sound_proxy); + #endif G_OBJECT_CLASS (indicator_power_notifier_parent_class)->dispose (o); } @@ -467,7 +482,7 @@ my_dispose (GObject * o) static void my_finalize (GObject * o G_GNUC_UNUSED) { - /* FIXME: This is an awkward place to put this. + /* FIXME: This is an awkward place to put this. Ordinarily something like this would go in main(), but we need libnotify to clean itself up before shutting down the bus in the unit tests as well. */ if (!--instance_count) @@ -494,6 +509,7 @@ indicator_power_notifier_init (IndicatorPowerNotifier * self) if (!instance_count++ && !notify_init("ayatana-indicator-power-service")) g_critical("Unable to initialize libnotify! Notifications might not be shown."); + #ifdef HAS_UT_ACCTSERVICE_SYSTEMSOUND_SETTINGS gchar* object_path = g_strdup_printf("/org/freedesktop/Accounts/User%lu", (gulong)getuid()); dbus_accounts_service_sound_proxy_new_for_bus( G_BUS_TYPE_SYSTEM, @@ -504,6 +520,7 @@ indicator_power_notifier_init (IndicatorPowerNotifier * self) on_sound_proxy_ready, self); g_clear_pointer(&object_path, g_free); + #endif } static void |