[gnome-shell-extensions/wip/rstrode/heads-up-display: 14/62] systemMonitor: Handle clicks on section title




commit 2dbc992e9881760f231f885529f41f040d00bc6c
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu May 18 16:20:07 2017 +0200

    systemMonitor: Handle clicks on section title
    
    While on 3.24.x only the event section still has a clickable title,
    it's a generic message list feature in previous versions. It's easy
    enough to support with a small subclass, so use that instead of
    the generic baseclass.
    
    Fixes: https://gitlab.gnome.org/GNOME/gnome-shell-extensions3

 extensions/systemMonitor/extension.js | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/extensions/systemMonitor/extension.js b/extensions/systemMonitor/extension.js
index 0188960..b4d5a9d 100644
--- a/extensions/systemMonitor/extension.js
+++ b/extensions/systemMonitor/extension.js
@@ -303,6 +303,21 @@ const MemoryIndicator = class extends Indicator {
     }
 };
 
+class SystemMonitorSection extends MessageList.MessageListSection {
+    constructor() {
+        super(_('System Monitor'));
+    }
+
+    _onTitleClicked() {
+        super._onTitleClicked();
+
+        let appSys = Shell.AppSystem.get_default();
+        let app = appSys.lookup_app('gnome-system-monitor.desktop');
+        if (app)
+            app.open_new_window(-1);
+    }
+}
+
 const INDICATORS = [CpuIndicator, MemoryIndicator];
 
 class Extension {
@@ -315,7 +330,7 @@ class Extension {
     }
 
     enable() {
-        this._section = new MessageList.MessageListSection(_('System Monitor'));
+        this._section = new SystemMonitorSection();
         this._indicators = [];
 
         for (let i = 0; i < INDICATORS.length; i++) {


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