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>
This commit is contained in:
Florian Müllner 2022-08-03 08:12:28 +02:00 committed by Marge Bot
parent c84d63854f
commit a3dbb3e71f

View File

@ -161,6 +161,10 @@ const NMMenuItem = GObject.registerClass({
return this.state <= NM.ActiveConnectionState.ACTIVATED;
}
get timestamp() {
return 0;
}
activate() {
super.activate(Clutter.get_current_event());
}
@ -301,6 +305,10 @@ class NMConnectionItem extends NMMenuItem {
return this._connection.get_id();
}
get timestamp() {
return this._connection.get_setting_connection()?.get_timestamp() ?? 0;
}
updateForConnection(connection) {
// connection should always be the same object
// (and object path) as this._connection, but