def __init__(self, parent, library, mgr): """ Expects a parent Gtk.Window, and a daap connection. """ self.name = library.daap_share.name self.daap_share = library.daap_share self.net_collection = collection.Collection(self.name) self.net_collection.add_library(library) CollectionPanel.__init__(self, parent, self.net_collection, self.name, _show_collection_empty_message=False) self.all = [] self.label = self.name self.connect_id = None self.menu = menu.Menu(self) def get_tracks_func(*args): return self.tree.get_selected_tracks() self.menu.add_item(menuitems.AppendMenuItem('append', [], get_tracks_func)) self.menu.add_item(menuitems.EnqueueMenuItem('enqueue', ['append'], get_tracks_func)) self.menu.add_item(menuitems.PropertiesMenuItem('props', ['enqueue'], get_tracks_func)) self.menu.add_item(_sep('sep',['props'])) self.menu.add_item(_smi('refresh', ['sep'], _('Refresh Server List'), callback = lambda *x: mgr.refresh_share(self.name))) self.menu.add_item(_smi('disconnect', ['refresh'], _('Disconnect from Server'), callback = lambda *x: mgr.disconnect_share(self.name)))
def __create_track_panel_menus(): items = [] items.append(menuitems.EnqueueMenuItem('enqueue', after=['top-sep'])) items.append(menuitems.AppendMenuItem('append', after=[items[-1].name])) items.append(menuitems.ReplaceCurrentMenuItem('replace', after=[items[-1].name])) items.append(menuitems.RatingMenuItem('rating', after=[items[-1].name])) items.append(menu.simple_separator('tp-sep', after=[items[-1].name])) items.append(menuitems.PropertiesMenuItem('properties', after=[items[-1].name])) for item in items: item.register('track-panel-menu')