[at-spi2-core: 15/47] SpiRegistry: store the unique bus name during construction
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-core: 15/47] SpiRegistry: store the unique bus name during construction
- Date: Wed, 13 Jul 2022 03:08:27 +0000 (UTC)
commit e10adc0c65edc83a2479c3cf72cc8e75e3500d4c
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Jul 8 17:33:58 2022 -0500
SpiRegistry: store the unique bus name during construction
Construction happens after our bus connection is active, so we can get
the unique name there.
registryd/registry.c | 20 ++++++++++++++++++++
registryd/registry.h | 1 +
2 files changed, 21 insertions(+)
---
diff --git a/registryd/registry.c b/registryd/registry.c
index d4a83ae9..8379d5fe 100644
--- a/registryd/registry.c
+++ b/registryd/registry.c
@@ -70,10 +70,25 @@ spi_reference_free (SpiReference *ref)
G_DEFINE_TYPE(SpiRegistry, spi_registry, G_TYPE_OBJECT)
+static void
+spi_registry_finalize (GObject *object)
+{
+ SpiRegistry *reg = SPI_REGISTRY (object);
+
+ g_clear_pointer (®->bus_unique_name, g_free);
+
+ G_OBJECT_CLASS (spi_registry_parent_class)->finalize (object);
+}
+
static void
spi_registry_class_init (SpiRegistryClass *klass)
{
+ GObjectClass *gobject_class;
+
spi_registry_parent_class = g_type_class_ref (G_TYPE_OBJECT);
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = spi_registry_finalize;
}
static void
@@ -1386,8 +1401,13 @@ SpiRegistry *
spi_registry_new (DBusConnection *bus)
{
SpiRegistry *reg = g_object_new (SPI_REGISTRY_TYPE, NULL);
+ const char *bus_unique_name;
+
+ bus_unique_name = dbus_bus_get_unique_name (bus);
+ g_assert (bus_unique_name != NULL);
reg->bus = bus;
+ reg->bus_unique_name = g_strdup (bus_unique_name);
dbus_bus_add_match (bus, app_sig_match_name_owner, NULL);
dbus_connection_add_filter (bus, signal_filter, reg, NULL);
diff --git a/registryd/registry.h b/registryd/registry.h
index 19b1a8f0..394a9986 100644
--- a/registryd/registry.h
+++ b/registryd/registry.h
@@ -49,6 +49,7 @@ struct _SpiRegistry {
dbus_int32_t id;
DBusConnection *bus;
+ char *bus_unique_name;
GList *events;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]