begin hostnamed, clean up
authorkremlin <ian@kremlin.cc>
Wed, 28 May 2014 01:45:02 +0000 (20:45 -0500)
committerkremlin <ian@kremlin.cc>
Wed, 28 May 2014 01:45:02 +0000 (20:45 -0500)
Makefile
src/main.c
src/modules/hostnamed/hostnamed.c
src/modules/hostnamed/tmp [deleted file]
src/test.c [deleted file]

index 487027133174d67f4010fa07ea4d94f9c48bb491..27bff7a088f993c42d017cad902b7d1bb02c8acc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ DEBUGF=-O0 -v -g
 SRCDIR=src
 MODDIR=$(SRCDIR)/modules
 
-GLIBF=`pkg-config --cflags --libs glib-2.0 gobject-2.0`
+GLIBF=`pkg-config --cflags --libs glib-2.0 gobject-2.0 gio-2.0`
 
 hostnamed: 
-       gcc -o bin/out.bin $(CFLAGS) $(DEBUGF) $(GLIBF) $(SRCDIR)/main.c 
+       gcc -o bin/out.bin $(DEBUGF) $(GLIBF) $(SRCDIR)/main.c 
index 52386992f243ac3493fa5be4ce2d0dba7c6a82d2..2ff00fddfad06945dcf15802bfa0ecf0ddc8b4a8 100644 (file)
@@ -1,5 +1,7 @@
 #include "modules/hostnamed/hostnamed.c"
 
 int main() {
+       hostnamed_init();
+       for(;;) {}
        return 0;
-}      
+}
index ee2532426682c63ea52f4db228b24e861983715c..f3632f64a44db573d9e3bef07eec4e44f0ce7837 100644 (file)
@@ -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 (file)
index c32d7ff..0000000
+++ /dev/null
@@ -1 +0,0 @@
-TODO: delete me
diff --git a/src/test.c b/src/test.c
deleted file mode 100644 (file)
index 7a0d21a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/types.h>
-
-#include <glib.h>
-
-int main() {
-       return 0;
-}