CoverPanel: combine context sort items in submenu
This commit is contained in:
parent
6265db2d6e
commit
25083a1b7a
1 changed files with 16 additions and 9 deletions
25
mcgGtk.py
25
mcgGtk.py
|
@ -449,34 +449,41 @@ class CoverPanel(Gtk.HPaned):
|
|||
self._progress_box.pack_start(self._progress_bar, True, False, 0)
|
||||
# Context Menu
|
||||
self._cover_grid_menu = Gtk.Menu()
|
||||
# Sorting
|
||||
item_sorting = Gtk.MenuItem("Sorting")
|
||||
item_sorting.show()
|
||||
self._cover_grid_menu.add(item_sorting)
|
||||
menu_sorting = Gtk.Menu()
|
||||
menu_sorting.show()
|
||||
item_sorting.set_submenu(menu_sorting)
|
||||
cover_grid_menu_group_sort = None
|
||||
item = Gtk.RadioMenuItem("Sort by artist")
|
||||
item = Gtk.RadioMenuItem("by artist")
|
||||
item.connect('activate', self.cover_grid_menu_sort, mcg.MCGAlbum.SORT_BY_ARTIST)
|
||||
item.show()
|
||||
self._cover_grid_menu.add(item)
|
||||
menu_sorting.add(item)
|
||||
cover_grid_menu_group_sort = item
|
||||
item = Gtk.RadioMenuItem(group=cover_grid_menu_group_sort, label="Sort by title")
|
||||
item = Gtk.RadioMenuItem(group=cover_grid_menu_group_sort, label="by title")
|
||||
item.set_active(True)
|
||||
item.connect('activate', self.cover_grid_menu_sort, mcg.MCGAlbum.SORT_BY_TITLE)
|
||||
item.show()
|
||||
self._cover_grid_menu.add(item)
|
||||
item = Gtk.RadioMenuItem(group=cover_grid_menu_group_sort, label="Sort by year")
|
||||
menu_sorting.add(item)
|
||||
item = Gtk.RadioMenuItem(group=cover_grid_menu_group_sort, label="by year")
|
||||
item.connect('activate', self.cover_grid_menu_sort, mcg.MCGAlbum.SORT_BY_YEAR)
|
||||
item.show()
|
||||
self._cover_grid_menu.add(item)
|
||||
menu_sorting.add(item)
|
||||
item = Gtk.SeparatorMenuItem()
|
||||
item.show()
|
||||
self._cover_grid_menu.add(item)
|
||||
menu_sorting.add(item)
|
||||
item = Gtk.RadioMenuItem("Ascending")
|
||||
cover_grid_menu_group_sort_type = item
|
||||
item.set_active(True)
|
||||
item.connect('activate', lambda widget: self._cover_grid_model.set_sort_column_id(3, Gtk.SortType.ASCENDING))
|
||||
item.show()
|
||||
self._cover_grid_menu.add(item)
|
||||
menu_sorting.add(item)
|
||||
item = Gtk.RadioMenuItem(group=cover_grid_menu_group_sort_type, label="Descending")
|
||||
item.connect('activate', lambda widget: self._cover_grid_model.set_sort_column_id(3, Gtk.SortType.DESCENDING))
|
||||
item.show()
|
||||
self._cover_grid_menu.add(item)
|
||||
menu_sorting.add(item)
|
||||
self._cover_grid_menu.show()
|
||||
|
||||
# Signals
|
||||
|
|
Loading…
Reference in a new issue