~indicator-applet-developers/indicator-power/trunk.16.05

« back to all changes in this revision

Viewing changes to src/main.c

  • Committer: CI Train Bot
  • Author(s): Charles Kerr, charles kerr
  • Date: 2016-01-05 14:37:48 UTC
  • mfrom: (290.1.24 lp-1470767-low-battery-sound)
  • Revision ID: ci-train-bot@canonical.com-20160105143748-8vkmb6yhgz603fus
Play a 'low battery' sound when the low battery notification is shown.
 Fixes: #1470767
Approved by: Ted Gould, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright 2013 Canonical Ltd.
3
 
 *
4
 
 * Authors:
5
 
 *   Charles Kerr <charles.kerr@canonical.com>
 
2
 * Copyright 2013-2016 Canonical Ltd.
6
3
 *
7
4
 * This program is free software: you can redistribute it and/or modify it
8
5
 * under the terms of the GNU General Public License version 3, as published
15
12
 *
16
13
 * You should have received a copy of the GNU General Public License along
17
14
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authors:
 
17
 *   Charles Kerr <charles.kerr@canonical.com>
18
18
 */
19
19
 
20
20
#include <locale.h>
23
23
#include <glib/gi18n.h>
24
24
 
25
25
#include "device.h"
 
26
#include "notifier.h"
26
27
#include "service.h"
 
28
#include "sound-player-gst.h"
27
29
#include "testing.h"
28
30
 
29
31
/***
40
42
int
41
43
main (int argc G_GNUC_UNUSED, char ** argv G_GNUC_UNUSED)
42
44
{
 
45
  IndicatorPowerSoundPlayer * sound_player;
 
46
  IndicatorPowerNotifier * notifier;
43
47
  IndicatorPowerService * service;
44
48
  IndicatorPowerTesting * testing;
45
49
  GMainLoop * loop;
50
54
  textdomain (GETTEXT_PACKAGE);
51
55
 
52
56
  /* run */
53
 
  service = indicator_power_service_new (NULL);
 
57
  sound_player = indicator_power_sound_player_gst_new ();
 
58
  notifier = indicator_power_notifier_new (sound_player);
 
59
  service = indicator_power_service_new(NULL, notifier);
54
60
  testing = indicator_power_testing_new (service);
55
61
  loop = g_main_loop_new (NULL, FALSE);
56
62
  g_signal_connect (service, INDICATOR_POWER_SERVICE_SIGNAL_NAME_LOST,
59
65
 
60
66
  /* cleanup */
61
67
  g_main_loop_unref (loop);
 
68
  g_clear_object (&testing);
62
69
  g_clear_object (&service);
63
 
  g_clear_object (&testing);
 
70
  g_clear_object (&notifier);
 
71
  g_clear_object (&sound_player);
64
72
  return 0;
65
73
}