begin hostnamed, clean up
[systembsd.git] / src / modules / hostnamed / hostnamed.c
1 /* #include <glib-2.0/glib.h> */
2 #include <gio/gio.h>
3
4 static void on_bus_acquired(GDBusConnection *conn, const gchar *name, gpointer user_data) {
5 g_print("got bus, name: %s\n", name);
6
7 /* g_print("at %p, data @ %p\n", (void*)conn, user_data); */
8 }
9
10 static void on_name_acquired(GDBusConnection *conn, const gchar *name, gpointer user_data) {
11 g_print("got name %s\n", name);
12
13 /* g_print("at %p, data @ %p\n", (void*)conn, user_data); */
14 }
15
16 static void on_name_lost(GDBusConnection *conn, const gchar *name, gpointer user_data) {
17 g_print("lost name %s\n", name);
18
19 /* g_print("at %p, data @ %p\n", (void*)conn, user_data); */
20 }
21
22 void hostnamed_init() {
23 guint bus_descriptor;
24 GError *err = NULL;
25
26 bus_descriptor = g_bus_own_name(G_BUS_TYPE_SYSTEM,
27 (gchar *)"org.freedesktop.hostname1",
28 G_BUS_NAME_OWNER_FLAGS_NONE,
29 on_bus_acquired,
30 on_name_acquired,
31 on_name_lost,
32 NULL,
33 NULL);
34 }
35