[gnome-control-center] bluetooth: Move killswitch to the header
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] bluetooth: Move killswitch to the header
- Date: Mon, 17 Dec 2012 09:53:10 +0000 (UTC)
commit 63af1169b5cb64e484e782f5ce29663170d2734e
Author: Bastien Nocera <hadess hadess net>
Date: Mon Dec 17 10:51:07 2012 +0100
bluetooth: Move killswitch to the header
panels/bluetooth/bluetooth.ui | 85 +++++++++++++++------------------
panels/bluetooth/cc-bluetooth-panel.c | 18 +++++++
2 files changed, 56 insertions(+), 47 deletions(-)
---
diff --git a/panels/bluetooth/bluetooth.ui b/panels/bluetooth/bluetooth.ui
index cbdf9a0..431a63a 100644
--- a/panels/bluetooth/bluetooth.ui
+++ b/panels/bluetooth/bluetooth.ui
@@ -1,6 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkBox" id="box_power">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes" context="Power" comments="Translator: This string appears next to a toggle switch which controls enabling/disabling Bluetooth radio's on the device.">Bluetooth</property>
+ <property name="mnemonic_widget">switch_bluetooth</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="padding">6</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <object class="GtkSwitch" id="switch_bluetooth">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<child>
@@ -596,53 +634,6 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="box_power">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_bottom">12</property>
- <child>
- <object class="GtkLabel" id="label18">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="mnemonic-widget">switch_bluetooth</property>
- <property name="label" translatable="yes" context="Power" comments="Translator: This string appears next to a toggle switch which controls enabling/disabling Bluetooth radio's on the device.">Bluetooth</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">6</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <object class="GtkSwitch" id="switch_bluetooth">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_action_appearance">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
<object class="GtkBox" id="box_vis">
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/panels/bluetooth/cc-bluetooth-panel.c b/panels/bluetooth/cc-bluetooth-panel.c
index 1494199..accd9b8 100644
--- a/panels/bluetooth/cc-bluetooth-panel.c
+++ b/panels/bluetooth/cc-bluetooth-panel.c
@@ -55,9 +55,11 @@ struct CcBluetoothPanelPrivate {
BluetoothKillswitch *killswitch;
gboolean debug;
GHashTable *connecting_devices;
+ GtkWidget *kill_switch_header;
};
static void cc_bluetooth_panel_finalize (GObject *object);
+static void cc_bluetooth_panel_constructed (GObject *object);
static void
launch_command (const char *command)
@@ -82,6 +84,7 @@ cc_bluetooth_panel_class_init (CcBluetoothPanelClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
+ object_class->constructed = cc_bluetooth_panel_constructed;
object_class->finalize = cc_bluetooth_panel_finalize;
panel_class->get_help_uri = cc_bluetooth_panel_get_help_uri;
@@ -103,6 +106,7 @@ cc_bluetooth_panel_finalize (GObject *object)
g_clear_pointer (&self->priv->connecting_devices, g_hash_table_destroy);
g_clear_pointer (&self->priv->selected_bdaddr, g_free);
+ g_clear_object (&self->priv->kill_switch_header);
G_OBJECT_CLASS (cc_bluetooth_panel_parent_class)->finalize (object);
}
@@ -230,6 +234,20 @@ switch_connected_active_changed (GtkSwitch *button,
g_free (proxy);
}
+static void
+cc_bluetooth_panel_constructed (GObject *object)
+{
+ CcBluetoothPanel *self = CC_BLUETOOTH_PANEL (object);
+
+ G_OBJECT_CLASS (cc_bluetooth_panel_parent_class)->constructed (object);
+
+ /* add kill switch widgets */
+ self->priv->kill_switch_header = g_object_ref (WID ("box_power"));
+ cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (self)),
+ self->priv->kill_switch_header);
+ gtk_widget_show_all (self->priv->kill_switch_header);
+}
+
enum {
NOTEBOOK_PAGE_EMPTY = 0,
NOTEBOOK_PAGE_PROPS = 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]