X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Finterfaces%2Fhostnamed%2Fhostnamed.c;h=0559b8b740bc49fd01803b712c3dd54b35f4d452;hb=1cd91c9ccc0301e155901f137decbb0e1fcd93ea;hp=114ad10043d138b85cf143b7ad39a86976b9342f;hpb=6de394d4129d558807da8d52bc736494ccfbb387;p=systembsd.git diff --git a/src/interfaces/hostnamed/hostnamed.c b/src/interfaces/hostnamed/hostnamed.c index 114ad10..0559b8b 100644 --- a/src/interfaces/hostnamed/hostnamed.c +++ b/src/interfaces/hostnamed/hostnamed.c @@ -1,8 +1,6 @@ #include -#include "hostnamed.h" GDBusNodeInfo *spect_data; -GMainLoop *loop; static void handle_method_call(GDBusConnection *conn, const gchar *sender, @@ -13,11 +11,11 @@ static void handle_method_call(GDBusConnection *conn, GDBusMethodInvocation *invc, gpointer usrdat) { - g_printf("%s wants to call %s, at %s with interface %s\n", sender, method_name, obj_path, interf_name); + //if(g_strcmp0(method_name, "Introspect" - GString *xml_ret; GVariant *xml_ret_gvar; - + GString *xml_ret; + g_dbus_interface_info_generate_xml(spect_data->interfaces[0], (guint)0, xml_ret); xml_ret_gvar = g_variant_new_string(xml_ret->str); g_dbus_method_invocation_return_value(invc, xml_ret_gvar); @@ -84,7 +82,6 @@ static void on_bus_acquired(GDBusConnection *conn, NULL, NULL, NULL); - g_assert(reg_id > 0); } static void on_name_acquired(GDBusConnection *conn, @@ -99,7 +96,8 @@ static void on_name_lost(GDBusConnection *conn, gpointer user_data) { g_print("lost name %s, exiting...\n", name); - g_main_loop_quit(loop); + //TODO exit through g_main_loop properly... + exit(0); } /* safe call to try and start hostnamed */ @@ -107,8 +105,16 @@ GError * hostnamed_init() { guint bus_descriptor; GError *err = NULL; + gchar **hnd_ispect_xml; + GDir *cur_dir; + gchar *dir; + + cur_dir = g_dir_open("./../", 0, err); + + g_sprintf(dir, "%s\n", g_dir_read_name(cur_dir)); - spect_data = g_dbus_node_info_new_for_xml(SYSTEMD_HOSTNAMED_XML, &err); + //g_file_get_contents("../../../../conf/hostnamed-ispect.xml", hnd_ispect_xml, NULL, err); + //spect_data = g_dbus_node_info_new_for_xml(hnd_ispect_xml, &err); bus_descriptor = g_bus_own_name(G_BUS_TYPE_SYSTEM, (gchar *)"org.freedesktop.hostname1", @@ -119,9 +125,6 @@ GError * hostnamed_init() { NULL, NULL); - loop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(loop); - //TODO: malloc and return reference as if a main() closed return err; }