Skip to content

Commit

Permalink
add queue filter function
Browse files Browse the repository at this point in the history
UI tweaks
  • Loading branch information
yktoo committed May 14, 2020
1 parent bab9fa0 commit c3ff0cc
Show file tree
Hide file tree
Showing 4 changed files with 391 additions and 127 deletions.
6 changes: 5 additions & 1 deletion internal/config/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"sort"
)

// MPD's track attribute identifiers
// MPD's track attribute identifiers. These must precisely match the queueListStore's columns declared in player.glade
const (
MTAttrArtist = iota
MTAttrArtistSort
Expand All @@ -46,6 +46,10 @@ const (
MTAttrGrouping
MTAttrComment
MTAttrLabel
// List store's "artificial" columns used for rendering
QueueColumnFontWeight
QueueColumnBgColor
QueueColumnVisible
)

// MpdTrackAttribute describes an MPD's track attribute
Expand Down
36 changes: 36 additions & 0 deletions internal/player/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ func (b *Builder) getListBox(name string) *gtk.ListBox {
return result
}

// getListStore finds and returns a list box by its name
func (b *Builder) getListStore(name string) *gtk.ListStore {
result, ok := b.get(name).(*gtk.ListStore)
if !ok {
log.Fatal(errors.Errorf("%v is not a gtk.ListStore", name))
}
return result
}

// getMenu finds and returns a menu by its name
func (b *Builder) getMenu(name string) *gtk.Menu {
result, ok := b.get(name).(*gtk.Menu)
Expand Down Expand Up @@ -173,6 +182,24 @@ func (b *Builder) getScale(name string) *gtk.Scale {
return result
}

// getSearchBar finds and returns a search bar by its name
func (b *Builder) getSearchBar(name string) *gtk.SearchBar {
result, ok := b.get(name).(*gtk.SearchBar)
if !ok {
log.Fatal(errors.Errorf("%v is not a gtk.SearchBar", name))
}
return result
}

// getSearchEntry finds and returns a search entry by its name
func (b *Builder) getSearchEntry(name string) *gtk.SearchEntry {
result, ok := b.get(name).(*gtk.SearchEntry)
if !ok {
log.Fatal(errors.Errorf("%v is not a gtk.SearchEntry", name))
}
return result
}

// getShortcutsWindow finds and returns a shortcuts window by its name
func (b *Builder) getShortcutsWindow(name string) *gtk.ShortcutsWindow {
result, ok := b.get(name).(*gtk.ShortcutsWindow)
Expand Down Expand Up @@ -227,6 +254,15 @@ func (b *Builder) getToolButton(name string) *gtk.ToolButton {
return result
}

// getTreeModelFilter finds and returns a tree model filter by its name
func (b *Builder) getTreeModelFilter(name string) *gtk.TreeModelFilter {
result, ok := b.get(name).(*gtk.TreeModelFilter)
if !ok {
log.Fatal(errors.Errorf("%v is not a gtk.TreeModelFilter", name))
}
return result
}

// getTreeView finds and returns a tree view by its name
func (b *Builder) getTreeView(name string) *gtk.TreeView {
result, ok := b.get(name).(*gtk.TreeView)
Expand Down
Loading

0 comments on commit c3ff0cc

Please sign in to comment.