Skip to content

Commit 30c7623

Browse files
committed
gofmt
1 parent 400440f commit 30c7623

File tree

7 files changed

+195
-200
lines changed

7 files changed

+195
-200
lines changed

example/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"bufio"
55
"os"
6+
67
"github.com/xilp/systray"
78
)
89

test/sysapp.go

+60-59
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,72 @@
11
package main
22

33
import (
4-
"flag"
5-
"github.com/AnimationMentor/systray"
6-
"github.com/golang/glog"
7-
"os"
8-
"path"
9-
"path/filepath"
10-
"runtime"
4+
"flag"
5+
"os"
6+
"path"
7+
"path/filepath"
8+
"runtime"
9+
10+
"github.com/AnimationMentor/systray"
11+
"github.com/golang/glog"
1112
)
1213

1314
func main() {
14-
//// Let us tap into the glog flags (like -alsologtostderr=true -log_dir=".")
15-
//
16-
17-
var iconDirFlag = flag.String("icon_path", ".", "Path to icons files")
18-
var iconNameFlag = flag.String("icon_name", "sysapp.ico", "Name of icon to show")
19-
flag.Parse()
15+
//// Let us tap into the glog flags (like -alsologtostderr=true -log_dir=".")
16+
//
17+
18+
var iconDirFlag = flag.String("icon_path", ".", "Path to icons files")
19+
var iconNameFlag = flag.String("icon_name", "sysapp.ico", "Name of icon to show")
20+
flag.Parse()
2021

21-
var iconDir string
22-
if filepath.IsAbs(*iconDirFlag) {
23-
iconDir = *iconDirFlag
24-
} else {
25-
// Default our icon path to be relative to the exe
26-
thisExe := os.Args[0]
27-
thisDir := path.Dir(thisExe)
28-
iconDir = path.Join(thisDir, *iconDirFlag)
29-
}
22+
var iconDir string
23+
if filepath.IsAbs(*iconDirFlag) {
24+
iconDir = *iconDirFlag
25+
} else {
26+
// Default our icon path to be relative to the exe
27+
thisExe := os.Args[0]
28+
thisDir := path.Dir(thisExe)
29+
iconDir = path.Join(thisDir, *iconDirFlag)
30+
}
3031

31-
tray := systray.New(iconDir, ".")
32+
tray := systray.New(iconDir, ".")
3233

33-
//// Set some test menu items
34-
items := make([]systray.CallbackInfo, 0, 10)
35-
items = append(items, systray.CallbackInfo {
36-
ItemName : "Test Menu 1",
37-
Callback : func() {
38-
println("Got menu 1")
39-
},
40-
})
41-
items = append(items, systray.CallbackInfo {
42-
ItemName : "Test Menu 2",
43-
Callback : func() {
44-
println("Got menu 2")
45-
},
46-
})
47-
items = append(items, systray.CallbackInfo {
48-
ItemName : "Disabled item",
49-
Callback : func() {
50-
println("Disabled!!!!")
51-
},
52-
Disabled : true,
53-
})
54-
items = append(items, systray.CallbackInfo {
55-
ItemName : "Quit",
56-
Callback : func() {
57-
println("Exiting...")
58-
os.Exit(0)
59-
},
60-
})
61-
tray.AddSystrayMenuItems(items)
34+
//// Set some test menu items
35+
items := make([]systray.CallbackInfo, 0, 10)
36+
items = append(items, systray.CallbackInfo{
37+
ItemName: "Test Menu 1",
38+
Callback: func() {
39+
println("Got menu 1")
40+
},
41+
})
42+
items = append(items, systray.CallbackInfo{
43+
ItemName: "Test Menu 2",
44+
Callback: func() {
45+
println("Got menu 2")
46+
},
47+
})
48+
items = append(items, systray.CallbackInfo{
49+
ItemName: "Disabled item",
50+
Callback: func() {
51+
println("Disabled!!!!")
52+
},
53+
Disabled: true,
54+
})
55+
items = append(items, systray.CallbackInfo{
56+
ItemName: "Quit",
57+
Callback: func() {
58+
println("Exiting...")
59+
os.Exit(0)
60+
},
61+
})
62+
tray.AddSystrayMenuItems(items)
6263

63-
err := tray.Show(*iconNameFlag, "Sysapp Test")
64-
if err != nil {
65-
glog.Infoln(err.Error())
66-
}
64+
err := tray.Show(*iconNameFlag, "Sysapp Test")
65+
if err != nil {
66+
glog.Infoln(err.Error())
67+
}
6768

68-
runtime.LockOSThread()
69-
tray.Run()
70-
runtime.UnlockOSThread()
69+
runtime.LockOSThread()
70+
tray.Run()
71+
runtime.UnlockOSThread()
7172
}

tray.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
package systray
22

33
func New(iconPath string, clientPath string) *Systray {
4-
return &Systray{_NewSystray(iconPath, clientPath)}
4+
return &Systray{_NewSystray(iconPath, clientPath)}
55
}
66

77
type Systray struct {
8-
*_Systray
8+
*_Systray
99
}
1010

11-
1211
type CallbackInfo struct {
13-
ItemName string
14-
Callback func()
15-
Disabled bool
16-
Checked bool
12+
ItemName string
13+
Callback func()
14+
Disabled bool
15+
Checked bool
1716
}
18-

0 commit comments

Comments
 (0)