Urban Terror launch check on shutdown.

Added checking if Urban Terror launched while trying to shut down
URTrator. If yes - we will show error message and won't quit,
until Urban Terror will be dead.
This commit is contained in:
2016-10-06 22:19:03 +05:00
parent e87d51b1e3
commit ceaaf67510
3 changed files with 42 additions and 5 deletions

View File

@@ -11,6 +11,7 @@ package context
import (
// stdlib
"errors"
"fmt"
// local
@@ -43,14 +44,19 @@ type Context struct {
Requester *requester.Requester
}
func (ctx *Context) Close() {
func (ctx *Context) Close() error {
fmt.Println("Closing URTrator...")
launched := ctx.Launcher.CheckForLaunchedUrbanTerror()
if launched != nil {
return errors.New("Urban Terror is launched!")
}
ctx.Cache.FlushServers()
ctx.Database.Close()
// At last, close main window.
gtk.MainQuit()
return nil
}
func (ctx *Context) initializeCache() {