mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-09 04:13:33 +02:00
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...
This commit is contained in:
committed by
Daniel Drake
parent
822a2e5438
commit
6cbb079619
@ -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)
|
|||||||
{
|
{
|
||||||
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)
|
|||||||
{
|
{
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user