Beispiel #1
0
// RemoveSubIcon only need the ID to remove the SubIcon. See cdtype.AppIcon.
//
func (o *AppGldi) RemoveSubIcon(id string) error {
	subicon, ok := o.icons[id]
	if !ok && id != "any" {
		return errors.New("RemoveSubIcon Icon missing: " + id)
	}

	if ok { // should allow the user to use the "any" key anyway.
		delete(o.icons, id)

		gldi.ObjectUnref(subicon.Icon)
		o.Icon.RemoveSubdockEmpty() // special hack, needs to be confirmed.
		return nil
	}

	o.icons = make(map[string]*IconBase)
	o.mi.RemoveAllIcons()
	return nil
}
Beispiel #2
0
// StopApplet close the applet instance.
//
func (o *AppManager) stopApplet(mi *gldi.ModuleInstance) {
	icon := mi.Icon()
	o.sendApp(icon, "on_stop_module")

	if subdock := icon.GetSubDock(); subdock != nil {
		gldi.ObjectUnref(subdock)
		// mi.Icon().pSubDock = nil
	}

	icon.RemoveDataRenderer()

	desklet := mi.Desklet()
	if desklet != nil && desklet.HasIcons() {
		desklet.RemoveIcons()
	}

	o.log.Debug("Applet stopped", mi.Module().VisitCard().GetName())

	delete(o.actives, unsafe.Pointer(icon.ToNative()))
}
Beispiel #3
0
func removeDialog() {
	if dialogPtr != nil { // Only one dialog allowed. Triggered when opening a dialog on another icon.
		gldi.ObjectUnref(dialogPtr)
		dialogPtr = nil
	}
}