After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 710042 - appDisplay: Remember selected view across sessions
appDisplay: Remember selected view across sessions
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2013-10-13 15:47 UTC by Florian Müllner
Modified: 2013-10-15 18:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
appDisplay: Remember selected view across sessions (2.60 KB, patch)
2013-10-13 15:47 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2013-10-13 15:47:00 UTC
See patch. This is what Allan and Jakub agreed on, see https://bugzilla.gnome.org/show_bug.cgi?id=709179#c4.
Comment 1 Florian Müllner 2013-10-13 15:47:02 UTC
Created attachment 257175 [details] [review]
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.
Comment 2 Giovanni Campagna 2013-10-13 15:53:01 UTC
Review of attachment 257175 [details] [review]:

::: js/ui/appDisplay.js
@@ +745,3 @@
                 function(actor) {
                     this._showView(viewIndex);
+                    global.settings.set_int('app-picker-view', viewIndex);

Should we delay saving the setting to the disk with a timeout?
Otherwise looks good to me.

@@ +749,3 @@
         }
+        let initialView = Math.min(global.settings.get_int('app-picker-view'),
+                                   this._views.length - 1);

Technically, because this is a int, not a uint, it could be negative. I don't think anyone would purposefully set -1 to break the shell though...
Comment 3 Florian Müllner 2013-10-13 16:20:48 UTC
(In reply to comment #2)
> Should we delay saving the setting to the disk with a timeout?

I don't really see why - a reasonable timeout would need to be big enough to allow users to move the mouse and click for any benefit, while still being small enough to not increase the risk of ending the session during the timeout too much (so let's say - 30s?). How many times would users normally change views in that time? The only case where I can see some saving in disk activity is when working on stuff like view transitions, but this doesn't look worthwhile to me optimizing for ...


 - we only set the value as result of user interaction (e.g. when one of the buttons is clicked, not when changing the view automatically due to some other condition), so I only see us saving a bit of disk activity when users frantically switch between views (do they?) at the risk of breaking user expectation because we 


> @@ +749,3 @@
> Technically, because this is a int, not a uint, it could be negative.

It's using a range restriction but yeah, could just as well use uint ...
Comment 4 Florian Müllner 2013-10-15 18:11:34 UTC
Attachment 257175 [details] pushed as 5a7e854 - appDisplay: Remember selected view across sessions