Skip to content

Commit

Permalink
Attach some menus to containing widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Apr 27, 2017
1 parent 28aab01 commit b47fc1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions xlgui/widgets/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ def __init__(self, notebook, page, vertical=False):

self.notebook = notebook
self.page = page

self.menu = menu.ProviderMenu(self.menu_provider_name, self)
self.page.tab_menu.attach_to_widget(self, None)

self.connect('button-press-event', self.on_button_press)

Expand Down
9 changes: 6 additions & 3 deletions xlgui/widgets/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def __init__(self, page):
associated with.
"""
menu.ProviderMenu.__init__(self, 'playlist-context-menu', page)
self.attach_to_widget(page, None)

def get_context(self):
context = common.LazyDict(self._parent)
Expand Down Expand Up @@ -668,8 +669,11 @@ def __init__(self, playlist, player):

self.playlist = playlist
self.player = player

self.menu = PlaylistContextMenu(self)
self.tabmenu = menu.ProviderMenu('playlist-tab-context-menu', self)
self.header_menu = menu.ProviderMenu('playlist-columns-menu', self)
self.header_menu.attach_to_widget(self)

self.dragging = False
self.pending_event = None
self.button_pressed = False # used by columns to determine whether
Expand Down Expand Up @@ -905,8 +909,7 @@ def _refresh_columns(self):

def on_header_button_press(self, widget, event):
if event.button == Gdk.BUTTON_SECONDARY:
m = menu.ProviderMenu('playlist-columns-menu', self)
m.popup(None, None, None, None, event.button, event.time)
self.header_menu.popup(None, None, None, None, event.button, event.time)
return True

def on_columns_changed(self, widget):
Expand Down

0 comments on commit b47fc1e

Please sign in to comment.