Пример #1
0
// NewApplet creates a new applet instance.
//
func NewApplet(base cdtype.AppBase, events *cdtype.Events) cdtype.AppInstance {
	app := &Applet{AppBase: base}
	app.SetConfig(&app.conf)

	// Events.
	events.OnClick = app.onClick
	events.OnMiddleClick = app.onMiddleClick
	events.OnScroll = app.onScroll
	events.OnBuildMenu = app.onBuildMenu
	events.OnSubMiddleClick = app.onSubMiddleClick
	events.OnSubScroll = app.onSubScroll
	events.OnSubBuildMenu = app.onSubBuildMenu

	// Pulseaudio service.
	log = app.Log()
	var e error
	app.pulse, e = NewAppPulse(app)
	if log.Err(e, "pulseaudio dbus") {
		return nil
	}
	return app
}