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 690539 - volume: Clean up the volume indicator code
volume: Clean up the volume indicator code
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: 2012-12-20 04:06 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2012-12-25 17:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
volume: Make icon calculation stable (4.12 KB, patch)
2012-12-20 04:06 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
volume: Merge the two update handlers (3.18 KB, patch)
2012-12-20 04:06 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
volume: Don't set the visibility of the main icon (1009 bytes, patch)
2012-12-20 04:06 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
volume: Don't have a separate syncVisibility method (1.70 KB, patch)
2012-12-20 04:06 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
volume: Pick up hasHeadphones from the signal handler (1.81 KB, patch)
2012-12-20 04:06 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
volume: Clean up code (14.41 KB, patch)
2012-12-20 04:06 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2012-12-20 04:06:02 UTC
The current code here is "JavaScript"-y, where we have a fake
namespace done by a prefix. I've never really liked this model;
so I'm cleaning it up a bit.

I'm not particularly happy with the large cleanup at the end,
but I think it can be workshopped towards something good.

Looking at all the crazy mute manipulations, I wonder if it makes
sense to get some smarter semantics baked into gvc so that muting
is handled for us automatically. We could probably also add a
"normalized-volume" property so we wouldn't have to multiply/divide
all over the place.
Comment 1 Jasper St. Pierre (not reading bugmail) 2012-12-20 04:06:04 UTC
Created attachment 231961 [details] [review]
volume: Make icon calculation stable

Calculate an icon based on our current state, not a mess of
signal emissions and callbacks. This is a preliminary basic
cleanup patch in preparation for the next one.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-12-20 04:06:07 UTC
Created attachment 231962 [details] [review]
volume: Merge the two update handlers

With our mess of callbacks gone, we can update stream volume
in a single place only.
Comment 3 Jasper St. Pierre (not reading bugmail) 2012-12-20 04:06:10 UTC
Created attachment 231963 [details] [review]
volume: Don't set the visibility of the main icon

As the main icon is inside the actor, this is needless calculation.
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-12-20 04:06:13 UTC
Created attachment 231964 [details] [review]
volume: Don't have a separate syncVisibility method

With it doing less now, we can simply do it inline.
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-12-20 04:06:15 UTC
Created attachment 231965 [details] [review]
volume: Pick up hasHeadphones from the signal handler

A preliminary patch for big cleanups happening soon.
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-12-20 04:06:19 UTC
Created attachment 231966 [details] [review]
volume: Clean up code

Rather than using naming schemes and dynamic property lookups as
a kind of namespace, use what was designed to be used as a namespace:
a class.
Comment 7 Giovanni Campagna 2012-12-20 21:43:42 UTC
Review of attachment 231963 [details] [review]:

Wrong, mainIcon.visible is bound to the volume icon in the lock screen menu.
Comment 8 Giovanni Campagna 2012-12-20 21:47:05 UTC
Review of attachment 231962 [details] [review]:

Uhm, ok.
Comment 9 Giovanni Campagna 2012-12-20 21:47:53 UTC
Review of attachment 231961 [details] [review]:

Not bad.
Comment 10 Giovanni Campagna 2012-12-20 21:48:25 UTC
Review of attachment 231964 [details] [review]:

Wrong, because of the previous patch
Comment 11 Giovanni Campagna 2012-12-20 21:48:49 UTC
Review of attachment 231965 [details] [review]:

Ok
Comment 12 Giovanni Campagna 2012-12-21 17:54:19 UTC
With the other bug sorted out, the two rejected patches become acn.
The remaining one seems fine, but let me test it first.
Comment 13 Giovanni Campagna 2012-12-21 18:09:52 UTC
Review of attachment 231966 [details] [review]:

Regression found: _notifyVolumeChange should notify only for the output stream.
Comment 14 Jasper St. Pierre (not reading bugmail) 2012-12-21 18:27:36 UTC
Attachment 231961 [details] pushed as f60fb95 - volume: Make icon calculation stable
Attachment 231962 [details] pushed as 571aaec - volume: Merge the two update handlers
Attachment 231963 [details] pushed as 9ebeb64 - volume: Don't set the visibility of the main icon
Attachment 231964 [details] pushed as 66da3f5 - volume: Don't have a separate syncVisibility method
Attachment 231965 [details] pushed as 1a4948f - volume: Pick up hasHeadphones from the signal handler


That actually isn't a regression -- the logic to play a canberra sound
event on the input slider drag-end is in the original code, too. I'll
file a second bug for a follow-up fix.

Pushed after IRC review.
Comment 15 drago01 2012-12-25 15:22:58 UTC
Anything left here? Or can we close this?
Comment 16 Giovanni Campagna 2012-12-25 17:34:48 UTC
(Merry Christmas!)

Let's close this.