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 734483 - Simplification of location menu
Simplification of location menu
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: system-status
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on: 734555
Blocks: 731119
 
 
Reported: 2014-08-08 13:52 UTC by Zeeshan Ali
Modified: 2014-08-10 16:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
location: Don't mind available accuracy level (2.30 KB, patch)
2014-08-08 13:52 UTC, Zeeshan Ali
reviewed Details | Review
location: Separate setting for enabling/disabling (5.00 KB, patch)
2014-08-08 13:52 UTC, Zeeshan Ali
reviewed Details | Review
location: Separate setting for enabling/disabling (5.82 KB, patch)
2014-08-09 13:17 UTC, Zeeshan Ali
none Details | Review
location: Separate setting for enabling/disabling (6.45 KB, patch)
2014-08-09 13:30 UTC, Zeeshan Ali
committed Details | Review
location: Move settings to gsettings-desktop-schemas (3.15 KB, patch)
2014-08-09 15:07 UTC, Zeeshan Ali
committed Details | Review

Description Zeeshan Ali 2014-08-08 13:52:02 UTC
See patches
Comment 1 Zeeshan Ali 2014-08-08 13:52:06 UTC
Created attachment 282914 [details] [review]
location: Don't mind available accuracy level

Not only tracking this property of geoclue makes the code a bit hard to
follow/maintain but its also not strictly needed. Just set the max
accuracy level to 'exact' when geolocation is enabled.
Comment 2 Zeeshan Ali 2014-08-08 13:52:11 UTC
Created attachment 282915 [details] [review]
location: Separate setting for enabling/disabling

Having the on/off setting be backed by a boolean in dconf makes sense
anyway but this is mainly to be able to remember the max accuracy set
before user disabled geolocation so that when they enable it next time,
we have the max accuracy level on same value as before.

There hasn't been a real need for this but now we are about to add
geolocation settings in control center and it'll be easiser for
control-center to simply toggle a boolean property rather than to have
to know about and deal with accuracy levels.

Later we might also want to add accuracy level settings to privacy panel
so keeping the accuracy level setting around still.
Comment 3 Florian Müllner 2014-08-08 14:47:29 UTC
Review of attachment 282914 [details] [review]:

Not sure - everything you add here is immediately removed with the next patch. Maybe it makes more sense to do the next patch first and then remove the (then-unused) available accuracy level?
Comment 4 Florian Müllner 2014-08-08 14:47:35 UTC
Review of attachment 282915 [details] [review]:

Not sure about _updateMenuLabels() - assuming the '0' is not a valid accuracy level users can choose, the fallback in _getMaxAccuracyLevel() works, but checking the 'enabled' key to update the 'Enabled'/'Disabled' label looks far more obvious ...
Comment 5 Zeeshan Ali 2014-08-08 15:03:49 UTC
Review of attachment 282915 [details] [review]:

Sorry, not exactly sure what you meant. -ETOOLONGSENTENCE. :)
Comment 6 Zeeshan Ali 2014-08-08 15:05:07 UTC
Review of attachment 282914 [details] [review]:

Well I'm not adding anything other than the enum but i can rebase if you like.
Comment 7 Florian Müllner 2014-08-08 15:12:59 UTC
Current code in _updateMenuLabels:

        if (this._getMaxAccuracyLevel() == 0) {
            this._item.status.text = _("Disabled");
            this._onOffAction.label.text = _("Enable");
        }

This reads slightly clearer to me:

        if (!this._settings.get_boolean('enabled')) {
            this._item.status.text = _("Disabled");
            this._onOffAction.label.text = _("Enable");
        }

(Jasper dislikes the !enabled form, so bonus points for swapping if and else block)

It's not a big deal, just that there's this function to update the menu items depending on whether location services are enabled, and a setting to enable/disable them, and the two are not directly connected.
Comment 8 Florian Müllner 2014-08-08 15:14:32 UTC
(In reply to comment #6)
> Well I'm not adding anything other than the enum but i can rebase if you like.

You also change how _onOnOffAction works in both patches :-)
Comment 9 Zeeshan Ali 2014-08-09 13:17:02 UTC
Created attachment 283001 [details] [review]
location: Separate setting for enabling/disabling

Having the on/off setting be backed by a boolean in dconf makes sense
anyway but this is mainly to be able to remember the max accuracy set
before user disabled geolocation so that when they enable it next time,
we have the max accuracy level on same value as before.

There hasn't been a real need for this but now we are about to add
geolocation settings in control center and it'll be easiser for
control-center to simply toggle a boolean property rather than to have
to know about and deal with accuracy levels.

Later we might also want to add accuracy level settings to privacy panel
so keeping the accuracy level setting around still. However we no longer
support 'off' accuracy level as the new boolean property covers that.

This also implies that we no longer track available accuracy level,
which made the code a bit hard to follow/maintain.
Comment 10 Zeeshan Ali 2014-08-09 13:30:43 UTC
Created attachment 283003 [details] [review]
location: Separate setting for enabling/disabling

v2: Update of menu labels directly check the new boolean setting rather than relying on computed max accuracy level.
Comment 11 Florian Müllner 2014-08-09 14:05:04 UTC
Review of attachment 283003 [details] [review]:

::: data/org.gnome.shell.gschema.xml.in.in
@@ -147,2 @@
   <enum id="org.gnome.shell.geoclue.AccuracyLevel">
-    <value value="0" nick="off"/>

I just tested setting 'max-accuracy-level' to 'off' before applying the patch, and ended up with location services enabled and at level 'exact' - I imagine this'll rub some people the wrong way, but I cannot think of a good way to avoid this off-hand.
Comment 12 Jasper St. Pierre (not reading bugmail) 2014-08-09 14:09:30 UTC
Can we not use org.gnome.shell.* settings for this? Anything gnome-control-center touches should be in gsettings-desktop-schemas.
Comment 13 Zeeshan Ali 2014-08-09 14:37:31 UTC
(In reply to comment #12)
> Can we not use org.gnome.shell.* settings for this? Anything
> gnome-control-center touches should be in gsettings-desktop-schemas.

Ouch, didn't know of that component even. I'll look into that.
Comment 14 Zeeshan Ali 2014-08-09 15:00:47 UTC
Comment on attachment 283003 [details] [review]
location: Separate setting for enabling/disabling

Will provide separate patch to remove location settings from shell.

Attachment 283003 [details] pushed as f1957dc - location: Separate setting for enabling/disabling
Comment 15 Zeeshan Ali 2014-08-09 15:07:42 UTC
Created attachment 283009 [details] [review]
location: Move settings to gsettings-desktop-schemas

Since these settings are now going to be accessed by
gnome-control-center as well, its more appropriate for them to live in
gsettings-desktop-schemas.
Comment 16 Florian Müllner 2014-08-09 15:38:50 UTC
Review of attachment 283009 [details] [review]:

Sure
Comment 17 Zeeshan Ali 2014-08-10 16:57:43 UTC
Attachment 283009 [details] pushed as ce2c90a - location: Move settings to gsettings-desktop-schemas