diff options
author | Bastien Nocera <hadess@hadess.net> | 2012-11-09 10:20:29 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2012-11-09 10:49:52 +0100 |
commit | 627238003890e18069b90e8e2935f9548bf96f98 (patch) | |
tree | 2c20810e95f789c851538ade4dce9d9c99beadc8 | |
parent | c8837d2650c8558492e8f3aeb2362c7a7118c517 (diff) | |
download | gnome-control-center-627238003890e18069b90e8e2935f9548bf96f98.tar.gz |
network: Make sure flight mode is always visible
Because it's not just about disabling the network, it needs
to disable a host of other wireless devices, and those need to
be blocked even if you end up plugging them into your computer.
-rw-r--r-- | panels/network/cc-network-panel.c | 54 |
1 files changed, 1 insertions, 53 deletions
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c index 2a36161e4..e65d7d28b 100644 --- a/panels/network/cc-network-panel.c +++ b/panels/network/cc-network-panel.c @@ -333,55 +333,6 @@ object_removed_cb (NetObject *object, CcNetworkPanel *panel) } while (gtk_tree_model_iter_next (model, &iter)); } -static void -panel_refresh_killswitch_visibility (CcNetworkPanel *panel) -{ - gboolean ret; - gboolean show_flight_toggle = FALSE; - GtkTreeIter iter; - GtkTreeModel *model; - NetObject *object_tmp; - NMDeviceModemCapabilities caps; - NMDevice *nm_device; - - /* find any wireless devices in model */ - model = GTK_TREE_MODEL (gtk_builder_get_object (panel->priv->builder, - "liststore_devices")); - ret = gtk_tree_model_get_iter_first (model, &iter); - if (!ret) - return; - do { - gtk_tree_model_get (model, &iter, - PANEL_DEVICES_COLUMN_OBJECT, &object_tmp, - -1); - if (NET_IS_DEVICE (object_tmp)) { - nm_device = net_device_get_nm_device (NET_DEVICE (object_tmp)); - switch (nm_device_get_device_type (nm_device)) { - case NM_DEVICE_TYPE_WIFI: - case NM_DEVICE_TYPE_WIMAX: - show_flight_toggle = TRUE; - break; - case NM_DEVICE_TYPE_MODEM: - { - caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (nm_device)); - if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) || - (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) - show_flight_toggle = TRUE; - } - break; - default: - break; - } - } - if (object_tmp != NULL) - g_object_unref (object_tmp); - } while (!show_flight_toggle && gtk_tree_model_iter_next (model, &iter)); - - /* only show toggle if there are wireless devices */ - gtk_widget_set_visible (panel->priv->kill_switch_header, - show_flight_toggle); -} - static gboolean handle_argv_for_device (CcNetworkPanel *panel, NMDevice *device, @@ -746,7 +697,6 @@ device_added_cb (NMClient *client, NMDevice *device, CcNetworkPanel *panel) { g_debug ("New device added"); panel_add_device (panel, device); - panel_refresh_killswitch_visibility (panel); } static void @@ -754,7 +704,6 @@ device_removed_cb (NMClient *client, NMDevice *device, CcNetworkPanel *panel) { g_debug ("Device removed"); panel_remove_device (panel, device); - panel_refresh_killswitch_visibility (panel); } static void @@ -1077,7 +1026,7 @@ network_add_shell_header_widgets_cb (gpointer user_data) widget = gtk_switch_new (); gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget); gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0); - gtk_widget_set_visible (widget, TRUE); + gtk_widget_show_all (box); cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (panel)), box); panel->priv->kill_switch_header = g_object_ref (box); @@ -1086,7 +1035,6 @@ network_add_shell_header_widgets_cb (gpointer user_data) g_signal_connect (GTK_SWITCH (widget), "notify::active", G_CALLBACK (cc_network_panel_notify_enable_active_cb), panel); - panel_refresh_killswitch_visibility (panel); return FALSE; } |