aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c4
-rw-r--r--src/modules/hostnamed/hostnamed.c35
-rw-r--r--src/modules/hostnamed/tmp1
-rw-r--r--src/test.c7
4 files changed, 37 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index 5238699..2ff00fd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,5 +1,7 @@
#include "modules/hostnamed/hostnamed.c"
int main() {
+ hostnamed_init();
+ for(;;) {}
return 0;
-}
+}
diff --git a/src/modules/hostnamed/hostnamed.c b/src/modules/hostnamed/hostnamed.c
index ee25324..f3632f6 100644
--- a/src/modules/hostnamed/hostnamed.c
+++ b/src/modules/hostnamed/hostnamed.c
@@ -1,2 +1,35 @@
-#include <glib-2.0/glib.h>
+/* #include <glib-2.0/glib.h> */
+#include <gio/gio.h>
+
+static void on_bus_acquired(GDBusConnection *conn, const gchar *name, gpointer user_data) {
+ g_print("got bus, name: %s\n", name);
+
+ /* g_print("at %p, data @ %p\n", (void*)conn, user_data); */
+}
+
+static void on_name_acquired(GDBusConnection *conn, const gchar *name, gpointer user_data) {
+ g_print("got name %s\n", name);
+
+ /* g_print("at %p, data @ %p\n", (void*)conn, user_data); */
+}
+
+static void on_name_lost(GDBusConnection *conn, const gchar *name, gpointer user_data) {
+ g_print("lost name %s\n", name);
+
+ /* g_print("at %p, data @ %p\n", (void*)conn, user_data); */
+}
+
+void hostnamed_init() {
+ guint bus_descriptor;
+ GError *err = NULL;
+
+ bus_descriptor = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+ (gchar *)"org.freedesktop.hostname1",
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ on_bus_acquired,
+ on_name_acquired,
+ on_name_lost,
+ NULL,
+ NULL);
+}
diff --git a/src/modules/hostnamed/tmp b/src/modules/hostnamed/tmp
deleted file mode 100644
index c32d7ff..0000000
--- a/src/modules/hostnamed/tmp
+++ /dev/null
@@ -1 +0,0 @@
-TODO: delete me
diff --git a/src/test.c b/src/test.c
deleted file mode 100644
index 7a0d21a..0000000
--- a/src/test.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/types.h>
-
-#include <glib.h>
-
-int main() {
- return 0;
-}