[gnome-shell] status/network: Add timestamp property to items



commit a3dbb3e71f719bf8346734249a27451fa734b8e2
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Aug 3 08:12:28 2022 +0200

    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>

 js/ui/status/network.js | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index 7370af9858..98e50dbee1 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]