Wifimanager: Make the wifi icon behave like in gnome shell
This fixes the issue that the wifi icon doesn't always reflect the correct wifi state. This refactores the code and implements the icon in a similar way the GNOME Shell does. It makes the code cleaner by setting the icon name only in one function, because it makes more understandable which icon is used for a given wifi state.
This are the issue addressed in this commit:
-
on_nm_active_connection_state_changed
is not called when connecting to a new network and therefore the icon is never set tonetwork-wireless-acquiring-symbolic
. (I'm not sure if other states are propagated to the icon correctly, since this is the most important one.) - The icon is set in many different places and the icon depends on the order how signals are received.
- It doesn't check for connectivity nor sets the state to
network-wireless-no-route-symbolic
when there isn't any route to the internet. - The property
PHOSH_WIFI_MANAGER_PROP_ICON_NAME
is notified not only when the icon-name changes. - Running Phosh together with GNOME Shell the icon in Phosh isn't always the same as in GNOME Shell. (similar to #202 (closed))
To fix on_nm_active_connection_state_changed
correctly we need the
wifi device before it's available in active-connections
therefore
we can't use notify::active-connections
to get the WIFI device.
Therefore this uses always the first wifi device available.
Fixes: #202 (closed)