Closed fossfreedom closed 12 years ago
I have no idea how to do that :P (That's my second app in python, and my first rhythmbox extension XD) But I will look around if there is a way to add a context menu with the same submenus, without rewriting the whole extension... if anyone has any idea, please let me know! :D
The next UI string can be used to insert menues on the plugin placeholder on the default sources.
<ui>
<popup name="BrowserSourceViewPopup">
<placeholder name="PluginPlaceholder">
<menu name="MenuName" action="MenuAction">
<menuitem name="MenuItemName" action="MenuItemAction"/>
</menu>
</placeholder>
</popup>
<popup name="PlaylistViewPopup">
<placeholder name="PluginPlaceholder">
<menu name="MenuName" action="MenuAction">
<menuitem name="MenuItemName" action="MenuItemAction"/>
</menu>
</placeholder>
</popup>
<popup name="QueuePlaylistViewPopup">
<placeholder name="PluginPlaceholder">
<menu name="MenuName" action="MenuAction">
<menuitem name="MenuItemName" action="MenuItemAction"/>
</menu>
</placeholder>
</popup>
<popup name="PodcastViewPopup">
<placeholder name="PluginPlaceholder">
<menu name="MenuName" action="MenuAction">
<menuitem name="MenuItemName" action="MenuItemAction"/>
</menu>
</placeholder>
</popup>
</ui>
EDIT: gosh, I just saw that foss posted the example in other issue, sorry XD
No problem, thanks! Now the problem is:
No way to do that using the same actions, right?
I'm looking into it, haven't find anything yet. So far, nop, you should write new actions for the contextual menu.
Regarding the second issue, this should do it:
page = shell.props.selected_page
if not hasattr(page, "get_entry_view"):
return
selected = page.get_entry_view().get_selected_entries()
if selected != []:
#do something with selected entries
Great! I'm almost there! Do you know how can I get artist, album and song form the selected entry?
It's just as you have been doing with the current playing entry:
playing_title = entry.get_string(RB.RhythmDBPropType.TITLE)
playing_album = entry.get_string(RB.RhythmDBPropType.ALBUM)
playing_artist = entry.get_string(RB.RhythmDBPropType.ARTIST)
The only thing you have to take into account is that 'get_selected_entries()' returns a list, so you should iterate through it or use the first selected entry, whichever you think reflects better the functionallity you are trying to implement.
Et Voitlà! :) The context menu now works with the first selected entry (version 0.9). :)
Thank you very much for your help, and, by the way, your extensions helped me a lot to understand what I was doing and how Rhythmbox' APIs work!
Heh, no problem :3 I'm glad I was of help. Btw, nice going with the implementation to avoid creating new actions, it's much more concise and code-wise that way, it would have taken me awhile to figure it out lol.
Don't doubt to let me know if you need help with something else!
Personally, the ubuntu global menu makes using this plugin from the "web" menu a little confusing.
Can I suggest it would make more obvious to have "web" as a right-click menu option for a playing song - i.e. you rightclick a song - then select "web - find on youtube"