gdbus

package
v0.0.5-0...-0379fef Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VariantTuple

func VariantTuple(v *glib.Variant, n int) []*glib.Variant

Types

type Action

type Action struct {
	ID       string
	Label    string
	Callback func() // called in goroutine
}

type BusType

type BusType int
const (
	BUS_TYPE_STARTER BusType = C.G_BUS_TYPE_STARTER
	BUS_TYPE_NONE    BusType = C.G_BUS_TYPE_NONE
	BUS_TYPE_SYSTEM  BusType = C.G_BUS_TYPE_SYSTEM
	BUS_TYPE_SESSION BusType = C.G_BUS_TYPE_SESSION
)

type CallFlags

type CallFlags int
const (
	DBUS_CALL_FLAGS_NONE                            CallFlags = C.G_DBUS_CALL_FLAGS_NONE
	DBUS_CALL_FLAGS_NO_AUTO_START                   CallFlags = C.G_DBUS_CALL_FLAGS_NO_AUTO_START
	DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION CallFlags = C.G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION
)

type Connection

type Connection struct {
	Native *C.GDBusConnection
}

func FromApplication

func FromApplication(app *glib.Application) *Connection

func GetSessionBusSync

func GetSessionBusSync() (*Connection, error)

func (*Connection) CallSync

func (c *Connection) CallSync(
	busName,
	objectPath,
	interfaceName,
	methodName string,
	parameters glib.IVariant,
	replyType *glib.VariantType,
	callFlags CallFlags,
	timeoutMsec int,
) (*glib.Variant, error)

func (*Connection) SignalSubscribe

func (c *Connection) SignalSubscribe(
	sender,
	interfaceName,
	member,
	objectPath,
	arg0 string,
	flags SignalFlags,
	callback SignalCallback,
) uint

func (*Connection) SignalUnsubscribe

func (c *Connection) SignalUnsubscribe(id uint)

type MPRISWatcher

type MPRISWatcher struct {
	*Connection

	OnMetadata       func(m Metadata, playing bool)
	OnPlaybackStatus func(m Metadata, playing bool)
	// contains filtered or unexported fields
}

func NewMPRISWatcher

func NewMPRISWatcher(c *Connection) *MPRISWatcher

func (*MPRISWatcher) IsEnabled

func (w *MPRISWatcher) IsEnabled() bool

func (*MPRISWatcher) SetEnabled

func (w *MPRISWatcher) SetEnabled(enabled bool)

type Metadata

type Metadata struct {
	Title   string
	Artists []string
	Album   string
}

Metadata maps some fields from https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata/#index5h3

type Notification

type Notification struct {
	AppName string
	AppIcon string
	Title   string
	Message string
	Actions []*Action
	Expiry  int32
}

type Notifier

type Notifier struct {
	*Connection
	// contains filtered or unexported fields
}

func NewNotifier

func NewNotifier(c *Connection) *Notifier

func (*Notifier) Notify

func (c *Notifier) Notify(n Notification) (uint32, error)

type SignalCallback

type SignalCallback func(
	conn *Connection,
	senderName, objectPath, interfaceName, signalName string,
	parameters *glib.Variant,
)

type SignalFlags

type SignalFlags int
const (
	DBUS_SIGNAL_FLAGS_NONE                 SignalFlags = C.G_DBUS_SIGNAL_FLAGS_NONE
	DBUS_SIGNAL_FLAGS_NO_MATCH_RULE        SignalFlags = C.G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE
	DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE SignalFlags = C.G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE
	DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH      SignalFlags = C.G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH
)

Jump to

Keyboard shortcuts

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