wifi: Keep Airplane Mode always synchronized

Currently, we acquire the Rfkill D-Bus proxy and synchronize
the state right after that. However, we don't monitor for
subsequent changes by connecting to the 'g-properties-changed'
GDBusProxy signal, which causes the Airplane Mode not to stay
synchronized when modified from others places, such as GNOME
Shell's aggregate menu.

This commit adds the necessary signal monitoring code to react
to external applications changing the Rfkill properties.
This commit is contained in:
Georges Basile Stavracas Neto 2018-07-23 10:09:55 -03:00
parent b9da351a3d
commit 88c30e8fbd

View file

@ -479,6 +479,17 @@ wireless_enabled_cb (NMClient *client,
check_main_stack_page (self);
}
static void
on_rfkill_proxy_properties_changed_cb (GDBusProxy *proxy,
GVariant *changed_properties,
GStrv invalidated_properties,
CcWifiPanel *self)
{
g_debug ("Rfkill properties changed");
sync_airplane_mode_switch (self);
}
static void
rfkill_proxy_acquired_cb (GObject *source_object,
GAsyncResult *res,
@ -504,6 +515,12 @@ rfkill_proxy_acquired_cb (GObject *source_object,
self->rfkill_proxy = proxy;
g_signal_connect_object (proxy,
"g-properties-changed",
G_CALLBACK (on_rfkill_proxy_properties_changed_cb),
self,
0);
sync_airplane_mode_switch (self);
}