[gnome-bluetooth] properties: Disable connect button for devices
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] properties: Disable connect button for devices
- Date: Tue, 22 Feb 2011 03:32:13 +0000 (UTC)
commit 88e04a4ee2a3eb507d30a9c099a4930c23615b97
Author: Bastien Nocera <hadess hadess net>
Date: Tue Feb 22 03:31:14 2011 +0000
properties: Disable connect button for devices
If the devices don't have any services, we can't connect to them
but we can still show the connection status.
properties/bluetooth.ui | 2 +-
properties/cc-bluetooth-panel.c | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/properties/bluetooth.ui b/properties/bluetooth.ui
index 28d2925..40312ed 100644
--- a/properties/bluetooth.ui
+++ b/properties/bluetooth.ui
@@ -110,7 +110,7 @@
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
- <object class="GtkLabel" id="label1">
+ <object class="GtkLabel" id="connection_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
diff --git a/properties/cc-bluetooth-panel.c b/properties/cc-bluetooth-panel.c
index 4293999..3cd44b5 100644
--- a/properties/cc-bluetooth-panel.c
+++ b/properties/cc-bluetooth-panel.c
@@ -206,17 +206,28 @@ cc_bluetooth_panel_update_properties (CcBluetoothPanel *self)
BluetoothType type;
gboolean connected;
GValue value = { 0 };
+ GHashTable *services;
gtk_widget_set_sensitive (WID ("properties_vbox"), TRUE);
connected = bluetooth_chooser_get_selected_device_is_connected (BLUETOOTH_CHOOSER (self->priv->chooser));
gtk_switch_set_active (button, connected);
+ /* Paired */
bluetooth_chooser_get_selected_device_info (BLUETOOTH_CHOOSER (self->priv->chooser),
"paired", &value);
gtk_label_set_text (GTK_LABEL (WID ("paired_label")),
g_value_get_boolean (&value) ? _("Yes") : _("No"));
+ g_value_unset (&value);
+ /* Connection */
+ bluetooth_chooser_get_selected_device_info (BLUETOOTH_CHOOSER (self->priv->chooser),
+ "services", &value);
+ services = g_value_get_boxed (&value);
+ gtk_widget_set_sensitive (GTK_WIDGET (button), (services != NULL));
+ g_value_unset (&value);
+
+ /* Type */
type = bluetooth_chooser_get_selected_device_type (BLUETOOTH_CHOOSER (self->priv->chooser));
gtk_label_set_text (GTK_LABEL (WID ("type_label")), bluetooth_type_to_string (type));
switch (type) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]