[gnome-shell] appDisplay: Hide frequent view when app monitoring is disabled



commit f88d9c06f5f8205c0cef36fb9474d39fdebe7241
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Mar 2 00:46:34 2013 +0100

    appDisplay: Hide frequent view when app monitoring is disabled
    
    Currently we stop monitoring application usage when disabling the
    'enable-app-monitoring' setting, but we still expose previously
    gathered data in the app picker's frequent view. This is not what
    users should expect, so hide the view in that case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699714

 js/ui/appDisplay.js |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index afeecc1..7ed76b8 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -343,6 +343,8 @@ const AppDisplay = new Lang.Class({
         global.settings.connect('changed::app-folder-categories', Lang.bind(this, function() {
             Main.queueDeferredWork(this._allAppsWorkId);
         }));
+        global.settings.connect('changed::enable-app-monitoring',
+                                Lang.bind(this, this._updateFrequentVisibility));
 
         this._views = [];
 
@@ -386,6 +388,7 @@ const AppDisplay = new Lang.Class({
                 }));
         }
         this._showView(Views.FREQUENT);
+        this._updateFrequentVisibility();
 
         // We need a dummy actor to catch the keyboard focus if the
         // user Ctrl-Alt-Tabs here before the deferred work creates
@@ -415,6 +418,19 @@ const AppDisplay = new Lang.Class({
         }
     },
 
+    _updateFrequentVisibility: function() {
+        let enabled = global.settings.get_boolean('enable-app-monitoring');
+        this._views[Views.FREQUENT].control.visible = enabled;
+
+        let visibleViews = this._views.filter(function(v) {
+            return v.control.visible;
+        });
+        this._controls.visible = visibleViews.length > 1;
+
+        if (!enabled && this._views[Views.FREQUENT].view.actor.visible)
+            this._showView(Views.ALL);
+    },
+
     _redisplay: function() {
         this._redisplayFrequentApps();
         this._redisplayAllApps();


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