-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace channel list TreeView with ListView
This migrates gtkcord4's channels list from the deprecated GtkTreeView API to the newer GtkListView API, which looks far better and is much less buggy. Fixes #208. Fixes #196.
- Loading branch information
1 parent
a31ea96
commit 2f8a342
Showing
20 changed files
with
1,241 additions
and
1,210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package gtkcord | ||
|
||
import ( | ||
"github.com/diamondburned/arikawa/v3/utils/handler" | ||
"github.com/diamondburned/gotk4/pkg/core/glib" | ||
) | ||
|
||
// MainThreadHandler wraps a [handler.Handler] to run all events on the main | ||
// thread. | ||
type MainThreadHandler struct { | ||
h *handler.Handler | ||
} | ||
|
||
// NewMainThreadHandler creates a new MainThreadHandler. | ||
func NewMainThreadHandler(h *handler.Handler) *MainThreadHandler { | ||
hh := &MainThreadHandler{h: handler.New()} | ||
h.AddSyncHandler(func(ev any) { | ||
glib.IdleAddPriority(glib.PriorityDefault, func() { | ||
hh.h.Call(ev) | ||
}) | ||
}) | ||
return hh | ||
} | ||
|
||
// AddHandler adds a handler to the handler.Handler. | ||
// The given handler will be called on the main thread. | ||
// The returned function will remove the handler. | ||
func (h *MainThreadHandler) AddHandler(handler any) func() { | ||
return h.h.AddSyncHandler(handler) | ||
} | ||
|
||
// AddSyncHandler is the same as [AddHandler]. | ||
// It exists for compatibility. | ||
func (h *MainThreadHandler) AddSyncHandler(handler any) func() { | ||
return h.h.AddSyncHandler(handler) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
internal/icons/scalable/actions/channel-broadcast-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.