~unity8-desktop-session-team/indicator-session/indicator-session-using-upstart

384.2.1 by Charles Kerr
port indicator-session to GMenu/cmake. Code coverage increased from 0% to 95.4%.
1
/*
2
 * Copyright 2013 Canonical Ltd.
3
 *
4
 * Authors:
5
 *   Charles Kerr <charles.kerr@canonical.com>
6
 *
7
 * This program is free software: you can redistribute it and/or modify it
8
 * under the terms of the GNU General Public License version 3, as published
9
 * by the Free Software Foundation.
10
 *
11
 * This program is distributed in the hope that it will be useful, but
12
 * WITHOUT ANY WARRANTY; without even the implied warranties of
13
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14
 * PURPOSE.  See the GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License along
17
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
20
#include <locale.h>
21
#include <stdlib.h> /* exit() */
22
23
#include <glib/gi18n.h>
24
#include <gio/gio.h>
25
26
#include "service.h"
27
28
/***
29
****
30
***/
31
384.2.14 by Charles Kerr
indicator-session-service should exit when it loses ownership of its name on the bus.
32
static void
384.2.101 by Charles Kerr
in main.c's on_name_lost(), silence minor 'unused parameter' compiler warning
33
on_name_lost (gpointer instance G_GNUC_UNUSED, gpointer loop)
384.2.14 by Charles Kerr
indicator-session-service should exit when it loses ownership of its name on the bus.
34
{
384.2.28 by Charles Kerr
remove the --replace command-line argument and property as we're using upstart for that
35
  g_warning ("exiting: service couldn't acquire, or lost ownership of, busname");
36
37
  g_main_loop_quit (loop);
384.2.14 by Charles Kerr
indicator-session-service should exit when it loses ownership of its name on the bus.
38
}
39
384.2.1 by Charles Kerr
port indicator-session to GMenu/cmake. Code coverage increased from 0% to 95.4%.
40
int
384.2.28 by Charles Kerr
remove the --replace command-line argument and property as we're using upstart for that
41
main (int argc G_GNUC_UNUSED, char ** argv G_GNUC_UNUSED)
384.2.1 by Charles Kerr
port indicator-session to GMenu/cmake. Code coverage increased from 0% to 95.4%.
42
{
43
  GMainLoop * loop;
44
  IndicatorSessionService * service;
45
415.2.1 by Lars Uebernickel
Work around glib's type initialization deadlock
46
  /* Work around a deadlock in glib's type initialization. It can be
47
   * removed when https://bugzilla.gnome.org/show_bug.cgi?id=674885 is
48
   * fixed.
49
   */
50
  g_type_ensure (G_TYPE_DBUS_CONNECTION);
51
384.2.1 by Charles Kerr
port indicator-session to GMenu/cmake. Code coverage increased from 0% to 95.4%.
52
  /* boilerplate i18n */
53
  setlocale (LC_ALL, "");
54
  bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
55
  textdomain (GETTEXT_PACKAGE);
56
57
  /* run */
384.2.28 by Charles Kerr
remove the --replace command-line argument and property as we're using upstart for that
58
  service = indicator_session_service_new ();
384.2.1 by Charles Kerr
port indicator-session to GMenu/cmake. Code coverage increased from 0% to 95.4%.
59
  loop = g_main_loop_new (NULL, FALSE);
384.2.14 by Charles Kerr
indicator-session-service should exit when it loses ownership of its name on the bus.
60
  g_signal_connect (service, INDICATOR_SESSION_SERVICE_SIGNAL_NAME_LOST,
61
                    G_CALLBACK(on_name_lost), loop);
384.2.1 by Charles Kerr
port indicator-session to GMenu/cmake. Code coverage increased from 0% to 95.4%.
62
  g_main_loop_run (loop);
63
64
  /* cleanup */
65
  g_clear_object (&service);
66
  g_main_loop_unref (loop);
67
  return 0;
68
}