Updated to latest GTK2 bindings API and moved to Gitlab.

This commit is contained in:
Stanislav Nikitin 2018-11-10 13:21:53 +05:00
parent 070aa50762
commit 127e1b8ab9
27 changed files with 3347 additions and 3351 deletions

View File

@ -15,7 +15,7 @@ import (
"sync" "sync"
// local // local
"github.com/pztrn/urtrator/cachemodels" "gitlab.com/pztrn/urtrator/cachemodels"
) )
type Cache struct { type Cache struct {

View File

@ -15,8 +15,8 @@ import (
"strconv" "strconv"
// local // local
"github.com/pztrn/urtrator/cachemodels" "gitlab.com/pztrn/urtrator/cachemodels"
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
) )
func (c *Cache) CreateProfile(name string) { func (c *Cache) CreateProfile(name string) {

View File

@ -14,8 +14,8 @@ import (
"fmt" "fmt"
// local // local
"github.com/pztrn/urtrator/cachemodels" "gitlab.com/pztrn/urtrator/cachemodels"
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
) )
func (c *Cache) CreateServer(addr string) { func (c *Cache) CreateServer(addr string) {

4
cache/exported.go vendored
View File

@ -11,8 +11,8 @@ package cache
import ( import (
// local // local
event "github.com/pztrn/urtrator/eventer" "gitlab.com/pztrn/urtrator/database"
"github.com/pztrn/urtrator/database" event "gitlab.com/pztrn/urtrator/eventer"
) )
var ( var (

View File

@ -11,7 +11,7 @@ package cachemodels
import ( import (
// local // local
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
) )
type Profile struct { type Profile struct {

View File

@ -11,7 +11,7 @@ package cachemodels
import ( import (
// local // local
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
// Other // Other
"github.com/mattn/go-gtk/gtk" "github.com/mattn/go-gtk/gtk"

View File

@ -11,8 +11,8 @@ package clipboardwatcher
import ( import (
// local // local
"github.com/pztrn/urtrator/cache" "gitlab.com/pztrn/urtrator/cache"
"github.com/pztrn/urtrator/eventer" "gitlab.com/pztrn/urtrator/eventer"
) )
var ( var (

View File

@ -15,16 +15,16 @@ import (
"fmt" "fmt"
// local // local
"github.com/pztrn/urtrator/cache" "gitlab.com/pztrn/urtrator/cache"
"github.com/pztrn/urtrator/clipboardwatcher" "gitlab.com/pztrn/urtrator/clipboardwatcher"
"github.com/pztrn/urtrator/colorizer" "gitlab.com/pztrn/urtrator/colorizer"
"github.com/pztrn/urtrator/configuration" "gitlab.com/pztrn/urtrator/configuration"
"github.com/pztrn/urtrator/database" "gitlab.com/pztrn/urtrator/database"
"github.com/pztrn/urtrator/eventer" "gitlab.com/pztrn/urtrator/eventer"
"github.com/pztrn/urtrator/launcher" "gitlab.com/pztrn/urtrator/launcher"
"github.com/pztrn/urtrator/requester" "gitlab.com/pztrn/urtrator/requester"
"github.com/pztrn/urtrator/timer" "gitlab.com/pztrn/urtrator/timer"
"github.com/pztrn/urtrator/translator" "gitlab.com/pztrn/urtrator/translator"
// Github // Github
"github.com/mattn/go-gtk/gtk" "github.com/mattn/go-gtk/gtk"

View File

@ -18,8 +18,8 @@ import (
"strconv" "strconv"
// local // local
"github.com/pztrn/urtrator/configuration" "gitlab.com/pztrn/urtrator/configuration"
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
// Other // Other
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
@ -89,6 +89,5 @@ func (d *Database) Migrate() {
fmt.Println("No database found, will create new one") fmt.Println("No database found, will create new one")
} }
migrate_full(d, dbver) migrate_full(d, dbver)
} }

View File

@ -11,7 +11,7 @@ package database
import ( import (
// Local // Local
"github.com/pztrn/urtrator/configuration" "gitlab.com/pztrn/urtrator/configuration"
) )
var ( var (

View File

@ -51,14 +51,14 @@ fi
# Okay, let's compile. # Okay, let's compile.
echo "Getting URTrator (and dependencies) sources" echo "Getting URTrator (and dependencies) sources"
go get -u -v -d github.com/pztrn/urtrator go get -u -v -d gitlab.com/pztrn/urtrator
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to get URTrator sources" echo "Failed to get URTrator sources"
exit 1 exit 1
fi fi
echo "Building URTrator..." echo "Building URTrator..."
go install -v github.com/pztrn/urtrator go install -v gitlab.com/pztrn/urtrator
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Failed to build URTrator! Please, create a new bug report at https://github.com/pztrn/urtrator and attach FULL console output!" echo "Failed to build URTrator! Please, create a new bug report at https://github.com/pztrn/urtrator and attach FULL console output!"
exit 1 exit 1
@ -69,7 +69,7 @@ mkdir -p URTrator.app/Contents/{MacOS,Framework,Resources}
# Copying URTrator binary # Copying URTrator binary
cp $GOPATH/bin/urtrator URTrator.app/Contents/MacOS/ cp $GOPATH/bin/urtrator URTrator.app/Contents/MacOS/
# Copying main resources. # Copying main resources.
cp $GOPATH/src/github.com/pztrn/urtrator/artwork/urtrator.icns ./URTrator.app/Contents/Resources/ cp $GOPATH/src/gitlab.com/pztrn/urtrator/artwork/urtrator.icns ./URTrator.app/Contents/Resources/
cp -R ./Resources/themes ./URTrator.app/Contents/Resources/ cp -R ./Resources/themes ./URTrator.app/Contents/Resources/
##################################################################### #####################################################################
@ -90,7 +90,7 @@ INFOPLIST='<?xml version="1.0" encoding="UTF-8"?>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>urtrator.icns</string> <string>urtrator.icns</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.1.0</string> <string>0.2.0</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>

View File

@ -21,7 +21,7 @@ import (
"strings" "strings"
// local // local
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
// Github // Github
"github.com/mattn/go-gtk/gtk" "github.com/mattn/go-gtk/gtk"

View File

@ -14,10 +14,10 @@ import (
"fmt" "fmt"
// local // local
"github.com/pztrn/urtrator/cache" "gitlab.com/pztrn/urtrator/cache"
"github.com/pztrn/urtrator/configuration" "gitlab.com/pztrn/urtrator/configuration"
"github.com/pztrn/urtrator/eventer" "gitlab.com/pztrn/urtrator/eventer"
"github.com/pztrn/urtrator/timer" "gitlab.com/pztrn/urtrator/timer"
) )
var ( var (

View File

@ -21,7 +21,7 @@ import (
"time" "time"
// local // local
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
) )
type Pooler struct { type Pooler struct {

View File

@ -14,8 +14,8 @@ import (
"fmt" "fmt"
// local // local
"github.com/pztrn/urtrator/configuration" "gitlab.com/pztrn/urtrator/configuration"
"github.com/pztrn/urtrator/eventer" "gitlab.com/pztrn/urtrator/eventer"
) )
var ( var (

View File

@ -11,7 +11,7 @@ package translator
import ( import (
// local // local
"github.com/pztrn/urtrator/configuration" "gitlab.com/pztrn/urtrator/configuration"
) )
var ( var (

View File

@ -11,7 +11,7 @@ package ui
import ( import (
// local // local
"github.com/pztrn/urtrator/common" "gitlab.com/pztrn/urtrator/common"
// other // other
"github.com/mattn/go-gtk/gtk" "github.com/mattn/go-gtk/gtk"
@ -23,7 +23,7 @@ func ShowAboutDialog() {
ad.SetProgramName("URTrator") ad.SetProgramName("URTrator")
ad.SetComments(ctx.Translator.Translate("Urban Terror servers browser and game launcher", nil)) ad.SetComments(ctx.Translator.Translate("Urban Terror servers browser and game launcher", nil))
ad.SetVersion(common.URTRATOR_VERSION) ad.SetVersion(common.URTRATOR_VERSION)
ad.SetWebsite("http://urtrator.pztrn.name") ad.SetWebsite("https://gitlab.com/pztrn/urtrator")
ad.SetLogo(logo) ad.SetLogo(logo)
// ToDo: put it in plain text files. // ToDo: put it in plain text files.

View File

@ -11,7 +11,7 @@ package ui
import ( import (
// local // local
"github.com/pztrn/urtrator/context" "gitlab.com/pztrn/urtrator/context"
// Other // Other
"github.com/mattn/go-gtk/gdkpixbuf" "github.com/mattn/go-gtk/gdkpixbuf"

View File

@ -18,9 +18,9 @@ import (
"strings" "strings"
// Local // Local
"github.com/pztrn/urtrator/cachemodels" "gitlab.com/pztrn/urtrator/cachemodels"
"github.com/pztrn/urtrator/common" "gitlab.com/pztrn/urtrator/common"
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
// Other // Other
"github.com/mattn/go-gtk/gdkpixbuf" "github.com/mattn/go-gtk/gdkpixbuf"

View File

@ -18,8 +18,8 @@ import (
"strings" "strings"
// Local // Local
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
"github.com/pztrn/urtrator/ioq3dataparser" "gitlab.com/pztrn/urtrator/ioq3dataparser"
// Other // Other
"github.com/mattn/go-gtk/gdkpixbuf" "github.com/mattn/go-gtk/gdkpixbuf"
@ -143,7 +143,6 @@ type MainWindow struct {
// For public server // For public server
server_public_pic *gdkpixbuf.Pixbuf server_public_pic *gdkpixbuf.Pixbuf
// Flags. // Flags.
// Application is initialized? // Application is initialized?
initialized bool initialized bool
@ -209,8 +208,8 @@ func (m *MainWindow) checkMainPanePosition() {
// widgets hell :). // widgets hell :).
func (m *MainWindow) checkPositionAndSize() { func (m *MainWindow) checkPositionAndSize() {
glib.IdleAdd(func() bool { glib.IdleAdd(func() bool {
m.window.GetPosition(&m.window_pos_x, &m.window_pos_y) m.window_pos_x, m.window_pos_y = m.window.GetPosition()
m.window.GetSize(&m.window_width, &m.window_height) m.window_width, m.window_height = m.window.GetSize()
m.hpane.SetPosition(m.window_width - m.pane_negative_position) m.hpane.SetPosition(m.window_width - m.pane_negative_position)
return false return false

View File

@ -9,8 +9,8 @@ import (
"strconv" "strconv"
// local // local
"github.com/pztrn/urtrator/common" "gitlab.com/pztrn/urtrator/common"
"github.com/pztrn/urtrator/timer" "gitlab.com/pztrn/urtrator/timer"
// Other // Other
"github.com/mattn/go-gtk/gdkpixbuf" "github.com/mattn/go-gtk/gdkpixbuf"
@ -109,8 +109,7 @@ func (m *MainWindow) Initialize() {
pane_negative_pos, _ := strconv.Atoi(saved_pane_pos) pane_negative_pos, _ := strconv.Atoi(saved_pane_pos)
m.hpane.SetPosition(m.window_width - pane_negative_pos) m.hpane.SetPosition(m.window_width - pane_negative_pos)
} else { } else {
var w, h int = 0, 0 w, _ := m.window.GetSize()
m.window.GetSize(&w, &h)
m.hpane.SetPosition(w - 150) m.hpane.SetPosition(w - 150)
} }
@ -486,9 +485,9 @@ func (m *MainWindow) InitializeTabs() {
m.all_servers_store_sortable.SetSortColumnId(m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], gtk.SORT_ASCENDING) m.all_servers_store_sortable.SetSortColumnId(m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], gtk.SORT_ASCENDING)
// Sorting functions. // Sorting functions.
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], m.sortServersByName) m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Name", nil)], m.sortServersByName, nil)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Players", nil)], m.sortServersByPlayers) m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Players", nil)], m.sortServersByPlayers, nil)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Ping", nil)], m.sortServersByPing) m.all_servers_store_sortable.SetSortFunc(m.column_pos["Servers"][ctx.Translator.Translate("Ping", nil)], m.sortServersByPing, nil)
// Selection changed signal, which will update server's short info pane. // Selection changed signal, which will update server's short info pane.
m.all_servers.Connect("cursor-changed", m.showShortServerInformation) m.all_servers.Connect("cursor-changed", m.showShortServerInformation)
@ -628,9 +627,9 @@ func (m *MainWindow) InitializeTabs() {
} }
// Sorting functions. // Sorting functions.
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Name", nil)], m.sortServersByName) m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Name", nil)], m.sortServersByName, nil)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Players", nil)], m.sortServersByPlayers) m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Players", nil)], m.sortServersByPlayers, nil)
m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Ping", nil)], m.sortServersByPing) m.all_servers_store_sortable.SetSortFunc(m.column_pos["Favorites"][ctx.Translator.Translate("Ping", nil)], m.sortServersByPing, nil)
// Selection changed signal, which will update server's short info pane. // Selection changed signal, which will update server's short info pane.
m.fav_servers.Connect("cursor-changed", m.showShortServerInformation) m.fav_servers.Connect("cursor-changed", m.showShortServerInformation)

View File

@ -8,7 +8,7 @@ import (
"strings" "strings"
// Local // Local
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
// other // other
"github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/glib"

View File

@ -10,7 +10,7 @@ import (
"github.com/mattn/go-gtk/gtk" "github.com/mattn/go-gtk/gtk"
) )
func (m *MainWindow) sortServersByName(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter) int { func (m *MainWindow) sortServersByName(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter, userData interface{}) int {
var name1_raw glib.GValue var name1_raw glib.GValue
var name2_raw glib.GValue var name2_raw glib.GValue
@ -37,7 +37,7 @@ func (m *MainWindow) sortServersByName(model *gtk.TreeModel, a *gtk.TreeIter, b
return 0 return 0
} }
func (m *MainWindow) sortServersByPlayers(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter) int { func (m *MainWindow) sortServersByPlayers(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter, userData interface{}) int {
var players1_raw glib.GValue var players1_raw glib.GValue
var players2_raw glib.GValue var players2_raw glib.GValue
@ -68,7 +68,7 @@ func (m *MainWindow) sortServersByPlayers(model *gtk.TreeModel, a *gtk.TreeIter,
return -1 return -1
} }
func (m *MainWindow) sortServersByPing(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter) int { func (m *MainWindow) sortServersByPing(model *gtk.TreeModel, a *gtk.TreeIter, b *gtk.TreeIter, userData interface{}) int {
var ping1_raw glib.GValue var ping1_raw glib.GValue
var ping2_raw glib.GValue var ping2_raw glib.GValue

View File

@ -15,11 +15,11 @@ import (
"runtime" "runtime"
// Local // Local
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
// Other // Other
"github.com/mattn/go-gtk/gtk"
"github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/glib"
"github.com/mattn/go-gtk/gtk"
) )
type OptionsDialog struct { type OptionsDialog struct {

View File

@ -17,7 +17,7 @@ import (
"strings" "strings"
// Local // Local
"github.com/pztrn/urtrator/datamodels" "gitlab.com/pztrn/urtrator/datamodels"
// Other // Other
"github.com/mattn/go-gtk/gtk" "github.com/mattn/go-gtk/gtk"
@ -185,7 +185,6 @@ func (op *OptionsProfile) Initialize(update bool) {
op.profile_name.SetTooltipText(profile_name_tooltip) op.profile_name.SetTooltipText(profile_name_tooltip)
op.table.Attach(op.profile_name, 1, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5) op.table.Attach(op.profile_name, 1, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
// Urban Terror version. // Urban Terror version.
urt_version_tooltip := ctx.Translator.Translate("Urban Terror version for which this profile applies.", nil) urt_version_tooltip := ctx.Translator.Translate("Urban Terror version for which this profile applies.", nil)
urt_version_label := gtk.NewLabel(ctx.Translator.Translate("Urban Terror version:", nil)) urt_version_label := gtk.NewLabel(ctx.Translator.Translate("Urban Terror version:", nil))

View File

@ -15,11 +15,11 @@ import (
"sort" "sort"
// Local // Local
"github.com/pztrn/urtrator/ioq3dataparser" "gitlab.com/pztrn/urtrator/ioq3dataparser"
// Other // Other
"github.com/mattn/go-gtk/gtk"
"github.com/mattn/go-gtk/glib" "github.com/mattn/go-gtk/glib"
"github.com/mattn/go-gtk/gtk"
) )
type ServerCVarsDialog struct { type ServerCVarsDialog struct {

View File

@ -11,9 +11,9 @@ package main
import ( import (
// local // local
"github.com/pztrn/urtrator/common" "gitlab.com/pztrn/urtrator/common"
"github.com/pztrn/urtrator/context" "gitlab.com/pztrn/urtrator/context"
"github.com/pztrn/urtrator/ui/gtk2" "gitlab.com/pztrn/urtrator/ui/gtk2"
//"github.com/pztrn/urtrator/ui/qt5" //"github.com/pztrn/urtrator/ui/qt5"
// stdlib // stdlib