Exemple #1
0
func init() {
	dirShareData = globals.DirShareData()

	iconCore = globals.FileCairoDockIcon()

	AppletInfo = func(log cdtype.Logger, name string) (dir, icon string) {
		mod := gldi.ModuleGet(name)
		if mod == nil {
			return "", ""
		}
		vc := mod.VisitCard()
		return vc.GetShareDataDir(), vc.GetIconFilePath()
	}

	AppletRestart = func(name string) {
		mod := gldi.ModuleGet(name)
		if mod == nil {
			return
		}
		for _, mi := range mod.InstancesList() {
			gldi.ObjectDelete(mi)
		}
		mod.Activate()
	}

	CloseGui = backendgui.CloseGui

}
Exemple #2
0
// Handbook wraps a dock module visit card as Handbooker for config data source.
//
func (Data) Handbook(name string) datatype.Handbooker {
	mod := gldi.ModuleGet(name)
	if mod == nil {
		return nil
	}
	return &datatype.HandbookDescSplit{Handbooker: mod.VisitCard()}
}
Exemple #3
0
func (o *AppManager) registerOneApplet(pack *packages.AppletPackage) {
	if gldi.ModuleGet(pack.DisplayedName) != nil {
		o.log.Debug("register applet, already known = dropped", pack.DisplayedName)
		return
	}

	vc := gldi.NewVisitCardFromPackage(pack)
	o.visitCards = append(o.visitCards, vc)
	c := C.newModule(C.gpointer(vc.Ptr))
	mod := gldi.NewModuleFromNative(unsafe.Pointer(c))
	o.log.Debug("register applet", mod != nil, vc.GetName(), vc.GetShareDataDir())
}
Exemple #4
0
// Install downloads and extract an external archive to package dir.
//
func (v *AppletDownload) Install(options string) error {
	// Using the "drop data signal" trick to ask the Dbus applet to work for us.
	// Only way I found for now to interact with it and let it know it will have
	// a new applet to handle. As a bonus, it also activate the applet, which
	// will toggle the activated button with the UpdateModuleState signal.
	url := packages.DistantURL + v.SrvTag + "/" + v.DisplayedName + "/" + v.DisplayedName + ".tar.gz"
	gldi.EmitSignalDropData(globals.Maindock().Container(), url, nil, 0)

	v.app = gldi.ModuleGet(v.DisplayedName)
	if v.app == nil {
		return errors.New("install failed: v.DisplayedName")
	}

	externalUserDir := globals.DirDockData(cdglobal.AppletsDirName)
	v.SetInstalled(externalUserDir)
	return nil

	// return v.AppletPackage.Install(options)
}