diff options
author | kremlin <ian@kremlin.cc> | 2014-06-03 02:42:23 +0800 |
---|---|---|
committer | kremlin <ian@kremlin.cc> | 2014-06-03 02:42:23 +0800 |
commit | 0df0018d1c9e682286e262be3d185ccf10f81038 (patch) | |
tree | f559d48f478c8fb5360707c07e0d5cca9738053f /src/interfaces | |
parent | b7f8df4449a7eb3acdbac54403028ed70ed15a22 (diff) | |
download | systembsd-0df0018d1c9e682286e262be3d185ccf10f81038.tar systembsd-0df0018d1c9e682286e262be3d185ccf10f81038.tar.gz systembsd-0df0018d1c9e682286e262be3d185ccf10f81038.tar.bz2 systembsd-0df0018d1c9e682286e262be3d185ccf10f81038.tar.lz systembsd-0df0018d1c9e682286e262be3d185ccf10f81038.tar.xz systembsd-0df0018d1c9e682286e262be3d185ccf10f81038.tar.zst systembsd-0df0018d1c9e682286e262be3d185ccf10f81038.zip |
moved things around to make source readable, added comments, changed init method return type from void -> GError
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/hostnamed/hostnamed.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/interfaces/hostnamed/hostnamed.c b/src/interfaces/hostnamed/hostnamed.c index 1638b31..d804b89 100644 --- a/src/interfaces/hostnamed/hostnamed.c +++ b/src/interfaces/hostnamed/hostnamed.c @@ -86,6 +86,13 @@ static const gchar spect_xml[] = " </interface>" "</node>"; +static const GDBusInterfaceVTable interface_vtable = +{ + handle_method_call, + handle_get_property, + handle_set_property +}; + static void handle_method_call(GDBusConnection *conn, const gchar *sender, const gchar *obj_path, @@ -136,13 +143,11 @@ static gboolean handle_set_property(GDBusConnection *conn, return TRUE; } -static const GDBusInterfaceVTable interface_vtable = -{ - handle_method_call, - handle_get_property, - handle_set_property -}; - +/* end method/property functions, begin bus name handlers + * TODO: these should be intertwined as to handle edge cases + * for when the system cannot immediately grab the name, as + * well as cases where the system unintendedly loses the name + */ static void on_bus_acquired(GDBusConnection *conn, const gchar *name, gpointer user_data) { @@ -169,12 +174,14 @@ static void on_name_lost(GDBusConnection *conn, const gchar *name, gpointer user exit(1); } -void hostnamed_init() { +/* safe call to try and start hostnamed */ +GError hostnamed_init() { guint bus_descriptor; GError *err = NULL; GMainLoop *loop; + /* TODO: there is a correct way to generate introspection XML, switch to that */ spect_data = g_dbus_node_info_new_for_xml(spect_xml, NULL); bus_descriptor = g_bus_own_name(G_BUS_TYPE_SESSION, @@ -189,7 +196,7 @@ void hostnamed_init() { loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(loop); - /* unclear */ + /* i am not sure what the system state is once g_main_loop exits */ g_bus_unown_name(bus_descriptor); g_dbus_node_info_unref(spect_data); |