network: Use HasAirplaneMode to determine whether to show the switch

Not all systems have rfkill toggles we can set; if we don't have any,
we shouldn't show any switch at all.

https://bugzilla.gnome.org/show_bug.cgi?id=706042
This commit is contained in:
Jasper St. Pierre 2013-08-14 21:16:30 -04:00
parent 6d353f296e
commit a5cdade1a7

View file

@ -294,8 +294,14 @@ sync_airplane_mode_switch (CcNetworkPanel *panel)
GVariant *result;
gboolean enabled;
result = g_dbus_proxy_get_cached_property (panel->priv->rfkill_proxy, "AirplaneMode");
result = g_dbus_proxy_get_cached_property (panel->priv->rfkill_proxy, "HasAirplaneMode");
enabled = g_variant_get_boolean (result);
gtk_widget_set_visible (GTK_WIDGET (panel->priv->rfkill_switch), enabled);
if (!enabled)
return;
result = g_dbus_proxy_get_cached_property (panel->priv->rfkill_proxy, "AirplaneMode");
enabled = g_variant_get_boolean (result);
if (enabled != gtk_switch_get_active (panel->priv->rfkill_switch)) {
g_signal_handlers_block_by_func (panel->priv->rfkill_switch,