Commit Graph

17040 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
078aca220d Revert "st/scrollview: Add ::content-padding property to StScrollView"
This reverts commit 0d62dadfbc.

The only consumer of such API is now gone.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
8f247971eb appDisplay: Special-case dropping over page indicators
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>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
09b975fabf appDisplay: Reimplement drag motion using page indicators
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>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
ca9a19dfbe style: Theme pagination arrows as per mockups
The style is essentially a copy of %osd_button, but adapted to
style the inner icon instead of the whole button.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
892fa6581c appDisplay: Turn navigation arrows into StButtons
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>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
f22a5c5a91 appDisplay: Readd next and previous page icons previews
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>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
48bcc8f0e2 appDisplay: Make arrows always visible
Always show navigation arrows in the app grid. Make the arrows and
page indicators multually exclusive, hide one whenever the other
is visible.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
3281c03aea appDisplay: Make page previews fill allocation
Instead of hardcoding the width of the page previous, allow them
to fill the allocated space.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
6c00e0fda4 appDisplay: Use custom layout manager for page indicators
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>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
b9a373c1ab appDisplay: Introduce custom IconGrid class for AppDisplay
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>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
b115e07b4a iconGrid: Always call findBestModeForSize()
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>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
113130552f appDisplay: Set 3x3 grid mode for folders
Folders have a fixed 3x3 grid, given that folders themselves
have a fixed size. Make the code correspond to this invariant.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
083a691a74 appDisplay: Mostly remove adaptToSize
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>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
5ba699e095 appDisplay: Stop updating fade effect
Don't update the fade effect, since we have "infinite" borders now.
Also remove _availWidth and _availHeight, since these variables are
now unused.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2335>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
5cb94c526c appDisplay: Give all available size to grid
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>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
1fb570b415 appDisplay: Remove stack from AppDisplay
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>
2022-08-10 15:16:36 +00:00
Georges Basile Stavracas Neto
29601b84d4 appDisplay: Don't update fade effect
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>
2022-08-10 15:16:36 +00:00
Luming Zh
98e6421549 Update Chinese (China) translation 2022-08-10 15:11:37 +00:00
Yuri Chornoivan
b6d8a0e420 Update Ukrainian translation 2022-08-10 14:06:22 +00:00
Florian Müllner
b4ff426a93 status/network: Stop summarizing device sections
Now that the number of displayed items is capped, there's no need
for a summary anymore.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
1a0dbd00e4 status/network: Limit the number of items that are shown per section
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>
2022-08-10 12:17:19 +00:00
Florian Müllner
cb4d96072e status/network: Add timestamp to device items
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>
2022-08-10 12:17:19 +00:00
Florian Müllner
911762ea54 status/network: Add ItemSorter option to track MRU
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>
2022-08-10 12:17:19 +00:00
Florian Müllner
a3dbb3e71f status/network: Add timestamp property to items
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>
2022-08-10 12:17:19 +00:00
Florian Müllner
c84d63854f status/network: Move settings item into toplevel section
Eventually each section will turn into its own menu, which should
include a single settings item.

This also removes the odd duplication of items, now that we avoid
using submenus where possible.

In general this is straight-forward, except for modems: Some
models are now supported by a dedicated wwan panel, while others
still use the generic network one.

Address this by adding items for either panel, but only show one
at a time. The new panel is used if *any* modem is supported,
only when all modems require it, the legacy panel is used.

Hopefully that shouldn't be an issue for many users, as using many
different modems with different capabilities should be fairly rare
(except for Aleksander Morgado, but I think he can handle it)

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
c2139b27da status/network: Use submenus when necessary
We currently stopped using submenus altogether, but that only works

 - if there is a single connection that represents
   the device as a whole

 - if there is just one device, so it is unambiguous
   what device items belong to

To implement that behavior, add a 'single-device-mode' property that
NMDeviceSection can set on its items, and have items update their
'use-submenu' property based on that.

For wireless devices it's a straight mapping, as its items represent
wireless networks that can appear and disappear by just walking around
(multiple wifi adapters also sounds rather fringey).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
03ded1dcf0 status/network: Introduce NMSection parent type
Now that device sections manage a list of items, and the VPN section
manages a list of items, it's time to split out a shared base.

The class will get more involved over time, and eventually become
the base of all network quick items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
78154d9d20 status/network: Simplify section setup
With the latest changes, device- and VPN sections now require
exactly the same setup.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
392f72bf1c status/network: Store sections by device type
Now that the indicator no longer needs to map connections
to device wrappers, we can drop the custom 'category' type
and just use the device type.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
acda87dd26 status/network: Track devices in NMDeviceSection
We got the indicator out of the business of tracking connections,
now it's time to do the same for devices.

Let sections track device additions and removals, and create device
items for them as it sees fit.

It also allows the sections to handle the ::activation-failed signal
by themselves, instead of passing it on from device items.

With this, the indicator is now solely responsible for global state:
Manage the top bar indicators, notify on connection failures, and run
the portal helper when NetworkManager detects a captive portal.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
9bb9a847ba status/network: Let device items handle their own connections
As mentioned when doing the same for VPN connections, it is currently
the indicator itself that keeps track of added and removed connections.

It then has to figure out the correct section, and iterate through all
its device items so each item can check whether the connection
corresponds to its device.

Stop that mess, and let each device item keep its connections updated
by itself. That is actually way easier, as NM.Device already exposes
available connections through a property, so we can get rid of all
the checkConnection() shenanigans.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
59a3963647 status/network: Create indicator sections in constructor
We currently wait until we got a connection to NetworkManager.

That's possible because the old PanelMenu indicator API takes
a menu, so it is possible to add or remove items dynamically
later.

That won't be the case with quick settings, where `quickSettingsItems`
is a plain array that is only read once when adding the indicator.

Prepare for that by moving section initialization into the constructor.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
50671a78ec status/network: Replace wi-fi selection dialog
Now that wi-fi devices will be handled by a separate menu toggle
instead of as part of a combined system menu, there is no longer
a need of delegating network selection to a separate dialog.

To keep the menu from growing too much, the (sorted) list of
displayed networks is kept at a limit of eight. There is always
Settings for a complete list…

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
9809d717f5 status/network: Use SectionItem for device items
In terms of UI, this means that in the common case where we have
a single (or no) connection, the device can be represented as a
single menu item rather than a submenu.

But more importantly, all our menu items inherit from the same
GObject class now, so we can use bindings where appropriate.

This will later extend to quick toggles as well.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
ad1a32749e status/network: Add NMSectionItem subclass
The class implements a menu item that contains a section which
can be collapsed into a submenu.

It is very common for network devices to only have one associated
connection, so hiding away a single item in a submenu is fairly
inconvenient.

This class will address this, by only using a submenu when it is
actually needed.

Although the main issue it addresses is that menus (including
sections) aren't GObjects. This gives us a GObject that can
be added to a menu, and that can itself contain other menu
items.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
b4da69d474 network/status: Split out NMMenuItem base class
The class only provides the GObject properties that are currently
defined by NMConnectionItem, plus a way to set the active connection
that should be used for the item's :is-active state.

Its sole purpose is to provide a shared base for both device- and
connection items, and to have that base be a GObject so we can
start linking properties via bindings rather than manual fiddling.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
9002344ec6 status/network: Always use toggles in VPN section
Let's keep things simple and use the same appearance regardless
of the number of configured VPNs. Also unlike for device items,
every connection item in the VPN section is a toplevel item, so
there isn't a real need for different presentations.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
7357a80d2b status/network: Merge NMConnectionSection and NMConnectionDevice
Now that the VPN section isn't using NMConnectionSection anymore,
NMConnectionDevice is the only subclass.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
0d259d62b2 status/network: Decouple NMVpnSection from NMConnectionSection
The NMConnectionSection class is used - surprise - to manage a
list of related connections. And while the presentation of VPN
items is slightly different from connections associated with
devices (switches vs. ornaments), it makes perfect sense for
the VPN section to share the nitty-gritty with the base class.

But…

Right now it is perfectly fine for NMConnectionSection to be
used both as a child element in a device section, and as toplevel
item of the VPN section. Any nesting of sections is entirely
transparent to the user, and all connection sections appear as
submenu items in the toplevel menu.

That won't work for quick settings.

There's no PopoverMenuSection that allows invisible grouping, so
adding items dynamically would either need to happen at the end,
or require some tricky cross-component code to impose a particular
order.

And last but not least, quick toggles are very much unsuited for
a potentially large number of items. The whole point is to provide
quick direct access to system features, not to compete with menus
over the number of items they can hold.

That is, we need to get from the current state where each device
appears as a toplevel item, to a state where we have one quick
toggle for each device type plus one for VPN.

The decoupled VPN section still behaves largely as it did as a
subclass, with the notable difference that it no longer uses
a submenu item, so all VPN connections now appear at the toplevel.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
df354fc0d4 status/network: Handle VPN connections in VPN section
Right now the indicator itself tracks all devices and connections,
creates and destroys the corresponding menu items, matches them
to a section and updates the connection/device arrays that are
attached to the section.

Sounds messy?

It is slightly less effective to connect multiple handlers to the
same NMClient, but let's assume that devices and connections aren't
added/removed at 60 frames/s, and we can add some readabilty by
moving the code into different classes that only have to care about
the bits that are relevant to them.

The VPN section is a good starting point, because its handling is
already quite different from device sections.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
e84ab815d2 status/network: Factor out ItemSorter class
At its core, it's the sort order tracking from NMConnectionItem
with a bit of sugar on top to provide access to the ordered items
and the ability to provide a custom sort function.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
be950d5c4a status/network: Sort items, not connections
You could argue that the item name is closer to what is displayed
to the user, but it doesn't really matter: Connection items will
always use the connection ID when there is more than one, which
is the only case where sorting matters.

However sorting by items will allow us to generalize the code, and
use it for items that do not represent a connection.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
a62ac495a3 status/network: Split out NMDeviceConnectionItem
When not in radio-mode - that is, when the connection is the only
connection for its device - we want the item to represent the
device as a whole.

Achieve this with a small ConnectionItem subclass that adds a
:device-name property for that purpose.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
64ae6ae7b3 status/network: Update appearance of connection items
When not in radio-mode - that is, in the single-connection
case - the item currently uses a plain 'Connect' label.

That is OK while the item is inside a submenu that describes
the device, but we will soon stop using a submenu when a single
item can describe the device as a whole.

Prepare for that by adding an icon that is shown when in non-radio
mode, and include the device name in the label in that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Florian Müllner
9e3cb0b797 status/network: Make NMConnectionItem a menu item
Instead of the current radioItem/labelItem shenanigans, implement
a custom menu item with a :radio-mode property to switch between
the different presentations.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2407>
2022-08-10 12:17:19 +00:00
Alessandro Bono
b63c6ac0ef cleanup: Use deepUnpack() intead of deep_unpack()
deep_unpack() is just a backwards compability alias for deepUnpack()[1].
The new name makes it more clear that this is not a C function, start to
use it.

[1] 13e662a29d

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2416>
2022-08-10 10:29:24 +00:00
Alessandro Bono
ade4b23796 cleanup: Minimize deep_unpack() usage
deep_unpack()[1] will unpack a variant and its children, but only up to one level.
lookup_value()[2] will directly search for a value with a linear scan.

Performing a deep_unpack() + lookup can be a more expensive operation when we are
looking for just a single value compared to just perform the lookup_value() directly
in C. Avoid the deep_unpack() usage when we perform a single check presence.

[1] https://gjs.guide/guides/glib/gvariant.html#deepunpack
[2] https://docs.gtk.org/glib/method.Variant.lookup_value.html

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2416>
2022-08-10 10:29:24 +00:00
Carlos Garnacho
23bfd08b3c misc: Toggle IBus OSK capability on OSK visibility
Newer versions of IBus (> 1.5.26) have the IBUS_CAP_OSK capability
which can be used to hint the active IM about an OSK driving input as
opposed to a physical keyboard. This may be used by IMs to tweak their
behavior to suit OSKs better.

Add the GNOME Shell side handling for this capability, and toggle it
on whenever the OSK is visible.

Since this is a far too new enum value and we don't want such new
IBus dependency, this change plays fast and loose with JS guarantees,
since a logical OR with an undefined value results in the other operand
unmodified it will work for older versions where the capability does not
exist and thus we want nothing extra enabled.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2415>
2022-08-10 10:14:40 +00:00
Alessandro Bono
4871eba8bf loginDialog: Don't call _loginScreenSessionActivated() when not required
We are calling _loginScreenSessionActivated() even in cases where this is
not required. For example, there are cases where the Active property is
already `true` and properties like `IdleHint`, `IdleSinceHint` and
`IdleSinceHintMonotonic` change. In this cases _loginScreenSessionActivated()
is called and will reset the authPrompt when not necessary.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2411>
2022-08-10 09:48:35 +00:00
Danial Behzadi
a70e9c2876 Update Persian translation 2022-08-09 21:14:00 +00:00