collector: Add tracking of providers addition/removals

It was by mistake missing.
parent 7a0f5c26
Pipeline #538 passed with stage
in 2 minutes and 11 seconds
......@@ -99,6 +99,10 @@ cloud_providers_collector_finalize (GObject *object)
{
g_signal_handlers_disconnect_by_data (G_OBJECT (l->data), self);
}
for (l = self->providers; l != NULL; l = l->next)
{
g_signal_handlers_disconnect_by_data (G_OBJECT (l->data), self);
}
g_list_free_full (self->providers, g_object_unref);
g_list_free_full (self->monitors, g_object_unref);
......@@ -144,6 +148,12 @@ cloud_providers_collector_get_providers (CloudProvidersCollector *self)
return self->providers;
}
static void
on_provider_removed (CloudProvidersCollector *self)
{
update_cloud_providers (self);
}
static void
load_cloud_provider (CloudProvidersCollector *self,
GFile *file)
......@@ -186,6 +196,8 @@ load_cloud_provider (CloudProvidersCollector *self,
provider = cloud_providers_provider_new (bus_name, object_path);
self->providers = g_list_append (self->providers, provider);
g_signal_connect_swapped (provider, "removed",
G_CALLBACK (on_provider_removed), self);
g_debug("Client loading provider: %s %s\n", bus_name, object_path);
......@@ -273,6 +285,10 @@ update_cloud_providers (CloudProvidersCollector *self)
{
g_signal_handlers_disconnect_by_data (G_OBJECT (l->data), self);
}
for (l = self->providers; l != NULL; l = l->next)
{
g_signal_handlers_disconnect_by_data (G_OBJECT (l->data), self);
}
g_list_free_full (self->providers, g_object_unref);
g_list_free_full (self->monitors, g_object_unref);
self->providers = NULL;
......
......@@ -98,6 +98,11 @@ cloud_providers_provider_finalize (GObject *object)
g_signal_handlers_disconnect_by_data (self->proxy, self);
}
g_clear_object (&self->proxy);
if (self->manager)
{
g_signal_handlers_disconnect_by_data (self->manager, self);
}
g_clear_object (&self->manager);
G_OBJECT_CLASS (cloud_providers_provider_parent_class)->finalize (object);
}
......@@ -191,7 +196,7 @@ cloud_providers_provider_class_init (CloudProvidersProviderClass *klass)
*
* This signal is emmited by a provider when the provider is removed in DBUS.
*/
signals [ACCOUNTS_CHANGED] =
signals [REMOVED] =
g_signal_new ("removed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
......@@ -263,9 +268,9 @@ update_cloud_providers_accounts (CloudProvidersProvider *self)
}
static void
on_cloud_providers_object_manager_object_added (GObject *object,
GParamSpec *pspec,
gpointer user_data)
on_cloud_providers_object_manager_object_added (GDBusObjectManager *manager,
GDBusObject *object,
gpointer user_data)
{
CloudProvidersProvider *self;
......@@ -274,9 +279,9 @@ on_cloud_providers_object_manager_object_added (GObject *object,
}
static void
on_cloud_providers_object_manager_object_removed (GObject *object,
GParamSpec *pspec,
gpointer user_data)
on_cloud_providers_object_manager_object_removed (GDBusObjectManager *manager,
GDBusObject *object,
gpointer user_data)
{
CloudProvidersProvider *self;
......
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