[gnome-bluetooth] properties: Add message in list when disabled
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] properties: Add message in list when disabled
- Date: Fri, 4 Mar 2011 22:36:38 +0000 (UTC)
commit bd48c6cad75c21408112aaf76093d2cddf3f1302
Author: Bastien Nocera <hadess hadess net>
Date: Fri Mar 4 22:24:30 2011 +0000
properties: Add message in list when disabled
Matching the mockups. We still don't show a message when there are
no devices setup, and the treeview has the bad idea of resizing
when showing.
properties/bluetooth.ui | 43 ++++++++++++++++++++++++++++++++++++++-
properties/cc-bluetooth-panel.c | 27 ++++++++++++++++++++++-
2 files changed, 67 insertions(+), 3 deletions(-)
---
diff --git a/properties/bluetooth.ui b/properties/bluetooth.ui
index 7ea2b69..87e0573 100644
--- a/properties/bluetooth.ui
+++ b/properties/bluetooth.ui
@@ -435,7 +435,48 @@
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="message_scrolledwindow">
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="no_show_all">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <property name="min_content_width">200</property>
+ <property name="min_content_height">250</property>
+ <child>
+ <object class="GtkViewport" id="viewport2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="message_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xpad">12</property>
+ <property name="ypad">12</property>
+ <property name="label">Bluetooth is disabled by hardware switch</property>
+ <property name="wrap">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
</child>
</object>
<packing>
diff --git a/properties/cc-bluetooth-panel.c b/properties/cc-bluetooth-panel.c
index c1dd629..8e1d6be 100644
--- a/properties/cc-bluetooth-panel.c
+++ b/properties/cc-bluetooth-panel.c
@@ -289,6 +289,22 @@ power_callback (GObject *object,
}
static void
+cc_bluetooth_panel_update_treeview_message (CcBluetoothPanel *self,
+ const char *message)
+{
+ if (message != NULL) {
+ gtk_widget_hide (self->priv->chooser);
+ gtk_widget_show (WID ("message_scrolledwindow"));
+
+ gtk_label_set_text (GTK_LABEL (WID ("message_label")),
+ message);
+ } else {
+ gtk_widget_hide (WID ("message_scrolledwindow"));
+ gtk_widget_show (self->priv->chooser);
+ }
+}
+
+static void
cc_bluetooth_panel_update_power (CcBluetoothPanel *self)
{
KillswitchState state;
@@ -312,16 +328,20 @@ cc_bluetooth_panel_update_power (CcBluetoothPanel *self)
state != KILLSWITCH_STATE_HARD_BLOCKED) {
g_debug ("Default adapter is unpowered, but should be available");
sensitive = TRUE;
+ cc_bluetooth_panel_update_treeview_message (self, _("Bluetooth is disabled"));
} else if (bdaddr == NULL &&
state == KILLSWITCH_STATE_HARD_BLOCKED) {
g_debug ("Bluetooth is Hard blocked");
sensitive = FALSE;
+ cc_bluetooth_panel_update_treeview_message (self, _("Bluetooth is disabled by hardware switch"));
} else if (bdaddr == NULL) {
sensitive = FALSE;
g_debug ("No Bluetooth available");
+ cc_bluetooth_panel_update_treeview_message (self, _("No Bluetooth adapters found"));
} else {
sensitive = TRUE;
g_debug ("Bluetooth is available and powered");
+ cc_bluetooth_panel_update_treeview_message (self, NULL);
}
g_free (bdaddr);
@@ -512,11 +532,13 @@ cc_bluetooth_panel_init (CcBluetoothPanel *self)
/* The known devices */
widget = WID ("devices_table");
+ context = gtk_widget_get_style_context (WID ("message_scrolledwindow"));
+ gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
+
/* Note that this will only ever show the devices on the default
* adapter, this is on purpose */
self->priv->chooser = bluetooth_chooser_new (NULL);
- gtk_table_attach (GTK_TABLE (widget), self->priv->chooser, 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ gtk_box_pack_start (GTK_BOX (WID ("box1")), self->priv->chooser, TRUE, TRUE, 0);
g_object_set (self->priv->chooser,
"show-searching", FALSE,
"show-device-type", FALSE,
@@ -524,6 +546,7 @@ cc_bluetooth_panel_init (CcBluetoothPanel *self)
"show-pairing", FALSE,
"show-connected", FALSE,
"device-category-filter", BLUETOOTH_CATEGORY_PAIRED_OR_TRUSTED,
+ "no-show-all", TRUE,
NULL);
column = bluetooth_chooser_get_type_column (BLUETOOTH_CHOOSER (self->priv->chooser));
gtk_tree_view_column_set_visible (column, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]