aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkremlin <ian@kremlin.cc>2014-06-10 11:40:48 +0800
committerkremlin <ian@kremlin.cc>2014-06-10 11:40:48 +0800
commitd1e1db9ef3746f26e1fc645bc9283cac2b2991de (patch)
tree4386215625b01a4290ee6905b7b6339d6eb1f8f0
parentfc22d298fef215ccb3c156c30f05e080861c281b (diff)
downloadsystembsd-d1e1db9ef3746f26e1fc645bc9283cac2b2991de.tar
systembsd-d1e1db9ef3746f26e1fc645bc9283cac2b2991de.tar.gz
systembsd-d1e1db9ef3746f26e1fc645bc9283cac2b2991de.tar.bz2
systembsd-d1e1db9ef3746f26e1fc645bc9283cac2b2991de.tar.lz
systembsd-d1e1db9ef3746f26e1fc645bc9283cac2b2991de.tar.xz
systembsd-d1e1db9ef3746f26e1fc645bc9283cac2b2991de.tar.zst
systembsd-d1e1db9ef3746f26e1fc645bc9283cac2b2991de.zip
export proper xml FINALLY..
-rw-r--r--src/interfaces/hostnamed/hostnamed.c35
-rw-r--r--src/main.c7
-rw-r--r--src/main.h4
3 files changed, 25 insertions, 21 deletions
diff --git a/src/interfaces/hostnamed/hostnamed.c b/src/interfaces/hostnamed/hostnamed.c
index 42137cd..231bc4e 100644
--- a/src/interfaces/hostnamed/hostnamed.c
+++ b/src/interfaces/hostnamed/hostnamed.c
@@ -11,8 +11,6 @@ static void handle_method_call(GDBusConnection *conn,
GDBusMethodInvocation *invc,
gpointer usrdat) {
- //if(g_strcmp0(method_name, "Introspect"
-
GVariant *xml_ret_gvar;
GString *xml_ret;
@@ -71,17 +69,18 @@ static const GDBusInterfaceVTable interface_vtable =
static void on_bus_acquired(GDBusConnection *conn,
const gchar *name,
gpointer user_data) {
- g_print("got bus, name: %s\n", name);
-
- guint reg_id;
-
- reg_id = g_dbus_connection_register_object(conn,
- "/org/freedesktop/hostname1",
- spect_data->interfaces[0],
- &interface_vtable,
- NULL,
- NULL,
- NULL);
+
+ GError *err;
+
+ g_print("got bus, name: %s\n", name);
+
+ //GDBusObjectSkeleton *hostnamed_dbobj = g_dbus_object_skeleton_new("/org/freedesktop/hostname1");
+
+ g_dbus_connection_register_object(conn,
+ "/org/freedesktop/hostname1",
+ spect_data->interfaces[0],
+ &interface_vtable,
+ NULL, NULL, NULL);
}
static void on_name_acquired(GDBusConnection *conn,
@@ -104,10 +103,16 @@ static void on_name_lost(GDBusConnection *conn,
GError * hostnamed_init() {
guint bus_descriptor;
- GError *err = NULL;
+ GError *err = NULL;
+ gchar **hostnamed_ispect_xml = g_malloc(3000);
+ gchar *hostnamed_joined_xml = g_malloc(3000);
+
+ g_file_get_contents("conf/hostnamed-ispect.xml", hostnamed_ispect_xml, NULL, err);
+ hostnamed_joined_xml = g_strjoinv("\n", hostnamed_ispect_xml);
+ spect_data = g_dbus_node_info_new_for_xml(hostnamed_joined_xml, NULL);
bus_descriptor = g_bus_own_name(G_BUS_TYPE_SYSTEM,
- (gchar *)"org.freedesktop.hostname1",
+ "org.freedesktop.hostname1",
G_BUS_NAME_OWNER_FLAGS_NONE,
on_bus_acquired,
on_name_acquired,
diff --git a/src/main.c b/src/main.c
index 59e23fe..f81e020 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,12 +1,11 @@
/* debugging */
-#define INSTALL 1
-#define NO_BUILTIN_XML 1
-
+//#define INSTALL 1
+//#define NO_BUILTIN_XML 1
/* end debugging */
#include <gio/gio.h>
#include "interfaces/hostnamed/hostnamed.c"
-#include "main.h"
+//#include "main.h"
int main() {
diff --git a/src/main.h b/src/main.h
index 5e8093f..c8f9781 100644
--- a/src/main.h
+++ b/src/main.h
@@ -1,5 +1,4 @@
#include <gio/gio.h>
-#include "xml_defs.h"
gboolean install_conf() {
gchar *our_conf_uri = "systemd-utl/xml-conf/";
@@ -13,7 +12,8 @@ gboolean install_conf() {
/*TODO permissions w/ this */
g_mkdir_with_parents(our_conf_path, 0644);
- return (errors[0] == NULL);
+ return FALSE;
+ //return (errors[0] == NULL);
} else
return FALSE;