eonpatapon/gnome-shell-extensions-mediaplayer — pull request #134 by tommie-lie (2013-05-23 17:55:19+00:00)
Title: Fix issues with multiple default player items.

This patch should fix issues #127 and #73.
The problem with the async invokation of _hideOrDefaultPlayer() is that when gnome-shell's screen shield ("lock screen") is invoked, the application is enabled and disabled several times (depending on the number of other extensions that are "above" in the extension stack).
The menu item to start the default player is added 500ms after the enable(), by this time disable() has already been called and the new item never gets removed from the menu, as _removePlayer() cannot see 500ms into the future.

I carefully checked all the async states and I **think** it is save to remove all the 500ms delays now. With _hideOrDefaultPlayer() at the end of _init(), the worst thing that could happen is that a DefaultPlayer is created for very few ms and then destroyed again by _addPlayer() (from the GetNameOwner callback). This should not be a problem, as the dbus callback should be quite fast and noone will notice the default player. If for some reason it *is* slow, it makes sense to show the default player from the start.