summaryrefslogtreecommitdiff
path: root/structs.go
blob: 8c54a0b110b14da5fb81f74afe9bbf5179fd2982 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0

package main

import (
	sync "sync"
	"time"

	"go.wit.com/dev/alexflint/arg"
	"go.wit.com/gui"
	"go.wit.com/lib/fhelp"
	"go.wit.com/lib/gadgets"
	"go.wit.com/lib/protobuf/argvpb"
	"go.wit.com/lib/protobuf/forgepb"
)

var me *gusconf

// this app's variables
type gusconf struct {
	argv          *argvpb.Argv      // more experiments for bash handling
	pp            *arg.Parser       // for parsing the command line args.  Yay to alexf lint!
	myGui         *fhelp.GuiPrep    // for initializing the GUI toolkits
	forge         *forgepb.Forge    // your customized repo preferences and settings
	portmaps      *Portmaps         // the portmap window
	portwin       *stdTableWin      // the portwin window
	events        *Events           // the event log
	eventswin     *stdEventTableWin // the event window
	eventsChanged bool              // are there new events?
	urlbase       string            // the dns name for the zookeeper
	hostname      string            // my hostname
	pollDelay     time.Duration     // how often to report our status
	dog           *time.Ticker      // the watchdog timer
	failcount     int               // how many times we've failed to contact the zookeeper
	failcountmax  int               // after this, exit and let systemd restart the daemon
}

type stdTableWin struct {
	sync.Mutex
	win    *gadgets.GenericWindow // the machines gui window
	box    *gui.Node              // the machines gui parent box widget
	TB     *PortmapsTable         // the gui table buffer
	update bool                   // if the window should be updated
}

func (w *stdTableWin) Toggle() {
	if w == nil {
		return
	}
	if w.win == nil {
		return
	}
	w.win.Toggle()
}

type stdEventTableWin struct {
	sync.Mutex
	win    *gadgets.GenericWindow // the machines gui window
	box    *gui.Node              // the machines gui parent box widget
	TB     *EventsTable           // the gui table buffer
	update bool                   // if the window should be updated
}

func (w *stdEventTableWin) Toggle() {
	if w == nil {
		return
	}
	if w.win == nil {
		return
	}
	w.win.Toggle()
}