(3) add needed GLib headers, move loop and bus descr out of main into global
[systembsd.git] / src / interfaces / logind / logind.c
index 6c6a3e03421e07fe2a94e56d27243804aeb8caca..3b9cab68686c73dcc592e1e45043e5c581a62c41 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <unistd.h>
 #include <limits.h>
+#include <signal.h>
 
 #include <sys/param.h>
 #include <string.h>
 #include <glib-unix.h>
 
 #include "logind-gen.h"
+#include "logind.h"
 
 GPtrArray *logind_freeable;
 Login1Manager *logind_interf;
 
+GMainLoop *logind_loop;
+
+guint bus_descriptor;
+gboolean dbus_interface_exported; /* reliable because of gdbus operational guarantees */
+
 /* --- begin method/property/dbus signal code --- */
 
 /*static gboolean
@@ -91,15 +98,6 @@ static void logind_on_name_acquired(GDBusConnection *conn,
 
 }
 
-/* --- end bus/name handlers, begin misc functions --- */
-
-/* free()'s */
-void logind_mem_clean() {
-
-    g_ptr_array_foreach(logind_freeable, (GFunc) g_free, NULL);
-       g_ptr_array_free(logind_freeable, TRUE);
-}
-
 static void logind_on_name_lost(GDBusConnection *conn,
                                 const gchar *name,
                                 gpointer user_data) {
@@ -111,10 +109,16 @@ static void logind_on_name_lost(GDBusConnection *conn,
 
 }
 
-int main() {
+/* --- end bus/name handlers, begin misc unix functions --- */
 
-       guint bus_descriptor;
-       GMainLoop *logind_loop;
+/* free()'s */
+void logind_mem_clean() {
+
+    g_ptr_array_foreach(logind_freeable, (GFunc) g_free, NULL);
+       g_ptr_array_free(logind_freeable, TRUE);
+}
+
+int main() {
 
        logind_loop = g_main_loop_new(NULL, TRUE);
        logind_freeable = g_ptr_array_new();