If no items are added to the GVariantBuilder, g_variant_builder_close()
would throw a critical, g_variant_builder_end() would throw a
segmentation fault.
As this can only happen when there are no items added to the output_ids
hashtable, this should only happen if there are no displays known to
libgnome-desktop (and therefore mutter).
power: Fix wifi device state when opening power panel
This toggle is always set to off when the panel is opened. We should
check whether it's on or not when opening the panel. Currently we are
only subscribed to changes, so we don't check the wifi state until it's
toggled on or off after the panel has been opened the first time.
We check with NetworkManager whether a wireless device exists to decide
whether or not to display these toggles. NetworkManager says no, we hide
the toggles, then we call gtk_widget_show_all() and undo our work. Sad!
Actually pressing the toggles triggers the check again, and causes both
listbox rows to shockingly disappear.
This fix is not needed on the master branch because, since the port to
libnm 1.2, the check is now scheduled on the main loop, to run after
this function completes, inadvertantly fixing this bug.