diff options
author | Bastien Nocera <hadess@hadess.net> | 2016-01-10 15:52:49 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2016-01-10 15:57:58 +0100 |
commit | c24cd2427e9927a7f695aedd17576ed3ca412a17 (patch) | |
tree | 2d5fb34344054cfd3ee99bf046f35a0dcbad5e93 | |
parent | bd3b6f03ab3f96bde3665b74187a0c932592c17e (diff) | |
download | gnome-bluetooth-c24cd2427e9927a7f695aedd17576ed3ca412a17.tar.gz |
settings: Emit adapter-changed-signal
When the default adapter changes, or when it gets powered on.
This will allow the Bluetooth settings panel to monitor the status of
transitioning adapters, when Bluetooth rfkill is disabled, but the hciX
adapter is unpowered/rfkilled.
See https://bugzilla.gnome.org/show_bug.cgi?id=760168
-rw-r--r-- | lib/bluetooth-settings-widget.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c index 356eb411..ed067cd7 100644 --- a/lib/bluetooth-settings-widget.c +++ b/lib/bluetooth-settings-widget.c @@ -85,6 +85,7 @@ G_DEFINE_TYPE_WITH_PRIVATE(BluetoothSettingsWidget, bluetooth_settings_widget, G enum { PANEL_CHANGED, + ADAPTER_STATUS_CHANGED, LAST_SIGNAL }; @@ -1339,6 +1340,8 @@ default_adapter_changed (BluetoothClient *client, /* FIXME: This should turn off automatically when * the settings panel goes away */ g_object_set (G_OBJECT (client), "default-adapter-discoverable", default_adapter != NULL, NULL); + + g_signal_emit (G_OBJECT (self), signals[ADAPTER_STATUS_CHANGED], 0); } static gint @@ -1918,6 +1921,8 @@ bluetooth_settings_widget_init (BluetoothSettingsWidget *self) G_CALLBACK (device_removed_cb), self); g_signal_connect (G_OBJECT (priv->client), "notify::default-adapter", G_CALLBACK (default_adapter_changed), self); + g_signal_connect (G_OBJECT (priv->client), "notify::default-adapter-powered", + G_CALLBACK (default_adapter_changed), self); default_adapter_changed (priv->client, NULL, self); priv->row_sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); @@ -1993,6 +1998,22 @@ bluetooth_settings_widget_class_init (BluetoothSettingsWidgetClass *klass) NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); + + /** + * BluetoothSettingsWidget::adapter-status-changed: + * @chooser: a #BluetoothSettingsWidget widget which received the signal + * + * The #BluetoothChooser::adapter-status-changed signal is launched when the status + * of the adapter changes (powered, available, etc.). + **/ + signals[ADAPTER_STATUS_CHANGED] = + g_signal_new ("adapter-status-changed", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0, G_TYPE_NONE); } /** |