summaryrefslogtreecommitdiff
path: root/new.go
blob: 22a2e59cae7a421507376a58c5544642016c9d63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// This creates a simple hello world window
package linuxstatus

import (
	"go.wit.com/log"

	"go.wit.com/lib/gadgets"
)

func New() *LinuxStatus {
	if me != nil {
		log.Log(WARN, "You have done New() twice. You can only do this once")
		return me
	}
	me = &LinuxStatus{
		hidden: true,
		ready:  false,
	}
	me.ifmap = make(map[int]*IFtype)
	me.ipmap = make(map[string]*IPtype)

	return me
}

func (ls *LinuxStatus) InitWindow() {
	if !ls.Initialized() {
		log.Log(WARN, "not initalized yet (no parent for the window?)")
		return
	}
	if ls.window != nil {
		log.Log(WARN, "You already have a window")
		ls.ready = true
		return
	}

	log.Log(WARN, "Creating the Window")
	ls.window = gadgets.NewBasicWindow(ls.parent, "Linux OS Details")
	ls.ready = true
}