summaryrefslogtreecommitdiff
path: root/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin.go')
-rw-r--r--plugin.go37
1 files changed, 22 insertions, 15 deletions
diff --git a/plugin.go b/plugin.go
index 223d4e5..774b85d 100644
--- a/plugin.go
+++ b/plugin.go
@@ -28,6 +28,12 @@ func action(a widget.Action) {
me.treeRoot = n
}
addWidget(n)
+ w = n.TK.(*guiWidget)
+ if w.enable {
+ // don't change the color
+ } else {
+ w.setColor(&colorDisabled)
+ }
} else {
// this is done to protect the plugin being 'refreshed' with the
// widget binary tree. TODO: find a way to keep them in sync
@@ -35,10 +41,19 @@ func action(a widget.Action) {
a.WidgetId, a.ActionType, a.WidgetType, a.ProgName)
}
case widget.Show:
- if widget.GetBool(a.Value) {
- w.showView()
+ if w.Visible() {
+ // widget was already shown
} else {
- w.hideWidgets()
+ log.Log(INFO, "Setting Visible to true", a.ProgName)
+ w.SetVisible(true)
+ }
+ w.showView()
+ case widget.Hide:
+ if w.Visible() {
+ log.Log(INFO, "Setting Visible to false", a.ProgName)
+ w.SetVisible(false)
+ } else {
+ // widget was already hidden
}
case widget.Set:
if a.WidgetType == widget.Flag {
@@ -62,19 +77,11 @@ func action(a widget.Action) {
log.Log(NOW, "attempting to close the plugin and release stdout and stderr")
standardExit()
case widget.Enable:
- if w.Visible() {
- // widget was already shown
- } else {
- log.Log(INFO, "Setting Visible to true", a.ProgName)
- w.SetVisible(true)
- }
+ w.enable = true
+ w.enableColor()
case widget.Disable:
- if w.Visible() {
- log.Log(INFO, "Setting Visible to false", a.ProgName)
- w.SetVisible(false)
- } else {
- // widget was already hidden
- }
+ w.enable = false
+ w.disableColor()
case widget.Delete:
if w == nil {
return