2
* Copyright 2016 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Charles Kerr <charles.kerr@canonical.com>
20
#include "sound-player.h"
21
#include "sound-player-mock.h"
29
static guint signals[LAST_SIGNAL] = { 0 };
32
**** GObject boilerplate
35
static void indicator_power_sound_player_interface_init (
36
IndicatorPowerSoundPlayerInterface * iface);
38
G_DEFINE_TYPE_WITH_CODE (
39
IndicatorPowerSoundPlayerMock,
40
indicator_power_sound_player_mock,
42
G_IMPLEMENT_INTERFACE (INDICATOR_TYPE_POWER_SOUND_PLAYER,
43
indicator_power_sound_player_interface_init))
46
**** IndicatorPowerSoundPlayer virtual functions
50
my_play_uri (IndicatorPowerSoundPlayer * self, const gchar * uri)
52
g_signal_emit (self, signals[SIGNAL_URI_PLAYED], 0, uri, NULL);
60
indicator_power_sound_player_mock_class_init (IndicatorPowerSoundPlayerMockClass * klass G_GNUC_UNUSED)
62
signals[SIGNAL_URI_PLAYED] = g_signal_new (
64
G_TYPE_FROM_CLASS(klass),
66
G_STRUCT_OFFSET (IndicatorPowerSoundPlayerMockClass, uri_played),
68
g_cclosure_marshal_VOID__STRING,
69
G_TYPE_NONE, 1, G_TYPE_STRING);
73
indicator_power_sound_player_interface_init (IndicatorPowerSoundPlayerInterface * iface)
75
iface->play_uri = my_play_uri;
79
indicator_power_sound_player_mock_init (IndicatorPowerSoundPlayerMock * self G_GNUC_UNUSED)
87
IndicatorPowerSoundPlayer *
88
indicator_power_sound_player_mock_new (void)
90
gpointer o = g_object_new (INDICATOR_TYPE_POWER_SOUND_PLAYER_MOCK, NULL);
92
return INDICATOR_POWER_SOUND_PLAYER (o);