[gnome-shell] appDisplay: Remember selected view across sessions



commit 5a7e854f9e385207222b34129c17301d62a3c57b
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Oct 13 16:48:12 2013 +0200

    appDisplay: Remember selected view across sessions
    
    The application picker will always open with the view that was last
    selected during the session, but the selection is reset on each
    restart. This results in some annoyance for users that use the
    ALL view exclusively, as they have to toggle views once each
    session - the same would apply to exclusive FREQUENT view users
    were the defaults to be changed, so the best solution is to simply
    make the selected view persistent by storing it in GSettings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710042

 data/org.gnome.shell.gschema.xml.in.in |    7 +++++++
 js/ui/appDisplay.js                    |    7 ++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.shell.gschema.xml.in.in b/data/org.gnome.shell.gschema.xml.in.in
index cf2e790..dc27e47 100644
--- a/data/org.gnome.shell.gschema.xml.in.in
+++ b/data/org.gnome.shell.gschema.xml.in.in
@@ -37,6 +37,13 @@
         application view, rather than being displayed inline in the main view.
       </_description>
     </key>
+    <key name="app-picker-view" type="u">
+      <default>0</default>
+      <summary>App Picker View</summary>
+      <description>
+        Index of the currently selected view in the application picker.
+      </description>
+    </key>
     <key name="command-history" type="as">
       <default>[]</default>
       <_summary>History for command (Alt-F2) dialog</_summary>
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index f9c5859..22e805a 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -744,10 +744,15 @@ const AppDisplay = new Lang.Class({
             this._views[i].control.connect('clicked', Lang.bind(this,
                 function(actor) {
                     this._showView(viewIndex);
+                    global.settings.set_uint('app-picker-view', viewIndex);
                 }));
         }
+        let initialView = Math.min(global.settings.get_uint('app-picker-view'),
+                                   this._views.length - 1);
         let frequentUseful = this._views[Views.FREQUENT].view.hasUsefulData();
-        this._showView(frequentUseful ? Views.FREQUENT : Views.ALL);
+        if (initialView == Views.FREQUENT && !frequentUseful)
+            initialView = Views.ALL;
+        this._showView(initialView);
         this._updateFrequentVisibility();
 
         // We need a dummy actor to catch the keyboard focus if the


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