Fixes in mac build script, some gofmt works.
This commit is contained in:
parent
127e1b8ab9
commit
39ac02dfc5
75
README.md
75
README.md
@ -1,29 +1,17 @@
|
|||||||
# URTrator
|
# URTrator
|
||||||
|
|
||||||
[![Join the chat at https://gitter.im/urtrator/Lobby](https://badges.gitter.im/urtrator/Lobby.svg)](https://gitter.im/urtrator/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
||||||
|
|
||||||
Chat on Matrix: #gitter_urtrator=2Flobby:matrix.org (Gitter bridge).
|
|
||||||
|
|
||||||
![Main Window](/doc/screenshots/0.2-main_window.png)
|
![Main Window](/doc/screenshots/0.2-main_window.png)
|
||||||
|
|
||||||
URTrator is a desktop application that should (eventually) replace
|
URTrator is a desktop application that should (eventually) replace Urban Terror's and IRC client interfaces for you, because they're pretty shitty :).
|
||||||
Urban Terror's and IRC client interfaces for you, because they're
|
|
||||||
pretty shitty :).
|
|
||||||
|
|
||||||
*Disclaimer: This software isn't written nor supported (for now) by FrozenSand.
|
*Disclaimer: This software isn't written nor supported (for now) by FrozenSand. All code is a community effort.*
|
||||||
All code is a community effort.*
|
|
||||||
|
|
||||||
Right now it can:
|
Right now it can:
|
||||||
|
|
||||||
* Obtaining list of Urban Terror servers from master server and
|
* Obtaining list of Urban Terror servers from master server and updating information about them.
|
||||||
updating information about them.
|
|
||||||
* Local caching of whole data (in SQLite3 database).
|
* Local caching of whole data (in SQLite3 database).
|
||||||
* Extended Urban Terror launching capabilities (e.g. launching game
|
* Extended Urban Terror launching capabilities (e.g. launching game in another X session).
|
||||||
in another X session).
|
* Supporting of multiple profiles with multiple game versions. When you're launching Urban Terror URTrator will check profile you're trying to use and, if version incompatability found, will not launch the game.
|
||||||
* Supporting of multiple profiles with multiple game versions.
|
|
||||||
When you're launching Urban Terror URTrator will check profile you're
|
|
||||||
trying to use and, if version incompatability found, will not launch
|
|
||||||
the game.
|
|
||||||
* Favorites servers.
|
* Favorites servers.
|
||||||
* Updating single server.
|
* Updating single server.
|
||||||
* Automatically update servers information.
|
* Automatically update servers information.
|
||||||
@ -37,23 +25,20 @@ Planning:
|
|||||||
* Game updating (not from official servers yet, sorry).
|
* Game updating (not from official servers yet, sorry).
|
||||||
* Pickup/matchmaking interfaces.
|
* Pickup/matchmaking interfaces.
|
||||||
* All kinds of notifications.
|
* All kinds of notifications.
|
||||||
* Extended profile editor, so every profile could have own configuration
|
* Extended profile editor, so every profile could have own configuration files, etc.
|
||||||
files, etc.
|
|
||||||
* ...maybe more :)
|
* ...maybe more :)
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
## Precautions
|
## Precautions
|
||||||
|
|
||||||
Due to Go's GC bugs, it is required to use devel version of Go
|
There is no precautions for latest source with Golang 1.11.2 and GTK+2 2.24.32.
|
||||||
compiler!
|
|
||||||
|
|
||||||
## Release
|
## Release
|
||||||
|
|
||||||
You don't need to install anything, thanks to Go's.
|
You don't need to install anything, thanks to Go's. URTrator executable contains everything we need. Just download approriate binary and launch it! :) The only thing is to make sure you have GTK2 and sqlite3 installed.
|
||||||
URTrator executable contains everything we need. Just download
|
|
||||||
approriate binary and launch it! :) The only thing is to make
|
Windows and macOS users will receive full distribution that is ready to be launched OOB, no need to additionally install anything.
|
||||||
sure you have GTK2 and sqlite3 installed.
|
|
||||||
|
|
||||||
## Distro-and-OS specific instructions
|
## Distro-and-OS specific instructions
|
||||||
|
|
||||||
@ -63,60 +48,46 @@ sure you have GTK2 and sqlite3 installed.
|
|||||||
|
|
||||||
## Development version
|
## Development version
|
||||||
|
|
||||||
URTrator written in Go and GTK2, so you should have them installed.
|
URTrator written in Go and GTK2, so you should have them installed. Make sure your ``GOPATH`` variable is defined.
|
||||||
Make sure your ``GOPATH`` variable is defined.
|
|
||||||
|
|
||||||
Then execute:
|
Then execute:
|
||||||
|
|
||||||
```
|
```
|
||||||
go get -d github.com/pztrn/urtrator
|
go get -d gitlab.com/pztrn/urtrator
|
||||||
go install github.com/pztrn/urtrator
|
go install gitlab.com/pztrn/urtrator
|
||||||
```
|
```
|
||||||
|
|
||||||
First command will get sources of URTrator and dependencies, second
|
First command will get sources of URTrator and dependencies, second command will build executable for you and place it in ``$GOROOT/bin``.
|
||||||
command will build executable for you and place it in ``$GOROOT/bin``.
|
|
||||||
|
|
||||||
|
|
||||||
### Updating
|
### Updating
|
||||||
|
|
||||||
``go get`` will do initial repo clone for you, but flag ``-u`` is
|
``go get`` will do initial repo clone for you, but flag ``-u`` is required to get updated URTrator source. So, for updating sources just issue:
|
||||||
required to get updated URTrator source. So, for updating sources
|
|
||||||
just issue:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
go get -d -u github.com/pztrn/urtrator
|
go get -d -u gitlab.com/pztrn/urtrator
|
||||||
```
|
```
|
||||||
|
|
||||||
Again, this will only update sources. To build executable you have to
|
Again, this will only update sources. To build executable you have to issue:
|
||||||
issue:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
go install github.com/pztrn/urtrator
|
go install gitlab.com/pztrn/urtrator
|
||||||
```
|
```
|
||||||
|
|
||||||
# Important information
|
# Important information
|
||||||
|
|
||||||
## Translation
|
## Translation
|
||||||
|
|
||||||
Feel free to ping me everywhere you can and ask for adding a language
|
Feel free to ping me everywhere you can and ask for adding a language for translation, if not already added [here](https://www.transifex.com/issuewarrior/urtrator/dashboard/).
|
||||||
for translation, if not already added [here](https://www.transifex.com/issuewarrior/urtrator/dashboard/).
|
|
||||||
|
|
||||||
Also, if you're testing (or using) URTrator from source tree with `go run`
|
Also, if you're testing (or using) URTrator from source tree with `go run` you should also specify `URTRATOR_BINDIR` variable. This variable tells URTrator where it sources is and from where translations should be taken.
|
||||||
you should also specify `URTRATOR_BINDIR` variable. This variable tells
|
|
||||||
URTrator where it sources is and from where translations should be taken.
|
|
||||||
|
|
||||||
## GTK warnings in console
|
## GTK warnings in console
|
||||||
|
|
||||||
Many GTK warnings in console may appear while using URTrator. Unfortunately,
|
Many GTK warnings in console may appear while using URTrator. Unfortunately, they are out of control, because they are related to Go GTK+2 bindings and nothing can be done on URTrator side.
|
||||||
they are out of control, because they are related to Go GTK+2 bindings
|
|
||||||
and nothing can be done on URTrator side.
|
|
||||||
|
|
||||||
## Why GTK+2?
|
## Why GTK+2?
|
||||||
|
|
||||||
Because GTK+3 going on "stable api nonsense" way. And also it have some
|
Because GTK+3 going on "stable api nonsense" way. And also it have some troubles with integrating with current popular WM/DE (like XFCE4, Openbox, etc.). And also I already tired of that shitty Adwaita and Cantarella.
|
||||||
troubles with integrating with current popular WM/DE (like XFCE4,
|
|
||||||
Openbox, etc.). And also I already tired of that shitty Adwaita and
|
|
||||||
Cantarella.
|
|
||||||
|
|
||||||
If you want to use GTK+3, well, you can write UI for yourself, Go
|
If you want to use GTK+3, well, you can write UI for yourself, Go bindings exist.
|
||||||
bindings exist.
|
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
const (
|
const (
|
||||||
URTRATOR_VERSION = "0.2.0-devel"
|
URTRATOR_VERSION = "0.2.0-devel"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Self-named.
|
// Self-named.
|
||||||
var SUPPORTED_URT_VERSIONS []string = []string{
|
var SUPPORTED_URT_VERSIONS []string = []string{
|
||||||
"4.2.023",
|
"4.2.023",
|
||||||
"4.3.1",
|
"4.3.3",
|
||||||
"4.3.2",
|
"4.3.4",
|
||||||
}
|
}
|
||||||
|
@ -50,13 +50,6 @@ if [ $? -ne 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Okay, let's compile.
|
# Okay, let's compile.
|
||||||
echo "Getting URTrator (and dependencies) sources"
|
|
||||||
go get -u -v -d gitlab.com/pztrn/urtrator
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Failed to get URTrator sources"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Building URTrator..."
|
echo "Building URTrator..."
|
||||||
go install -v gitlab.com/pztrn/urtrator
|
go install -v gitlab.com/pztrn/urtrator
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
@ -108,11 +101,12 @@ echo -e '#!/bin/bash\ncd "${0%/*}"\nexport GTK_PATH="../lib/gtk-2.0/"\nexport GT
|
|||||||
chmod +x ./URTrator.app/Contents/MacOS/urtrator.sh
|
chmod +x ./URTrator.app/Contents/MacOS/urtrator.sh
|
||||||
#####################################################################
|
#####################################################################
|
||||||
# Copying helper binaries.
|
# Copying helper binaries.
|
||||||
cp /usr/local/Cellar/gdk-pixbuf/2.36.0_2/bin/gdk-pixbuf-query-loaders ./URTrator.app/Contents/MacOS/
|
cp /usr/local/Cellar/gdk-pixbuf/2.38.0/bin/gdk-pixbuf-query-loaders ./URTrator.app/Contents/MacOS/
|
||||||
|
|
||||||
# Copy GTK engines as needed for default theme.
|
# Copy GTK engines as needed for default theme.
|
||||||
cp /usr/local/lib/gtk-2.0/2.10.0/engines/* ./URTrator.app/Contents/Framework/
|
cp /usr/local/lib/gtk-2.0/2.10.0/engines/* ./URTrator.app/Contents/Framework/
|
||||||
cp /usr/local/Cellar/gdk-pixbuf/2.36.0_2/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so ./URTrator.app/Contents/Framework/
|
cp /usr/local/lib/gtk-2.0/modules/* ./URTrator.app/Contents/Framework/
|
||||||
|
cp /usr/local/Cellar/gdk-pixbuf/2.38.0/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so ./URTrator.app/Contents/Framework/
|
||||||
chmod -R 0644 ./URTrator.app/Contents/Framework/*
|
chmod -R 0644 ./URTrator.app/Contents/Framework/*
|
||||||
chmod -R 0755 ./URTrator.app/Contents/MacOS/*
|
chmod -R 0755 ./URTrator.app/Contents/MacOS/*
|
||||||
|
|
||||||
|
@ -10,160 +10,160 @@
|
|||||||
package requester
|
package requester
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// stdlib
|
// stdlib
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Requester struct {
|
type Requester struct {
|
||||||
// Pooler.
|
// Pooler.
|
||||||
Pooler *Pooler
|
Pooler *Pooler
|
||||||
// Packet prefix.
|
// Packet prefix.
|
||||||
pp string
|
pp string
|
||||||
// Showstopper for delimiting IP addresses.
|
// Showstopper for delimiting IP addresses.
|
||||||
// As we are receiving bytes, we will put bytes representation of "\"
|
// As we are receiving bytes, we will put bytes representation of "\"
|
||||||
// character.
|
// character.
|
||||||
ip_delimiter int
|
ip_delimiter int
|
||||||
}
|
}
|
||||||
|
|
||||||
// Requester's initialization.
|
// Requester's initialization.
|
||||||
func (r *Requester) Initialize() {
|
func (r *Requester) Initialize() {
|
||||||
fmt.Println("Initializing Requester...")
|
fmt.Println("Initializing Requester...")
|
||||||
r.pp = "\377\377\377\377"
|
r.pp = "\377\377\377\377"
|
||||||
r.ip_delimiter = 92
|
r.ip_delimiter = 92
|
||||||
r.Pooler = &Pooler{}
|
r.Pooler = &Pooler{}
|
||||||
r.Pooler.Initialize()
|
r.Pooler.Initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets all available servers from master server.
|
// Gets all available servers from master server.
|
||||||
// This isn't in pooler, because it have no need to be pooled.
|
// This isn't in pooler, because it have no need to be pooled.
|
||||||
func (r *Requester) getServers() error {
|
func (r *Requester) getServers() error {
|
||||||
// Get master server address and port from configuration.
|
// Get master server address and port from configuration.
|
||||||
var master_server string = ""
|
var master_server string = ""
|
||||||
var master_server_port string = ""
|
var master_server_port string = ""
|
||||||
master_server_raw, ok := Cfg.Cfg["/servers_updating/master_server"]
|
master_server_raw, ok := Cfg.Cfg["/servers_updating/master_server"]
|
||||||
if ok {
|
if ok {
|
||||||
master_server = strings.Split(master_server_raw, ":")[0]
|
master_server = strings.Split(master_server_raw, ":")[0]
|
||||||
master_server_port = strings.Split(master_server_raw, ":")[1]
|
master_server_port = strings.Split(master_server_raw, ":")[1]
|
||||||
} else {
|
} else {
|
||||||
master_server = "master.urbanterror.info"
|
master_server = "master.urbanterror.info"
|
||||||
master_server_port = "27900"
|
master_server_port = "27900"
|
||||||
}
|
}
|
||||||
fmt.Println("Using master server address: " + master_server + ":" + master_server_port)
|
fmt.Println("Using master server address: " + master_server + ":" + master_server_port)
|
||||||
// IP addresses we will compose to return.
|
// IP addresses we will compose to return.
|
||||||
conn, err1 := net.Dial("udp", master_server + ":" + master_server_port)
|
conn, err1 := net.Dial("udp", master_server+":"+master_server_port)
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
fmt.Println("Error dialing to master server!")
|
fmt.Println("Error dialing to master server!")
|
||||||
Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "Failed to connect to master server!"})
|
Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "Failed to connect to master server!"})
|
||||||
return errors.New("Failed to connect to master server!")
|
return errors.New("Failed to connect to master server!")
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
// Set deadline, so we won't wait forever.
|
// Set deadline, so we won't wait forever.
|
||||||
ddl := time.Now()
|
ddl := time.Now()
|
||||||
// This should be enough. Maybe, you should'n run URTrator on modem
|
// This should be enough. Maybe, you should'n run URTrator on modem
|
||||||
// connections? :)
|
// connections? :)
|
||||||
ddl = ddl.Add(time.Second * 2)
|
ddl = ddl.Add(time.Second * 2)
|
||||||
conn.SetDeadline(ddl)
|
conn.SetDeadline(ddl)
|
||||||
fmt.Println("Master server connection deadline set: " + ddl.String())
|
fmt.Println("Master server connection deadline set: " + ddl.String())
|
||||||
|
|
||||||
// Request.
|
// Request.
|
||||||
// 68 - protocol version for 4.3
|
// 68 - protocol version for 4.3
|
||||||
// 70 - protocol version for 4.2.x
|
// 70 - protocol version for 4.2.x
|
||||||
msg := []byte(r.pp + "getservers 68 full empty")
|
msg := []byte(r.pp + "getservers 68 full empty")
|
||||||
conn.Write(msg)
|
conn.Write(msg)
|
||||||
|
|
||||||
// UDP Buffer.
|
// UDP Buffer.
|
||||||
var received_buf []byte = make([]byte, 4096)
|
var received_buf []byte = make([]byte, 4096)
|
||||||
// Received buffer.
|
// Received buffer.
|
||||||
var raw_received []byte
|
var raw_received []byte
|
||||||
// Received IP addresses.
|
// Received IP addresses.
|
||||||
//var received []string
|
//var received []string
|
||||||
fmt.Println("Receiving servers list...")
|
fmt.Println("Receiving servers list...")
|
||||||
for {
|
for {
|
||||||
_, err := conn.Read(received_buf)
|
_, err := conn.Read(received_buf)
|
||||||
raw_received = append(raw_received, received_buf...)
|
raw_received = append(raw_received, received_buf...)
|
||||||
fmt.Println("Received " + strconv.Itoa(len(raw_received)) + " bytes")
|
fmt.Println("Received " + strconv.Itoa(len(raw_received)) + " bytes")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// A bit hacky - if we have received data length lower or
|
// A bit hacky - if we have received data length lower or
|
||||||
// equal to 4k - we have an error. Looks like conn.Read()
|
// equal to 4k - we have an error. Looks like conn.Read()
|
||||||
// reads by 4k.
|
// reads by 4k.
|
||||||
if len(raw_received) < 4097 {
|
if len(raw_received) < 4097 {
|
||||||
fmt.Println("Error dialing to master server!")
|
fmt.Println("Error dialing to master server!")
|
||||||
Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "Failed to connect to master server!"})
|
Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "Failed to connect to master server!"})
|
||||||
return errors.New("Failed to connect to master server!")
|
return errors.New("Failed to connect to master server!")
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtaining list of slices.
|
// Obtaining list of slices.
|
||||||
var raw_received_slices [][]byte = bytes.Split(raw_received, []byte("\\"))
|
var raw_received_slices [][]byte = bytes.Split(raw_received, []byte("\\"))
|
||||||
|
|
||||||
// Every ip-port pair contains:
|
// Every ip-port pair contains:
|
||||||
// 1. IP as first 4 bytes
|
// 1. IP as first 4 bytes
|
||||||
// 2. Port as last 2 bytes.
|
// 2. Port as last 2 bytes.
|
||||||
// Every package is a 7-bytes sequence, which starts with "\"
|
// Every package is a 7-bytes sequence, which starts with "\"
|
||||||
// (code 92), which we used before to obtain list of slices.
|
// (code 92), which we used before to obtain list of slices.
|
||||||
for _, slice := range raw_received_slices {
|
for _, slice := range raw_received_slices {
|
||||||
// We need only 6-bytes slices. All other aren't represent
|
// We need only 6-bytes slices. All other aren't represent
|
||||||
// server's address.
|
// server's address.
|
||||||
if len(slice) != 6 {
|
if len(slice) != 6 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Generate IP.
|
// Generate IP.
|
||||||
ip := strconv.Itoa(int(slice[0])) + "." + strconv.Itoa(int(slice[1])) + "." + strconv.Itoa(int(slice[2])) + "." + strconv.Itoa(int(slice[3]))
|
ip := strconv.Itoa(int(slice[0])) + "." + strconv.Itoa(int(slice[1])) + "." + strconv.Itoa(int(slice[2])) + "." + strconv.Itoa(int(slice[3]))
|
||||||
// Generate port from last two bytes.
|
// Generate port from last two bytes.
|
||||||
// This is a very shitty thing. Don't do this in real world.
|
// This is a very shitty thing. Don't do this in real world.
|
||||||
// Maybe bitshifting will help here, but I can't get it to work :(
|
// Maybe bitshifting will help here, but I can't get it to work :(
|
||||||
// Get first byte as integer and multiply it on 256 and summing with
|
// Get first byte as integer and multiply it on 256 and summing with
|
||||||
// second byte.
|
// second byte.
|
||||||
p1 := int(slice[4]) * 256
|
p1 := int(slice[4]) * 256
|
||||||
port := strconv.Itoa(p1 + int(slice[5]))
|
port := strconv.Itoa(p1 + int(slice[5]))
|
||||||
addr := ip + ":" + port
|
addr := ip + ":" + port
|
||||||
|
|
||||||
// Check if we already have this server added previously. If so - do nothing.
|
// Check if we already have this server added previously. If so - do nothing.
|
||||||
_, ok := Cache.Servers[addr]
|
_, ok := Cache.Servers[addr]
|
||||||
if !ok {
|
if !ok {
|
||||||
// Create cached server.
|
// Create cached server.
|
||||||
Cache.CreateServer(addr)
|
Cache.CreateServer(addr)
|
||||||
Cache.ServersMutex.Lock()
|
Cache.ServersMutex.Lock()
|
||||||
Cache.Servers[addr].Server.Ip = ip
|
Cache.Servers[addr].Server.Ip = ip
|
||||||
Cache.Servers[addr].Server.Port = port
|
Cache.Servers[addr].Server.Port = port
|
||||||
Cache.ServersMutex.Unlock()
|
Cache.ServersMutex.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updates information about all available servers from master server and
|
// Updates information about all available servers from master server and
|
||||||
// parses it to usable format.
|
// parses it to usable format.
|
||||||
func (r *Requester) UpdateAllServers(task bool) {
|
func (r *Requester) UpdateAllServers(task bool) {
|
||||||
fmt.Println("Starting all servers updating procedure...")
|
fmt.Println("Starting all servers updating procedure...")
|
||||||
err := r.getServers()
|
err := r.getServers()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
r.Pooler.UpdateServers("all")
|
r.Pooler.UpdateServers("all")
|
||||||
|
|
||||||
if task {
|
if task {
|
||||||
Eventer.LaunchEvent("taskDone", map[string]string{"task_name": "Server's autoupdating"})
|
Eventer.LaunchEvent("taskDone", map[string]string{"task_name": "Server's autoupdating"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Requester) UpdateFavoriteServers() {
|
func (r *Requester) UpdateFavoriteServers() {
|
||||||
fmt.Println("Updating favorites servers...")
|
fmt.Println("Updating favorites servers...")
|
||||||
r.Pooler.UpdateServers("favorites")
|
r.Pooler.UpdateServers("favorites")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Requester) UpdateOneServer(server_address string) {
|
func (r *Requester) UpdateOneServer(server_address string) {
|
||||||
fmt.Println("Updating server " + server_address)
|
fmt.Println("Updating server " + server_address)
|
||||||
r.Pooler.UpdateOneServer(server_address)
|
r.Pooler.UpdateOneServer(server_address)
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,32 @@
|
|||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// stdlib
|
// stdlib
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
// other
|
// other
|
||||||
"github.com/mattn/go-gtk/gtk"
|
"github.com/mattn/go-gtk/gtk"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *MainWindow) initializeMac() {
|
func (m *MainWindow) initializeMac() {
|
||||||
if runtime.GOOS == "darwin" {
|
if runtime.GOOS == "darwin" {
|
||||||
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
|
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
|
||||||
|
|
||||||
gtk.RCParse(dir + "/../Resources/themes/gtkrc-keybindings")
|
gtk.RCParse(dir + "/../Resources/themes/gtkrc-keybindings")
|
||||||
|
|
||||||
// ToDo: theming support and theme seletion in settings.
|
// ToDo: theming support and theme seletion in settings.
|
||||||
gtk.RCParse(dir + "/../Resources/themes/ClearlooksBrave/gtk-2.0/gtkrc")
|
gtk.RCParse(dir + "/../Resources/themes/ClearlooksBrave/gtk-2.0/gtkrc")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MainWindow) initializeMacAfter() {
|
func (m *MainWindow) initializeMacAfter() {
|
||||||
m.toolbar.SetStyle(gtk.TOOLBAR_ICONS)
|
m.toolbar.SetStyle(gtk.TOOLBAR_ICONS)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MainWindow) initializeMacMenu() {
|
func (m *MainWindow) initializeMacMenu() {
|
||||||
// This is a placeholder, in future we will use native mac menu.
|
// This is a placeholder, in future we will use native mac menu.
|
||||||
// For now it launches default menu initialization.
|
// For now it launches default menu initialization.
|
||||||
m.InitializeMainMenu()
|
m.InitializeMainMenu()
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// stdlib
|
// stdlib
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
// other
|
// other
|
||||||
"github.com/mattn/go-gtk/gtk"
|
"github.com/couchbase/goutils/platform"
|
||||||
"github.com/couchbase/goutils/platform"
|
"github.com/mattn/go-gtk/gtk"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (m *MainWindow) closeWin() {
|
func (m *MainWindow) closeWin() {
|
||||||
platform.HideConsole(false)
|
platform.HideConsole(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MainWindow) initializeWin() {
|
func (m *MainWindow) initializeWin() {
|
||||||
platform.HideConsole(true)
|
platform.HideConsole(true)
|
||||||
|
|
||||||
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
|
dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
|
||||||
|
|
||||||
// ToDo: theming support and theme seletion in settings.
|
// ToDo: theming support and theme seletion in settings.
|
||||||
gtk.RCParse(dir + "/themes/MS-Windows/gtk-2.0/gtkrc")
|
gtk.RCParse(dir + "/themes/MS-Windows/gtk-2.0/gtkrc")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user