[gnome-bluetooth] lib: Make ObjectManager creation cancellable
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] lib: Make ObjectManager creation cancellable
- Date: Fri, 16 Feb 2018 11:14:24 +0000 (UTC)
commit 3f109f37a4b8e4dfa8956f0fced60a5f8fc1b62a
Author: Bastien Nocera <hadess hadess net>
Date: Fri Feb 16 11:53:13 2018 +0100
lib: Make ObjectManager creation cancellable
So that we can stop the creation as soon as the BluetoothClient
is disposed of, rather than waiting for the call to finish.
https://bugzilla.gnome.org/show_bug.cgi?id=793505
lib/bluetooth-client.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 2a8db62..109cfd4 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -59,6 +59,7 @@ typedef struct _BluetoothClientPrivate BluetoothClientPrivate;
struct _BluetoothClientPrivate {
GDBusObjectManager *manager;
+ GCancellable *cancellable;
GtkTreeStore *store;
GtkTreeRowReference *default_adapter;
};
@@ -819,6 +820,7 @@ static void bluetooth_client_init(BluetoothClient *client)
{
BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
+ priv->cancellable = g_cancellable_new ();
priv->store = gtk_tree_store_new(_BLUETOOTH_NUM_COLUMNS,
G_TYPE_OBJECT, /* BLUETOOTH_COLUMN_PROXY */
G_TYPE_OBJECT, /* BLUETOOTH_COLUMN_PROPERTIES */
@@ -844,7 +846,7 @@ static void bluetooth_client_init(BluetoothClient *client)
BLUEZ_MANAGER_PATH,
object_manager_get_proxy_type_func,
NULL, NULL,
- NULL,
+ priv->cancellable,
object_manager_new_callback, client);
}
@@ -1099,6 +1101,10 @@ static void bluetooth_client_finalize(GObject *object)
BluetoothClient *client = BLUETOOTH_CLIENT (object);
BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE (client);
+ if (priv->cancellable != NULL) {
+ g_cancellable_cancel (priv->cancellable);
+ g_clear_object (&priv->cancellable);
+ }
g_clear_object (&priv->manager);
g_object_unref (priv->store);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]