From a8fd3f49bf6509bd4545aec3292d2fc022d847ca Mon Sep 17 00:00:00 2001 From: charles kerr Date: Fri, 1 Jan 2016 15:58:55 -0600 Subject: make a SoundPlayer interface so we can mock it in the tests this requires an annoying amount of scaffolding: 1. implement gst and mock classes to implement the SoundPlayer interface 2. modify notifier to take a SoundPlayer argument in its ctor 3. modify service to take a Notifier argument in its ctor instead of instantiating it on its own 4. change main to update the startup steps for player/notifier/service --- src/main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 03e100d..2837b59 100644 --- a/src/main.c +++ b/src/main.c @@ -23,7 +23,9 @@ #include #include "device.h" +#include "notifier.h" #include "service.h" +#include "sound-player-gst.h" #include "testing.h" /*** @@ -40,6 +42,8 @@ on_name_lost (gpointer instance G_GNUC_UNUSED, gpointer loop) int main (int argc G_GNUC_UNUSED, char ** argv G_GNUC_UNUSED) { + IndicatorPowerSoundPlayer * sound_player; + IndicatorPowerNotifier * notifier; IndicatorPowerService * service; IndicatorPowerTesting * testing; GMainLoop * loop; @@ -50,7 +54,9 @@ main (int argc G_GNUC_UNUSED, char ** argv G_GNUC_UNUSED) textdomain (GETTEXT_PACKAGE); /* run */ - service = indicator_power_service_new (NULL); + sound_player = indicator_power_sound_player_gst_new (); + notifier = indicator_power_notifier_new (sound_player); + service = indicator_power_service_new(NULL, notifier); testing = indicator_power_testing_new (service); loop = g_main_loop_new (NULL, FALSE); g_signal_connect (service, INDICATOR_POWER_SERVICE_SIGNAL_NAME_LOST, @@ -59,7 +65,9 @@ main (int argc G_GNUC_UNUSED, char ** argv G_GNUC_UNUSED) /* cleanup */ g_main_loop_unref (loop); - g_clear_object (&service); g_clear_object (&testing); + g_clear_object (&service); + g_clear_object (¬ifier); + g_clear_object (&sound_player); return 0; } -- cgit v1.2.3 From 9b631e9353d206ab5c8bb64317f584024ebe0f4a Mon Sep 17 00:00:00 2001 From: charles kerr Date: Fri, 1 Jan 2016 18:49:13 -0600 Subject: fix another touched file's copyright date --- src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 2837b59..34185b4 100644 --- a/src/main.c +++ b/src/main.c @@ -1,8 +1,5 @@ /* - * Copyright 2013 Canonical Ltd. - * - * Authors: - * Charles Kerr + * Copyright 2013-2016 Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 3, as published @@ -15,6 +12,9 @@ * * You should have received a copy of the GNU General Public License along * with this program. If not, see . + * + * Authors: + * Charles Kerr */ #include -- cgit v1.2.3 From f4d66118c3a845892b32495efec3d6473e17baca Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 1 Feb 2016 10:53:07 -0600 Subject: for low power notifications, use libnotify's 'sound-file' property instead of indicator-power calling the sound player directly --- src/main.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 34185b4..ce54ae8 100644 --- a/src/main.c +++ b/src/main.c @@ -25,7 +25,6 @@ #include "device.h" #include "notifier.h" #include "service.h" -#include "sound-player-gst.h" #include "testing.h" /*** @@ -42,7 +41,6 @@ on_name_lost (gpointer instance G_GNUC_UNUSED, gpointer loop) int main (int argc G_GNUC_UNUSED, char ** argv G_GNUC_UNUSED) { - IndicatorPowerSoundPlayer * sound_player; IndicatorPowerNotifier * notifier; IndicatorPowerService * service; IndicatorPowerTesting * testing; @@ -54,8 +52,7 @@ main (int argc G_GNUC_UNUSED, char ** argv G_GNUC_UNUSED) textdomain (GETTEXT_PACKAGE); /* run */ - sound_player = indicator_power_sound_player_gst_new (); - notifier = indicator_power_notifier_new (sound_player); + notifier = indicator_power_notifier_new(); service = indicator_power_service_new(NULL, notifier); testing = indicator_power_testing_new (service); loop = g_main_loop_new (NULL, FALSE); @@ -68,6 +65,5 @@ main (int argc G_GNUC_UNUSED, char ** argv G_GNUC_UNUSED) g_clear_object (&testing); g_clear_object (&service); g_clear_object (¬ifier); - g_clear_object (&sound_player); return 0; } -- cgit v1.2.3