[gnome-bluetooth] properties: Fully functional "visible" button
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] properties: Fully functional "visible" button
- Date: Tue, 22 Feb 2011 02:12:04 +0000 (UTC)
commit 4bb3e204200d39a1659af92eabb6779ef7a576b5
Author: Bastien Nocera <hadess hadess net>
Date: Tue Feb 22 01:52:57 2011 +0000
properties: Fully functional "visible" button
properties/cc-bluetooth-panel.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/properties/cc-bluetooth-panel.c b/properties/cc-bluetooth-panel.c
index 291b8d1..2d3df4b 100644
--- a/properties/cc-bluetooth-panel.c
+++ b/properties/cc-bluetooth-panel.c
@@ -150,13 +150,27 @@ cc_bluetooth_panel_update_properties (CcBluetoothPanel *self)
}
static void
+switch_discoverable_active_changed (GtkSwitch *button,
+ GParamSpec *spec,
+ CcBluetoothPanel *self)
+{
+ bluetooth_client_set_discoverable (self->priv->client,
+ gtk_switch_get_active (button),
+ 0);
+}
+
+static void
cc_bluetooth_panel_update_visibility (CcBluetoothPanel *self)
{
gboolean discoverable;
+ GtkSwitch *button;
char *name;
+ button = GTK_SWITCH (WID ("switch_discoverable"));
discoverable = bluetooth_client_get_discoverable (self->priv->client);
- gtk_switch_set_active (GTK_SWITCH (WID ("switch_discoverable")), discoverable);
+ g_signal_handlers_block_by_func (button, switch_discoverable_active_changed, self);
+ gtk_switch_set_active (button, discoverable);
+ g_signal_handlers_unblock_by_func (button, switch_discoverable_active_changed, self);
name = bluetooth_client_get_name (self->priv->client);
if (name == NULL) {
@@ -177,6 +191,14 @@ cc_bluetooth_panel_update_visibility (CcBluetoothPanel *self)
}
static void
+discoverable_changed (BluetoothClient *client,
+ GParamSpec *spec,
+ CcBluetoothPanel *self)
+{
+ cc_bluetooth_panel_update_visibility (self);
+}
+
+static void
device_selected_changed (BluetoothChooser *chooser,
GParamSpec *spec,
CcBluetoothPanel *self)
@@ -213,6 +235,10 @@ cc_bluetooth_panel_init (CcBluetoothPanel *self)
/* The discoverable button */
cc_bluetooth_panel_update_visibility (self);
+ g_signal_connect (G_OBJECT (self->priv->client), "notify::default-adapter-discoverable",
+ G_CALLBACK (discoverable_changed), self);
+ g_signal_connect (G_OBJECT (WID ("switch_discoverable")), "notify::active",
+ G_CALLBACK (switch_discoverable_active_changed), self);
/* The known devices */
widget = WID ("devices_table");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]