Commit 6cbb0796 authored by Bastien Nocera's avatar Bastien Nocera Committed by Daniel Drake
Browse files

Make the daemon a system daemon

With this patch, and the D-Bus activation patches posted earlier the
fprintd daemon is started automatically when needed.

We should have a way to exit it nicely when there are no users
anymore as well...
parent 822a2e54
...@@ -223,7 +223,7 @@ int main(int argc, char **argv) ...@@ -223,7 +223,7 @@ int main(int argc, char **argv)
g_print("Launching FprintObject\n"); g_print("Launching FprintObject\n");
/* Obtain a connection to the session bus */ /* Obtain a connection to the session bus */
fprintd_dbus_conn = dbus_g_bus_get(DBUS_BUS_SESSION, &error); fprintd_dbus_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
if (fprintd_dbus_conn == NULL) if (fprintd_dbus_conn == NULL)
g_error("Failed to open connection to bus: %s", error->message); g_error("Failed to open connection to bus: %s", error->message);
......
...@@ -74,15 +74,13 @@ static void create_manager(void) ...@@ -74,15 +74,13 @@ static void create_manager(void)
{ {
GError *error = NULL; GError *error = NULL;
connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
if (connection == NULL) if (connection == NULL)
g_error("Failed to connect to session bus: %s", error->message); g_error("Failed to connect to session bus: %s", error->message);
manager = dbus_g_proxy_new_for_name_owner(connection, manager = dbus_g_proxy_new_for_name(connection,
"net.reactivated.Fprint", "/net/reactivated/Fprint/Manager", "net.reactivated.Fprint", "/net/reactivated/Fprint/Manager",
"net.reactivated.Fprint.Manager", &error); "net.reactivated.Fprint.Manager");
if (manager == NULL)
g_error("Failed to create proxy: %s", error->message);
} }
static DBusGProxy *open_device(void) static DBusGProxy *open_device(void)
......
...@@ -100,15 +100,13 @@ static void create_manager(void) ...@@ -100,15 +100,13 @@ static void create_manager(void)
{ {
GError *error = NULL; GError *error = NULL;
connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
if (connection == NULL) if (connection == NULL)
g_error("Failed to connect to session bus: %s", error->message); g_error("Failed to connect to session bus: %s", error->message);
manager = dbus_g_proxy_new_for_name_owner(connection, manager = dbus_g_proxy_new_for_name(connection,
"net.reactivated.Fprint", "/net/reactivated/Fprint/Manager", "net.reactivated.Fprint", "/net/reactivated/Fprint/Manager",
"net.reactivated.Fprint.Manager", &error); "net.reactivated.Fprint.Manager");
if (manager == NULL)
g_error("Failed to create proxy: %s", error->message);
} }
static DBusGProxy *open_device(void) static DBusGProxy *open_device(void)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment