[gnome-control-center] network: Add hotspot_switch struct member
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Add hotspot_switch struct member
- Date: Tue, 2 Sep 2014 17:18:54 +0000 (UTC)
commit b108dedde6c25014f15ac5b76006b3eb3dd5fb06
Author: Bastien Nocera <hadess hadess net>
Date: Tue Sep 2 17:51:02 2014 +0200
network: Add hotspot_switch struct member
So we can access it directly when needed.
panels/network/net-device-wifi.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 14e814b..c11a634 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -61,6 +61,7 @@ struct _NetDeviceWifiPrivate
GtkBuilder *builder;
GtkWidget *details_dialog;
GtkWidget *hotspot_dialog;
+ GtkSwitch *hotspot_switch;
gboolean updating_device;
gchar *selected_ssid_title;
gchar *selected_connection_id;
@@ -935,17 +936,14 @@ static void
show_hotspot_ui (NetDeviceWifi *device_wifi)
{
GtkWidget *widget;
- GtkSwitch *sw;
/* show hotspot tab */
widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "notebook_view"));
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 1);
/* force switch to on as this succeeded */
- sw = GTK_SWITCH (gtk_builder_get_object (device_wifi->priv->builder,
- "switch_hotspot_off"));
device_wifi->priv->updating_device = TRUE;
- gtk_switch_set_active (sw, TRUE);
+ gtk_switch_set_active (device_wifi->priv->hotspot_switch, TRUE);
device_wifi->priv->updating_device = FALSE;
}
@@ -1206,12 +1204,8 @@ stop_hotspot_response_cb (GtkWidget *dialog, gint response, NetDeviceWifi *devic
if (response == GTK_RESPONSE_OK) {
stop_shared_connection (device_wifi);
} else {
- GtkWidget *sw;
-
- sw = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
- "switch_hotspot_off"));
device_wifi->priv->updating_device = TRUE;
- gtk_switch_set_active (GTK_SWITCH (sw), TRUE);
+ gtk_switch_set_active (device_wifi->priv->hotspot_switch, TRUE);
device_wifi->priv->updating_device = FALSE;
}
gtk_widget_destroy (dialog);
@@ -2010,6 +2004,7 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder,
"switch_hotspot_off"));
+ device_wifi->priv->hotspot_switch = GTK_SWITCH (widget);
g_signal_connect (widget, "notify::active",
G_CALLBACK (switch_hotspot_changed_cb), device_wifi);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]