Skip to content

Commit

Permalink
Merge pull request #5510 from Jacalz/binding-func-scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz authored Feb 6, 2025
2 parents af19611 + da0856d commit 71764a2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 87 deletions.
6 changes: 3 additions & 3 deletions data/binding/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ type base struct {

// AddListener allows a data listener to be informed of changes to this item.
func (b *base) AddListener(l DataListener) {
queueItem(func() {
fyne.Do(func() {
b.listeners = append(b.listeners, l)
l.DataChanged()
})
}

// RemoveListener should be called if the listener is no longer interested in being informed of data change events.
func (b *base) RemoveListener(l DataListener) {
queueItem(func() {
fyne.Do(func() {
for i, listener := range b.listeners {
if listener == l {
// Delete without preserving order:
Expand All @@ -87,7 +87,7 @@ func (b *base) RemoveListener(l DataListener) {
}

func (b *base) trigger() {
queueItem(func() {
fyne.Do(func() {
for _, listen := range b.listeners {
listen.DataChanged()
}
Expand Down
8 changes: 4 additions & 4 deletions data/binding/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func (s *toStringFrom[T]) Set(str string) error {
return err
}

queueItem(s.DataChanged)
s.trigger()
return nil
}

Expand Down Expand Up @@ -324,7 +324,7 @@ func (s *fromStringTo[T]) Set(val T) error {
return err
}

queueItem(s.DataChanged)
s.trigger()
return nil
}

Expand Down Expand Up @@ -367,7 +367,7 @@ func (s *toInt[T]) Set(v int) error {
return err
}

queueItem(s.DataChanged)
s.trigger()
return nil
}

Expand Down Expand Up @@ -408,7 +408,7 @@ func (s *fromIntTo[T]) Set(val T) error {
return err
}

queueItem(s.DataChanged)
s.trigger()
return nil
}

Expand Down
15 changes: 0 additions & 15 deletions data/binding/queue.go

This file was deleted.

65 changes: 0 additions & 65 deletions data/binding/queue_test.go

This file was deleted.

0 comments on commit 71764a2

Please sign in to comment.