~jbicha/hud/build-depend-on-valac-not-gir

« back to all changes in this revision

Viewing changes to service/hud-service.c

Merging the HUD into indicator-appmenu

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Basic HUD service.
 
3
 
 
4
Copyright 2011 Canonical Ltd.
 
5
 
 
6
Authors:
 
7
    Ted Gould <ted@canonical.com>
 
8
 
 
9
This program is free software: you can redistribute it and/or modify it 
 
10
under the terms of the GNU General Public License version 3, as published 
 
11
by the Free Software Foundation.
 
12
 
 
13
This program is distributed in the hope that it will be useful, but 
 
14
WITHOUT ANY WARRANTY; without even the implied warranties of 
 
15
MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
 
16
PURPOSE.  See the GNU General Public License for more details.
 
17
 
 
18
You should have received a copy of the GNU General Public License along 
 
19
with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
*/
 
21
 
 
22
#include <glib.h>
 
23
#include <gio/gio.h>
 
24
 
 
25
#include "shared-values.h"
 
26
#include "hud-dbus.h"
 
27
 
 
28
static GMainLoop * mainloop = NULL;
 
29
 
 
30
static void
 
31
name_lost_cb (GDBusConnection * connection, const gchar * name, gpointer user_data)
 
32
{
 
33
        g_error("Unable to get name '%s'", name);
 
34
        g_main_loop_quit(mainloop);
 
35
        return;
 
36
}
 
37
 
 
38
int
 
39
main (int argv, char * argc[])
 
40
{
 
41
        g_type_init();
 
42
 
 
43
        HudDbus * dbus = hud_dbus_new();
 
44
 
 
45
        g_bus_own_name(G_BUS_TYPE_SESSION,
 
46
        /* Name */           DBUS_NAME,
 
47
        /* Flags */          G_BUS_NAME_OWNER_FLAGS_NONE,
 
48
        /* Bus Acquired */   NULL,
 
49
        /* Name Acquired */  NULL,
 
50
        /* Name Lost */      name_lost_cb,
 
51
        /* User Data */      NULL,
 
52
        /* Destroy */        NULL);
 
53
 
 
54
 
 
55
        mainloop = g_main_loop_new(NULL, FALSE);
 
56
        g_main_loop_run(mainloop);
 
57
 
 
58
        g_main_loop_unref(mainloop);
 
59
        g_object_unref(dbus);
 
60
 
 
61
        return 0;
 
62
}