penguin-teal / gnome-openweather

A GNOME Shell extension to show the weather of any location on Earth.
GNU General Public License v3.0
52 stars 17 forks source link

Changing any setting value causes the weather panel to completely reload #31

Open ferdnyc opened 4 months ago

ferdnyc commented 4 months ago

Description

I suppose it's debatable whether this is a bug, but it certainly seems like an undesirable inefficiency.

For every value change in the Settings, the weather display in the top bar is completely reloaded. Like, it goes back to "↺ …" for a second or two before restoring the current temp/conditions display.

That includes each. individual. step. that you increment/decrement, say, the First Boot Delay -- a setting that can't possibly have any effect on the currently running weather instance.

(I'm particularly concerned about whether the extension might be re-downloading weather data from the provider, which would be especially bad. But even if it's not, a complete reload of the visual elements just because a setting changed, regardless whether it has any effect on the displayed information, seems like swatting a fly with a sledgehammer.)

System

Fedora 40

Settings

{"app-version":"135","git-version":"135.r0.ge994aeb","gnome-version":"46.1","user-locale":"en","unit":"'fahrenheit'","appid":"<KEY>","actual-city":"0","has-run":"true","days-forecast":"5","delay-ext-init":"5","locs":"[(0, '<NAME>', 0, '<PLACE>')]","expand-forecast":"true","weatherapidotcom-key":"<KEY>","use-system-icons":"true","pressure-unit":"'mmHg'","loc-refresh-interval":"60.0","position-in-panel":"'center'","wind-speed-unit":"'mph'"}
penguin-teal commented 4 months ago

It isn't re-downloading weather data, but it is refreshing it because I can only listen for a generic settings change of any kind. I can try to add some checks to only refresh on specific changes.

ferdnyc commented 4 months ago

@penguin-teal

It isn't re-downloading weather data

Oh, good, that's a relief, as that was my primary worry. Thanks.

I can try to add some checks to only refresh on specific changes.

And/or, perhaps, a time-delay on at least the numeric settings that are driven by spinboxes. Just so that every. tick. up/down isn't another refresh.

Typically I'd have a one-shot, restartable timer that waits maybe 250ms or 500ms to trigger the refresh, and tie each change of a spinbox value to a [re-]start of the timer. Only when the value stopped changing rapidly, would it finally run all the way to the end and actually refresh.