JSApi Properties for canNavigateBack/Forward

Bug #1265290 reported by Martin Pöhlmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Nuvola Apps Runtime (Nuvola Player)
Fix Released
Wishlist
Unassigned

Bug Description

Bug #1212167 requests back/forward navigation buttons integrated into the service website.
As back/forward navigation is not always possible, it may be wise to display these buttons as disabled and not clickable to resemble the state of the rightclick / "Go" menu.

My sample implementation for Google Music tries to determine if back/forward navigation is possible by emulating the navigation stack.
See: https://code.launchpad.net/~mpdeimos/nuvola-player/bug-1212167/

While this method works in most cases, it has to be duplicated in other service integrations to achieve the same behavior.

A better option would be to expose canNavigateBack/Forward as properties via the JSApi.

Revision history for this message
Jiří Janoušek (fenryxo) wrote :

I definitely don't want to implement canNavigateBack/Forward, but more generic Nuvola.isActionEnabled(name).
It might also be useful to send signal when action's state is changed: Nuvola.onMessageReceived("actionChanged", name, enabled)

Changed in nuvola-player:
status: New → In Progress
importance: Undecided → Wishlist
milestone: none → 2.4.0
Revision history for this message
Martin Pöhlmann (mpdeimos) wrote :

This definitely makes sense, also wrt to future stuff.

Thinking one step further, it would also make sense to introduce a action java script object, that allows to fire the action and monitor its enabled state?

Revision history for this message
Jiří Janoušek (fenryxo) wrote :

Currently implemented in JS API 2.0:
 - Nuvola.updateAction(name, available) - updates availability (sensitivity) of an action
 - Nuvola.triggerAction(name) - triggers an action

See https://nuvolaplayer.fenryxo.cz/contribute/development/javascript_api.html

Planned for JS API 2.3:
 - Nuvola.isActionEnabled(name)
 - Nuvola.onMessageReceived("actionChanged", name, enabled)

It could be possible to create and object that wraps these methods.

Nuvola.getAction(name) -> object Action

object Action:
- name
- isEnabled() -> Nuvola.isActionEnabled(name)
- setEnabled(enabled) -> Nuvola.updateAction(name, enabled)
- trigger() -> Nuvola.triggerAction(name)

Revision history for this message
Jiří Janoušek (fenryxo) wrote :

Fix committed to lp:nuvola-player as r792. Will be released in Nuvola Player 2.4.0.
<http://bazaar.launchpad.net/~fenryxo/nuvola-player/trunk/revision/792>

Documantation attached.

Changed in nuvola-player:
status: In Progress → Fix Committed
Changed in nuvola-player:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.