[gnome-control-center] network: don't pretend we can overrule hw rfkill



commit 4ad99703ac150e83bd067d72ae78f25c5b713512
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Apr 21 18:14:54 2014 -0400

    network: don't pretend we can overrule hw rfkill
    
    If the airplane mode is forced by the hw switch, make the switch
    in the network panel insensitive, so we don't give the wrong
    impression.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728511

 panels/network/cc-network-panel.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index caaf1a3..0031a0a 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -292,6 +292,7 @@ sync_airplane_mode_switch (CcNetworkPanel *panel)
 {
         GVariant *result;
         gboolean enabled;
+        gboolean hw_enabled;
 
         result = g_dbus_proxy_get_cached_property (panel->priv->rfkill_proxy, "HasAirplaneMode");
         enabled = g_variant_get_boolean (result);
@@ -302,6 +303,12 @@ sync_airplane_mode_switch (CcNetworkPanel *panel)
 
         result = g_dbus_proxy_get_cached_property (panel->priv->rfkill_proxy, "AirplaneMode");
         enabled = g_variant_get_boolean (result);
+
+        result = g_dbus_proxy_get_cached_property (panel->priv->rfkill_proxy, "HardwareAirplaneMode");
+        hw_enabled = !!g_variant_get_boolean (result);
+
+       enabled |= hw_enabled;
+
        if (enabled != gtk_switch_get_active (panel->priv->rfkill_switch)) {
                g_signal_handlers_block_by_func (panel->priv->rfkill_switch,
                                                 cc_network_panel_notify_enable_active_cb,
@@ -311,6 +318,8 @@ sync_airplane_mode_switch (CcNetworkPanel *panel)
                                                 cc_network_panel_notify_enable_active_cb,
                                                 panel);
        }
+
+       gtk_widget_set_sensitive (GTK_WIDGET (panel->priv->rfkill_switch), !hw_enabled);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]