adapter

package
v0.26.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package adapter provides UI-layer adapters that bridge domain services to GTK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FaviconAdapter

type FaviconAdapter struct {
	// contains filtered or unexported fields
}

FaviconAdapter bridges the domain FaviconService to GTK by providing gdk.Texture conversion and WebKit FaviconDatabase integration.

func NewFaviconAdapter

func NewFaviconAdapter(service *favicon.Service, faviconDB *webkit.FaviconDatabase) *FaviconAdapter

NewFaviconAdapter creates a new FaviconAdapter. The faviconDB can be nil if WebKit favicon database is not available.

func (*FaviconAdapter) Clear

func (a *FaviconAdapter) Clear()

Clear removes all entries from the texture cache.

func (*FaviconAdapter) Close

func (a *FaviconAdapter) Close()

Close shuts down the adapter and underlying service.

func (*FaviconAdapter) GetOrFetch

func (a *FaviconAdapter) GetOrFetch(ctx context.Context, pageURL string, callback func(*gdk.Texture))

GetOrFetch retrieves a favicon texture, checking caches and fetching if needed. The callback is invoked on the GTK main thread with the texture (or nil). For internal dumb:// URLs, returns the app logo texture.

func (*FaviconAdapter) GetTexture

func (a *FaviconAdapter) GetTexture(domain string) *gdk.Texture

GetTexture returns a cached texture for the domain, or nil if not cached.

func (*FaviconAdapter) GetTextureByURL

func (a *FaviconAdapter) GetTextureByURL(pageURL string) *gdk.Texture

GetTextureByURL returns a cached texture by extracting domain from URL. For internal dumb:// URLs, returns the app logo texture.

func (*FaviconAdapter) PreloadFromCache

func (a *FaviconAdapter) PreloadFromCache(pageURL string) *gdk.Texture

PreloadFromCache attempts to load a favicon from cache without fetching. Returns the texture if found in memory or disk cache, nil otherwise.

func (*FaviconAdapter) Service

func (a *FaviconAdapter) Service() *favicon.Service

Service returns the underlying favicon service. Used by CLI components that need disk paths.

func (*FaviconAdapter) Size

func (a *FaviconAdapter) Size() int

Size returns the number of entries in the texture cache.

func (*FaviconAdapter) StoreFromWebKit

func (a *FaviconAdapter) StoreFromWebKit(ctx context.Context, pageURL string, texture *gdk.Texture)

StoreFromWebKit stores a favicon texture received from WebKit signals. Also ensures the favicon is persisted to disk cache via the service.

func (*FaviconAdapter) StoreFromWebKitWithOrigin

func (a *FaviconAdapter) StoreFromWebKitWithOrigin(
	ctx context.Context, currentURL, originURL string, texture *gdk.Texture,
)

StoreFromWebKitWithOrigin stores a favicon for both current URL and original URL. Used when redirects occur (e.g., example.com → www.example.com).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL