[gnome-control-center] network: Move the 'Airplane Mode' switch up into the shell header
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Move the 'Airplane Mode' switch up into the shell header
- Date: Mon, 9 Jan 2012 15:26:10 +0000 (UTC)
commit 1b74ddb8c52c0d3002aaf1c1bb1af292ec2f3d94
Author: Richard Hughes <richard hughsie com>
Date: Mon Jan 9 15:22:04 2012 +0000
network: Move the 'Airplane Mode' switch up into the shell header
This closer matches the mockups done by Lapo.
panels/network/cc-network-panel.c | 43 +++++++++++++++++++++++++++++-------
panels/network/network.ui | 40 ----------------------------------
2 files changed, 34 insertions(+), 49 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index cd6dc21..25a8521 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -76,6 +76,7 @@ struct _CcNetworkPanelPrivate
NMRemoteSettings *remote_settings;
gboolean updating_device;
guint refresh_idle;
+ GtkWidget *kill_switch_header;
/* wireless dialog stuff */
CmdlineOperation arg_operation;
@@ -205,6 +206,9 @@ cc_network_panel_dispose (GObject *object)
g_object_unref (priv->remote_settings);
priv->remote_settings = NULL;
}
+ if (priv->kill_switch_header != NULL) {
+ g_clear_object (&priv->kill_switch_header);
+ }
G_OBJECT_CLASS (cc_network_panel_parent_class)->dispose (object);
}
@@ -3178,11 +3182,37 @@ stop_hotspot (GtkButton *button, CcNetworkPanel *panel)
gtk_window_present (GTK_WINDOW (dialog));
}
+static gboolean
+network_add_shell_header_widgets_cb (gpointer user_data)
+{
+ CcNetworkPanel *panel = CC_NETWORK_PANEL (user_data);
+ gboolean ret;
+ GtkWidget *box;
+ GtkWidget *widget;
+
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
+ /* TRANSLATORS: this is to disable the radio hardware in the
+ * network panel */
+ widget = gtk_label_new (_("Airplane Mode"));
+ gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0);
+ widget = gtk_switch_new ();
+ gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0);
+ cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (panel)), box);
+ gtk_widget_show_all (box);
+
+ ret = nm_client_wireless_get_enabled (panel->priv->client);
+ gtk_switch_set_active (GTK_SWITCH (widget), !ret);
+ g_signal_connect (GTK_SWITCH (widget), "notify::active",
+ G_CALLBACK (cc_network_panel_notify_enable_active_cb),
+ panel);
+
+ return FALSE;
+}
+
static void
cc_network_panel_init (CcNetworkPanel *panel)
{
DBusGConnection *bus = NULL;
- gboolean ret;
GError *error = NULL;
gint value;
GSettings *settings_tmp;
@@ -3445,14 +3475,6 @@ cc_network_panel_init (CcNetworkPanel *panel)
"button_unlock"));
gtk_widget_set_sensitive (widget, FALSE);
- widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
- "switch_flight_mode"));
- ret = nm_client_wireless_get_enabled (panel->priv->client);
- gtk_switch_set_active (GTK_SWITCH (widget), !ret);
- g_signal_connect (GTK_SWITCH (widget), "notify::active",
- G_CALLBACK (cc_network_panel_notify_enable_active_cb),
- panel);
-
/* add remote settings such as VPN settings as virtual devices */
bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
if (bus == NULL) {
@@ -3482,6 +3504,9 @@ cc_network_panel_init (CcNetworkPanel *panel)
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"vbox1"));
gtk_widget_reparent (widget, (GtkWidget *) panel);
+
+ /* add kill switch widgets when dialog activated */
+ g_idle_add (network_add_shell_header_widgets_cb, panel);
}
void
diff --git a/panels/network/network.ui b/panels/network/network.ui
index f9e045a..6b1fbd3 100644
--- a/panels/network/network.ui
+++ b/panels/network/network.ui
@@ -2330,46 +2330,6 @@
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkHBox" id="hbox_flight_mode">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">3</property>
- <child>
- <object class="GtkLabel" id="label_flight_mode">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Air_plane Mode</property>
- <property name="use_underline">True</property>
- <property name="mnemonic-widget">switch_flight_mode</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkSwitch" id="switch_flight_mode">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
<packing>
<property name="expand">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]