We want the list to keep updating, so periodically request scans
from NetworkManager. The code follows what Settings does in its
wifi panel, including the used interval.
There's a cute little spinner in the menu header now, to indicate
an ongoing scan.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
Unlike the old menu that restricted almost everything on the lock
screen, we went into the completely opposite direction with quick
settings and kept everything that does not launch windows available.
Extend that line to the network items, but still respect the
`network-control` permission.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
When moving to quick settings, we will no longer have a single
parent we can hide instead.
This is only really needed for VPN - devices go away when networking
is disabled, connections (as in: configuration) do not - but it's
simpler to just handle this in the base class than adding a
_shouldBeVisible() method the VPN section can override.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
If any device is in hotspot mode, use the corresponding item as
primary. Disable the (future QuickMenuToggle) menu in that case,
and turn off the hotspot when activated rather than toggling the
global wireless switch.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
Wireless items represent a single adapter, but wireless connectivity
is controlled globally under NetworkManager.
So instead of delegating activation to items, bind the :checked
property to the global :wireless-enabled property and toggle it
on activate.
As any wireless devices will change their state to UNAVAILABLE
when wireless is disabled, don't remove corresponding items in
that case to keep the section visible.
We don't want to hide the button to turn Wi-Fi back on when toggled
off :-)
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
Whether the device is used as a hotspot is currently only
used internally for the name and icon-name properties.
But hotspots need special treatment in the toggle as well,
so turn the method into a GObject property.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
As the sections are about to turn into quick toggles, they need
to be able to perform an action on click.
Add an activate() method for that purpose, which either disconnects
all active items, or connects the primary item.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
DeviceItems are sections, and therefore not actually activatable.
However when we port to quick settings, those toggles will need
to do *something*.
For that reason, provide an activate() implementation that
1. deactivates the device if currently connected
2. delegates the action to the most-recently used item,
the first visible item or the auto-connect item (in that
order)
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
The primary indicator is a bit tricker than the VPN one: The source
of the binding can change depending on the connection, and we still
want to show it when there is a network connection we don't know
about (either because we don't handle the device type, or the
device isn't managed by NetworkManager).
Bindings still make the whole thing a lot nicer though.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
This is the last property that will be needed by the future
betwork quick toggles.
It maps to the same item as :icon-name, except when more than one
item is active. In that case, we overrule the binding and return
a generic name and count (like "VPN (2)").
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
Again no big surprise, a property that will soon correspond to the
quick toggle's icon.
It is more involved than the :checked property though, which is just
a simple boolean.
To keep it as simple as possible, we set up a binding group and use
that to bind the :icon-name property.
As state changes, we then update the group's source with the item
we deem to best represent the section as a whole at the given
moment.
That is (in that order):
- the first active item
- the most recently used item
- the top-most visible item
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
Instead of subclassing PopupMenuSection, it is now a plain GObject
that has a `menu` JS property.
That brings it a tad bit closer to QuickMenuToggle, which is another
GObject with a `menu` property.
We are on the final stretch now. Over the next couple of commits,
we'll add some (fake) properties so we can hook everything up,
and then it's finally time for the big switch.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2408>
We treat wake up requests the same as user activity, as in general
the two behave the same: Turn on the screen and reset the idle watch
until the system becomes idle again.
The big exception is when the screen isn't locked yet. In that case
user activity should interrupt the automatic screen lock, but a
request to wake-up the screen (like showing a notification) should
not.
Address this by ignoring wake-up requests while the screen shield
isn't active, as we can expect the screen to still be turned on at
that point.
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5719
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2413>
Now that console.debug() makes it easy to log message with DEBUG
priority, we can be a lot more generous with logging without
spamming logs (by default).
Those turned out useful in figuring out the issue in the next
commit, so let's keep them.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2413>
This is a region where, if hovered while dragging, immediately goes
to the previous or next page. This behavior was lost during the
transition to the new app grid layout manager.
Bring back the drag overshoot region.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
As per feedback, remove the visible styling of the page indicators.
They're still used to layout and detect drag hovering, so the actors
are still in place, but they're completely transparent now.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
This brings back the ability to drop an icon beyong the last page.
Because the acceptDrop() method does not have access to the target
drop actor, to avoid an extra pick or manually calculating it from
allocations, simply store it during DragMonitor.dragDrop(), and
use the target actor in acceptDrop().
This commit also removes the last usage of SidePages, so drop the
enum too.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
This simplified the _handleDragOvershoot() callback quite a lot.
Instead of transforming point positions and checking them against
grid coordinates, merely check if the drop target is one of the
page indicators.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
Make the next and previous page arrows be StButtons, with their
'icon-name' property matching the current StIcon icon name, and
use the 'clicked' signal to switch pages.
Remove the 'button-press' callback the scroll view, since the
buttons take over this functionality.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
This was lost 2 commits ago, but now we reimplement this in a
different way. There is some jesting with allocations, since
we cannot use transformed positions while changing translation
of the icons. This new implementation works regardless of the
screen resolution.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
This is a major departure to how page previews used to work. Add
a new layout manager that handles showing and hiding page previews
and navigation arrows. Move most of the code handling page previews
to this new layout manager.
The layout manager allocates at most 20% of the screen width for
the previews, and at least the width of the arrow.
The next and previous page peeking effect is temporarily lost with
this commit, but will be reintroduced in later commits.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
AppDisplay will require an extra padding applied on top of CSS
page padding. This is specific to AppDisplay and FolderView.
Add a new AppGrid class which subclasses IconGrid and adds this
extra padding - here called 'indicators-padding'.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
The API surface of IconGrid was originally meant to be only
setGridModes(), however findBestModeForSize() ended up being
called by AppDisplay code. Now that FolderGrid sets the modes
correctly, we don't need to skip calling findBestModeForSize()
anymore.
Always call findBestModeForSize() during IconGrid's allocation.
Add an underscore to findBestModeForSize() since it's now back
to be a private method of IconGrid.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
Back in the day, adaptToSize() contained mad maths to figure out
icon sizes. Over time, its scope was reduced, to the point where
we are today where it mostly just redoes some quick maths to
predict the grid size based on the CSS box model.
Remove adaptToSize() from BaseAppView and child classes. It still
is an internal detail of the IconGrid class, but it's not exposed
as a "public" method anymore.
This removal is not perfect, as it doesn't move or compensate for
any of page indicators and arrows code. This will be done in follow
up commits introducing a new layout manager for that.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
Another step in dismantling AppDisplay before reintroducing some
of the elements there. Instead of adding a certain amount of
padding, capped at 200px, always give the grid all available size.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
The stack widget once was a ShellStack and had a prominent role
in layouting AppDisplay, but after a series of reworks it's now
effectively unused, and can be safely removed.
Remove the '_stack' widget from AppDisplay.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
We'll have to dismantle parts of AppDisplay and BaseAppView in
order to introduce navigation arrows in a way that won't drive
people insane.
Start this dismantling by removing the fade effect. It looks odd
for now, since we still set padding to the app grid, but that
will change soon too.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
Space will be less of a concern when each sections becomes its own
menu, but it's still not infinite. To address this, enable MRU
tracking and limit the list to the eight most recently used items.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
Devices do not have an associated timestamp, but as we can now
track the MRU order of their connections, it makes sense to consider
the time of the most recent succesful connection the timestamp
of the device item.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
We always display items sorted by name, but there are cases where a
second order by recency is interesting. Add an option to ItemSorter
to keep such a list and allow accessing it with another generator
function.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
Connections have a timestamp property, which records the last time
it was succesfully activated. This is useful information to us, as
more recently used connections are likely more relevant than ones
that haven't been used for a long time (or not at all).
To make use of it in the future, expose that timestamp as a property.
Only connections support it, but we will soon provide a reasonable
value for devices as well, so add the property to the base class.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>