1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-11 05:55:57 +00:00
Read HISTORY.md


Former-commit-id: 82df2d266055818ffafe0ba66b58cf4ed9089922
This commit is contained in:
kataras
2017-06-07 07:20:53 +03:00
parent 1bea8f5803
commit 6282a71a6f
29 changed files with 309 additions and 3362 deletions

View File

@@ -1,47 +0,0 @@
// +build !linux
// Copyright 2017 Gerasimos Maropoulos, ΓΜ. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package host
import (
"context"
"time"
"github.com/kataras/iris/core/gui"
)
// ShowTrayTask is a supervisor's built'n task which shows
// the iris tray icon to the taskbar (cross-platform).
//
// It's responsible for the server's status button.
func ShowTrayTask(version string, shutdownTimeout time.Duration) TaskRunnerFunc {
return func(proc TaskProcess) {
t := gui.Tray
// set the label "Version" to the framework's current Version.
t.SetVersion(version)
// active the status button(online/offline).
t.OnServerStatusChange(
// set the first callback (pressed when unchecked).
func() {
go proc.Host().Serve()
},
// set the second call back (pressed when checked, default status with its label setted to :"Offline".
func() {
// when server is shutting down it will send an "http closed" error ,
// that DeferFlow stops from returning that error and exiting the app
// postpone the execution flow, the interrupt signal will restore the flow
// when ctrl/cmd+C pressed.
proc.Host().DeferFlow()
ctx, cancel := context.WithTimeout(context.TODO(), shutdownTimeout)
defer cancel()
proc.Host().Shutdown(ctx)
})
// render the tray icon and block this scheduled task(goroutine.
t.Show()
}
}

View File

@@ -1,28 +0,0 @@
// +build linux
// Copyright 2017 Gerasimos Maropoulos, ΓΜ. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package host
import (
"os"
"time"
)
// ShowTrayTask is a supervisor's built'n task which shows
// the iris tray icon to the taskbar (cross-platform).
//
// It's responsible for the server's status button.
func ShowTrayTask(version string, shutdownTimeout time.Duration) TaskRunnerFunc {
return func(proc TaskProcess) {
os.Stdout.WriteString("Tray icon is not enabled by-default for linux systems,\nyou have to install a dependency first and re-get the Iris pgk:\n")
os.Stdout.WriteString("$ sudo apt-get install libgtk-3-dev libappindicator3-dev\n")
os.Stdout.WriteString("$ go get -u github.com/kataras/iris\n")
// manually:
// os.Stdout.WriteString("remove $GOPATH/src/github.com/kataras/iris/core/host/task_gui_tray_linux.go\n")
// os.Stdout.WriteString("edit $GOPATH/src/github.com/kataras/iris/core/host/task_gui_tray.go and remove the // +build !linux\n")
// os.Stdout.WriteString("edit $GOPATH/src/github.com/kataras/iris/core/gui/tray.go and remove the // +build !linux\n")
}
}