Skip to content

Commit

Permalink
Allow adding/replacing of all tracks in Library by Files context menu (
Browse files Browse the repository at this point in the history
…resolves #69)
  • Loading branch information
yktoo committed Dec 21, 2022
1 parent c55374f commit f482541
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/player/libpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (e *FilesystemLibElement) IsFolder() bool {
}

func (e *FilesystemLibElement) IsPlayable() bool {
return false
return true
}

func (e *FilesystemLibElement) Prefix() string {
Expand Down
15 changes: 8 additions & 7 deletions internal/player/main-window.go
Original file line number Diff line number Diff line change
Expand Up @@ -2018,18 +2018,19 @@ func (w *MainWindow) updateLibrary() {
element := element // Make an in-loop copy for closures
label := element.Label()
markup := false

// Add replace/append buttons if needed
var buttons []gtk.IWidget
if element.IsPlayable() {

// Make root elements bold
if lastElement == nil {
label = "<b>" + label + "</b>"
markup = true

// For non-root elements, add replace/append buttons if needed
} else if element.IsPlayable() {
buttons = []gtk.IWidget{
util.NewButton("", glib.Local("Append to the queue"), "", "ymuse-add-symbolic", func() { w.queueLibraryElement(tbFalse, element) }),
util.NewButton("", glib.Local("Replace the queue"), "", "ymuse-replace-queue-symbolic", func() { w.queueLibraryElement(tbTrue, element) }),
}
} else {
// Make non-playable (root) elements bold
label = "<b>" + label + "</b>"
markup = true
}

// Add a new list box row
Expand Down

0 comments on commit f482541

Please sign in to comment.