summaryrefslogtreecommitdiff
path: root/registryd
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2022-11-11 10:16:53 -0600
committerFederico Mena Quintero <federico@gnome.org>2022-11-11 10:16:53 -0600
commit90ed7a1bca5b49ea549b1ce2cd21d96a1dc9305b (patch)
tree2420d0a865ad944898cdff8c57f13b6ed70b433c /registryd
parentdf5cf7c51d27d5cc33e4009d027a25120c60f212 (diff)
downloadat-spi2-core-90ed7a1bca5b49ea549b1ce2cd21d96a1dc9305b.tar.gz
Decouple the construction of SpiDEController and SpiRegistry
spi_registry_dec_new() would take an SpiRegistry argument, and directly set "reg->dec = self" in it. Instead, we do this now: * spi_registry_dec_new() no longer takes a registry argument; it was made independent from it in the previous commit. * In registry-main.c, we first create the DEC, and then we pass it as an argument to spi_registry_new(), which now takes an SpiDEController argument. The registry object only uses the DEC in spi_remove_device_listeners() when an application is removed.
Diffstat (limited to 'registryd')
-rw-r--r--registryd/deviceeventcontroller.c4
-rw-r--r--registryd/deviceeventcontroller.h2
-rw-r--r--registryd/registry-main.c4
-rw-r--r--registryd/registry.c3
-rw-r--r--registryd/registry.h2
5 files changed, 7 insertions, 8 deletions
diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c
index 5ce90679..0a75cb11 100644
--- a/registryd/deviceeventcontroller.c
+++ b/registryd/deviceeventcontroller.c
@@ -2033,12 +2033,10 @@ static DBusObjectPathVTable dec_vtable =
};
SpiDEController *
-spi_registry_dec_new (SpiRegistry *reg, DBusConnection *bus)
+spi_registry_dec_new (DBusConnection *bus)
{
SpiDEController *dec = g_object_new (SPI_DEVICE_EVENT_CONTROLLER_TYPE, NULL);
- dec->registry = g_object_ref (reg);
- reg->dec = g_object_ref (dec);
dec->bus = bus;
dbus_connection_register_object_path (bus, SPI_DBUS_PATH_DEC, &dec_vtable, dec);
diff --git a/registryd/deviceeventcontroller.h b/registryd/deviceeventcontroller.h
index 691a3afa..09f7cc2b 100644
--- a/registryd/deviceeventcontroller.h
+++ b/registryd/deviceeventcontroller.h
@@ -146,7 +146,7 @@ void spi_device_event_controller_stop_poll_mouse (void);
void spi_remove_device_listeners (SpiDEController *controller, const char *bus_name);
-SpiDEController *spi_registry_dec_new (SpiRegistry *reg, DBusConnection *bus);
+SpiDEController *spi_registry_dec_new (DBusConnection *bus);
gboolean
spi_controller_notify_mouselisteners (SpiDEController *controller,
diff --git a/registryd/registry-main.c b/registryd/registry-main.c
index be01d2c9..f46886d2 100644
--- a/registryd/registry-main.c
+++ b/registryd/registry-main.c
@@ -248,8 +248,8 @@ main (int argc, char **argv)
g_print ("SpiRegistry daemon is running with well-known name - %s\n", dbus_name);
}
- registry = spi_registry_new (bus);
- dec = spi_registry_dec_new (registry, bus);
+ dec = spi_registry_dec_new (bus);
+ registry = spi_registry_new (bus, dec);
if (use_gnome_session)
{
diff --git a/registryd/registry.c b/registryd/registry.c
index e4d7b5da..8e0cd35e 100644
--- a/registryd/registry.c
+++ b/registryd/registry.c
@@ -1414,7 +1414,7 @@ static gchar *app_sig_match_name_owner =
"type='signal', interface='org.freedesktop.DBus', member='NameOwnerChanged'";
SpiRegistry *
-spi_registry_new (DBusConnection *bus)
+spi_registry_new (DBusConnection *bus, SpiDEController *dec)
{
SpiRegistry *registry = g_object_new (SPI_REGISTRY_TYPE, NULL);
const char *bus_unique_name;
@@ -1423,6 +1423,7 @@ spi_registry_new (DBusConnection *bus)
g_assert (bus_unique_name != NULL);
registry->bus = bus;
+ registry->dec = g_object_ref (dec);
registry->bus_unique_name = g_strdup (bus_unique_name);
dbus_bus_add_match (bus, app_sig_match_name_owner, NULL);
diff --git a/registryd/registry.h b/registryd/registry.h
index 394a9986..a66233e5 100644
--- a/registryd/registry.h
+++ b/registryd/registry.h
@@ -58,7 +58,7 @@ struct _SpiRegistryClass {
};
GType spi_registry_get_type (void);
-SpiRegistry *spi_registry_new (DBusConnection *bus);
+SpiRegistry *spi_registry_new (DBusConnection *bus, SpiDEController *dec);
G_END_DECLS