summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2016-01-10 14:46:31 +0100
committerBastien Nocera <hadess@hadess.net>2016-01-10 15:57:58 +0100
commitbd3b6f03ab3f96bde3665b74187a0c932592c17e (patch)
tree104f178e5c0ec5e66bdc77e34a24c9c69898d8a9
parentbc9c59d09df5921a36b98e568007dbb3a14cd9fb (diff)
downloadgnome-bluetooth-bd3b6f03ab3f96bde3665b74187a0c932592c17e.tar.gz
settings: Export the state of the Bluetooth adapter
So that we can avoid showing filler text when the Bluetooth adapter is powered off/rfkilled but the overall Bluetooth rfkill is off. See https://bugzilla.gnome.org/show_bug.cgi?id=760168
-rw-r--r--lib/bluetooth-settings-widget.c22
-rw-r--r--lib/bluetooth-settings-widget.h2
-rw-r--r--lib/gnome-bluetooth.symbols1
3 files changed, 25 insertions, 0 deletions
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index 3db2efb4..356eb411 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -2007,3 +2007,25 @@ bluetooth_settings_widget_new (void)
{
return g_object_new (BLUETOOTH_TYPE_SETTINGS_WIDGET, NULL);
}
+
+/**
+ * bluetooth_settings_widget_get_default_adapter_powered:
+ * @widget: a #BluetoothSettingsWidget widget.
+ *
+ * Return value: Whether the default Bluetooth adapter is powered.
+ **/
+gboolean
+bluetooth_settings_widget_get_default_adapter_powered (BluetoothSettingsWidget *widget)
+{
+ BluetoothSettingsWidgetPrivate *priv;
+ gboolean ret;
+
+ g_return_val_if_fail (BLUETOOTH_IS_SETTINGS_WIDGET (widget), FALSE);
+
+ priv = BLUETOOTH_SETTINGS_WIDGET_GET_PRIVATE (widget);
+ g_object_get (G_OBJECT (priv->client),
+ "default-adapter-powered", &ret,
+ NULL);
+
+ return ret;
+}
diff --git a/lib/bluetooth-settings-widget.h b/lib/bluetooth-settings-widget.h
index 6e943bde..8b722956 100644
--- a/lib/bluetooth-settings-widget.h
+++ b/lib/bluetooth-settings-widget.h
@@ -58,6 +58,8 @@ GType bluetooth_settings_widget_get_type (void);
GtkWidget *bluetooth_settings_widget_new (void);
+gboolean bluetooth_settings_widget_get_default_adapter_powered (BluetoothSettingsWidget *widget);
+
G_END_DECLS
#endif /* __BLUETOOTH_SETTINGS_WIDGET_H */
diff --git a/lib/gnome-bluetooth.symbols b/lib/gnome-bluetooth.symbols
index 70300705..68409795 100644
--- a/lib/gnome-bluetooth.symbols
+++ b/lib/gnome-bluetooth.symbols
@@ -59,6 +59,7 @@ bluetooth_agent_set_authorize_service_func
bluetooth_agent_setup
bluetooth_settings_widget_get_type
bluetooth_settings_widget_new
+bluetooth_settings_widget_get_default_adapter_powered
bluetooth_pairing_dialog_new
bluetooth_pairing_dialog_get_type
bluetooth_pairing_dialog_set_mode