finish migrating old code to work with gdbus-codegen types, cleaned up config IO...
[systembsd.git] / src / main.h
index 2fd39eaa782bd5fb6051b6d2146fd418a08e6639..a5fd502aa5dd181248f8594eea995e887ed4bb44 100644 (file)
@@ -1,51 +1,21 @@
 #include <gio/gio.h>
 
-#ifdef  NO BUILTIN XML
-//TODO install conf
-#endif
+//TODO change this to config dir, not data dir
+gboolean install_conf() {
+       gchar *our_conf_uri   = "systemd-utl/xml-conf/";
+       gchar **data_dir = g_get_system_data_dirs();
 
-#ifndef NO_BUILTIN_XML
-gchar **hostnamed_config_xml =
-"<!DOCTYPE busconfig PUBLIC"
-"         \"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN\""
-"         \"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd\">"
-"<busconfig>"
-"   <!-- Only members of 'wheel' and user 'daemon' may set hostnames -->"
-"   <policy group=\"wheel\">"
-"       <allow own=\"org.freedesktop.hostname1\"/>"
-"       <allow send_destination=\"org.freedesktop.hostname1\"/>"
-"       <allow receive_sender=\"org.freedesktop.hostname1\"/>"
-"   </policy>"
-"   <policy user=\"daemon\">"
-"       <allow own=\"org.freedesktop.hostname1\"/>"
-"       <allow send_destination=\"org.freedesktop.hostname1\"/>"
-"       <allow receive_sender=\"org.freedesktop.hostname1\"/>"
-"    </policy>"
-"</busconfig>";
+       if(g_strcmp0(data_dir[0], NULL)) {
+               const gchar our_conf_path[256];
+               g_snprintf(our_conf_path, sizeof our_conf_path, "%s%s", *data_dir, our_conf_uri);
+               GError **errors;
 
-gchar **hostnamed_ispect_xml =
-"<!-- Taken from Gentoo Linux's OpenRC settingsd -->"
-"<node name=\"/org/freedesktop/hostname1\">"
-"    <interface name=\"org.freedesktop.hostname1\">"
-"        <method name=\"SetHostname\">"
-"            <arg direction=\"in\" type=\"s\" name=\"name\"/>"
-"            <arg direction=\"in\" type=\"b\" name=\"user_interaction\"/>"
-"        </method>"
-"        <method name=\"SetStaticHostname\">"
-"            <arg direction=\"in\" type=\"s\" name=\"name\"/>"
-"            <arg direction=\"in\" type=\"b\" name=\"user_interaction\"/>"
-"        </method>"
-"        <method name=\"SetPrettyHostname\">"
-"            <arg direction=\"in\" type=\"s\" name=\"name\"/>"
-"            <arg direction=\"in\" type=\"b\" name=\"user_interaction\"/>"
-"        </method>"
-"        <method name=\"SetIconName\">"
-"            <arg direction=\"in\" type=\"s\" name=\"name\"/>"
-"            <arg direction=\"in\" type=\"b\" name=\"user_interaction\"/>"
-"        </method>"
-"        <property name=\"Hostname\" type=\"s\" access=\"read\"/>"
-"        <property name=\"StaticHostname\" type=\"s\" access=\"read\"/>"
-"        <property name=\"PrettyHostname\" type=\"s\" access=\"read\"/>"
-"        <property name=\"IconName\" type=\"s\" access=\"read\"/>"
-"    </interface>"
-"</node>";
+               /*TODO permissions w/ this */
+               g_mkdir_with_parents(our_conf_path, 0644);
+       
+               return FALSE;
+               //return (errors[0] == NULL);
+
+               } else
+                       return FALSE;
+}