detached e2241c5

refactor: use typed *glib.Error in signal callbacks (puregotk v0.2.2)

Bump puregotk to v0.2.2 and puregotk-webkit to v0.0.16.
Signal callbacks now receive *glib.Error instead of raw uintptr,
giving us actual error messages in load-failed and download-failed logs.
commit
e2241c565e09029d95e511d90963f32898c05e78
author
brice · · 2026-03-27 20:48 UTC
parent
26fd7de
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
4 files · +11 -11
M go.mod +2 -2
@@ -4,8 +4,8 @@ go 1.26.1
44
55 require (
66 github.com/bnema/purego-sqlite v0.1.1
7- github.com/bnema/puregotk v0.2.1
8- github.com/bnema/puregotk-webkit v0.0.15
7+ github.com/bnema/puregotk v0.2.2
8+ github.com/bnema/puregotk-webkit v0.0.16
99 github.com/charmbracelet/bubbles v1.0.0
1010 github.com/charmbracelet/bubbletea v1.3.10
1111 github.com/charmbracelet/lipgloss v1.1.0
@@ -4,8 +4,8 @@ go 1.26.1
4 4
5 require (5 require (
6 github.com/bnema/purego-sqlite v0.1.16 github.com/bnema/purego-sqlite v0.1.1
7- github.com/bnema/puregotk v0.2.17+ github.com/bnema/puregotk v0.2.2
8- github.com/bnema/puregotk-webkit v0.0.158+ github.com/bnema/puregotk-webkit v0.0.16
9 github.com/charmbracelet/bubbles v1.0.09 github.com/charmbracelet/bubbles v1.0.0
10 github.com/charmbracelet/bubbletea v1.3.1010 github.com/charmbracelet/bubbletea v1.3.10
11 github.com/charmbracelet/lipgloss v1.1.011 github.com/charmbracelet/lipgloss v1.1.0
M go.sum +4 -4 generated file: collapsed
M internal/infrastructure/webkit/download_handler.go +3 -2
@@ -10,6 +10,7 @@ import (
1010 downloadutil "github.com/bnema/dumber/internal/domain/download"
1111 "github.com/bnema/dumber/internal/logging"
1212 "github.com/bnema/puregotk-webkit/webkit"
13+ "github.com/bnema/puregotk/v4/glib"
1314 )
1415
1516 const (
@@ -114,7 +115,7 @@ func (h *DownloadHandler) HandleDownload(ctx context.Context, download *webkit.D
114115 download.ConnectDecideDestination(&decideDestCb)
115116
116117 // Handle failed signal.
117- failedCb := func(d webkit.Download, _ uintptr) {
118+ failedCb := func(d webkit.Download, gerr *glib.Error) {
118119 state.mu.Lock()
119120 state.failed = true
120121 state.mu.Unlock()
@@ -123,7 +124,7 @@ func (h *DownloadHandler) HandleDownload(ctx context.Context, download *webkit.D
123124 filename := downloadutil.ExtractFilenameFromDestination(dest)
124125
125126 // Create error for the failed download.
126- downloadErr := fmt.Errorf("download failed: %s", filename)
127+ downloadErr := fmt.Errorf("download failed: %s: %s", filename, gerr.MessageGo())
127128
128129 if eventHandler != nil {
129130 eventHandler.OnDownloadEvent(ctx, port.DownloadEvent{
@@ -10,6 +10,7 @@ import (
10 downloadutil "github.com/bnema/dumber/internal/domain/download"10 downloadutil "github.com/bnema/dumber/internal/domain/download"
11 "github.com/bnema/dumber/internal/logging"11 "github.com/bnema/dumber/internal/logging"
12 "github.com/bnema/puregotk-webkit/webkit"12 "github.com/bnema/puregotk-webkit/webkit"
13+ "github.com/bnema/puregotk/v4/glib"
13 )14 )
14 15
15 const (16 const (
@@ -114,7 +115,7 @@ func (h *DownloadHandler) HandleDownload(ctx context.Context, download *webkit.D
114 download.ConnectDecideDestination(&decideDestCb)115 download.ConnectDecideDestination(&decideDestCb)
115 116
116 // Handle failed signal.117 // Handle failed signal.
117- failedCb := func(d webkit.Download, _ uintptr) {118+ failedCb := func(d webkit.Download, gerr *glib.Error) {
118 state.mu.Lock()119 state.mu.Lock()
119 state.failed = true120 state.failed = true
120 state.mu.Unlock()121 state.mu.Unlock()
@@ -123,7 +124,7 @@ func (h *DownloadHandler) HandleDownload(ctx context.Context, download *webkit.D
123 filename := downloadutil.ExtractFilenameFromDestination(dest)124 filename := downloadutil.ExtractFilenameFromDestination(dest)
124 125
125 // Create error for the failed download.126 // Create error for the failed download.
126- downloadErr := fmt.Errorf("download failed: %s", filename)127+ downloadErr := fmt.Errorf("download failed: %s: %s", filename, gerr.MessageGo())
127 128
128 if eventHandler != nil {129 if eventHandler != nil {
129 eventHandler.OnDownloadEvent(ctx, port.DownloadEvent{130 eventHandler.OnDownloadEvent(ctx, port.DownloadEvent{
M internal/infrastructure/webkit/webview.go +2 -3
@@ -467,13 +467,12 @@ func (wv *WebView) connectLoadChangedSignal() {
467467 }
468468
469469 func (wv *WebView) connectLoadFailedSignal() {
470- loadFailedCb := func(_ webkit.WebView, event webkit.LoadEvent, failingURI string, _ uintptr) bool {
471- // Note: error details are a raw uintptr (GError*) — see bnema/puregotk#6
472- // for tracking proper *glib.Error conversion in signal callbacks.
470+ loadFailedCb := func(_ webkit.WebView, event webkit.LoadEvent, failingURI string, gerr *glib.Error) bool {
473471 wv.logger.Warn().
474472 Str("component", "webview").
475473 Str("uri", failingURI).
476474 Int("load_event", int(event)).
475+ Str("error", gerr.MessageGo()).
477476 Msg("load failed")
478477 return false
479478 }
@@ -467,13 +467,12 @@ func (wv *WebView) connectLoadChangedSignal() {
467 }467 }
468 468
469 func (wv *WebView) connectLoadFailedSignal() {469 func (wv *WebView) connectLoadFailedSignal() {
470- loadFailedCb := func(_ webkit.WebView, event webkit.LoadEvent, failingURI string, _ uintptr) bool {470+ loadFailedCb := func(_ webkit.WebView, event webkit.LoadEvent, failingURI string, gerr *glib.Error) bool {
471- // Note: error details are a raw uintptr (GError*) — see bnema/puregotk#6
472- // for tracking proper *glib.Error conversion in signal callbacks.
473 wv.logger.Warn().471 wv.logger.Warn().
474 Str("component", "webview").472 Str("component", "webview").
475 Str("uri", failingURI).473 Str("uri", failingURI).
476 Int("load_event", int(event)).474 Int("load_event", int(event)).
475+ Str("error", gerr.MessageGo()).
477 Msg("load failed")476 Msg("load failed")
478 return false477 return false
479 }478 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close