Compare commits
18 Commits
v0.1.0-bet
...
0.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 32c6297765 | |||
| 190f76eb82 | |||
| 5c295f08ab | |||
| 061bfcaeb9 | |||
| 5ca8299714 | |||
| 9c8aa1cc34 | |||
| 5fcbd8536c | |||
| fb7a471aec | |||
| 8c9d948a52 | |||
| 8b44d194b5 | |||
| 3b0a93e63a | |||
| b85ba0470c | |||
| f127fdc9f4 | |||
| 5ef54d943e | |||
| 9e6cdfc869 | |||
| bfd3f884b3 | |||
| 7e6b698c1c | |||
| 4516abb916 |
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
[](https://gitter.im/urtrator/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[](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).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
URTrator is a desktop application that should (eventually) replace
|
URTrator is a desktop application that should (eventually) replace
|
||||||
|
|||||||
@@ -10,5 +10,5 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
const (
|
const (
|
||||||
URTRATOR_VERSION = "0.1-beta5"
|
URTRATOR_VERSION = "0.1.0"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ type Pooler struct {
|
|||||||
func (p *Pooler) Initialize() {
|
func (p *Pooler) Initialize() {
|
||||||
fmt.Println("Initializing requester goroutine pooler...")
|
fmt.Println("Initializing requester goroutine pooler...")
|
||||||
// ToDo: figure out how to make this work nice.
|
// ToDo: figure out how to make this work nice.
|
||||||
p.maxrequests = 100
|
p.maxrequests = 200
|
||||||
_ = runtime.GOMAXPROCS(runtime.NumCPU() * 4)
|
_ = runtime.GOMAXPROCS(runtime.NumCPU() * 4)
|
||||||
p.pp = "\377\377\377\377"
|
p.pp = "\377\377\377\377"
|
||||||
fmt.Println("Pooler initialized")
|
fmt.Println("Pooler initialized")
|
||||||
@@ -238,7 +238,9 @@ func (p *Pooler) UpdateSpecificServer(server *datamodels.Server) error {
|
|||||||
if len(players) == 1 && len(players[0]) > 255 {
|
if len(players) == 1 && len(players[0]) > 255 {
|
||||||
server.Players = "0"
|
server.Players = "0"
|
||||||
} else {
|
} else {
|
||||||
server.Players = strconv.Itoa(len(players))
|
// Looks like we have last element to be empty, due to
|
||||||
|
// strings.Split() call before.
|
||||||
|
server.Players = strconv.Itoa(len(players) - 1)
|
||||||
}
|
}
|
||||||
server.PlayersInfo = strings.Join(received_lines[2:], "\\")
|
server.PlayersInfo = strings.Join(received_lines[2:], "\\")
|
||||||
}
|
}
|
||||||
|
|||||||
123
ui/mainwindow.go
123
ui/mainwindow.go
@@ -13,6 +13,7 @@ import (
|
|||||||
// stdlib
|
// stdlib
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -59,8 +60,12 @@ type MainWindow struct {
|
|||||||
profiles *gtk.ComboBoxText
|
profiles *gtk.ComboBoxText
|
||||||
// Checkbox for hiding/showing offline servers in 'Servers' tab list.
|
// Checkbox for hiding/showing offline servers in 'Servers' tab list.
|
||||||
all_servers_hide_offline *gtk.CheckButton
|
all_servers_hide_offline *gtk.CheckButton
|
||||||
|
// Checkbox for hiding/showing passworded servers in 'Servers' tab list.
|
||||||
|
all_servers_hide_private *gtk.CheckButton
|
||||||
// Checkbox for hiding/showing offline servers in 'Favorites' tab list.
|
// Checkbox for hiding/showing offline servers in 'Favorites' tab list.
|
||||||
fav_servers_hide_offline *gtk.CheckButton
|
fav_servers_hide_offline *gtk.CheckButton
|
||||||
|
// Checkbox for hiding/showing passworded servers in 'Favorites' tab list.
|
||||||
|
fav_servers_hide_private *gtk.CheckButton
|
||||||
// Game launch button.
|
// Game launch button.
|
||||||
launch_button *gtk.Button
|
launch_button *gtk.Button
|
||||||
// Server's information.
|
// Server's information.
|
||||||
@@ -127,8 +132,14 @@ type MainWindow struct {
|
|||||||
|
|
||||||
|
|
||||||
// Flags.
|
// Flags.
|
||||||
|
// Application is initialized?
|
||||||
|
initialized bool
|
||||||
// Window is hidden?
|
// Window is hidden?
|
||||||
hidden bool
|
hidden bool
|
||||||
|
// Use other's tab information?
|
||||||
|
// Used when user changed active tab, to show information about
|
||||||
|
// server which is selected on activated tab.
|
||||||
|
use_other_servers_tab bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MainWindow) addToFavorites() {
|
func (m *MainWindow) addToFavorites() {
|
||||||
@@ -310,6 +321,18 @@ func (m *MainWindow) hideOfflineAllServers() {
|
|||||||
ctx.Eventer.LaunchEvent("loadAllServers", map[string]string{})
|
ctx.Eventer.LaunchEvent("loadAllServers", map[string]string{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Executes when "Hide passworded servers" checkbox changed it's state on
|
||||||
|
// "Servers" tab.
|
||||||
|
func (m *MainWindow) hidePrivateAllServers() {
|
||||||
|
fmt.Println("(Un)Hiding private servers in 'Servers' tab...")
|
||||||
|
if m.all_servers_hide_private.GetActive() {
|
||||||
|
ctx.Cfg.Cfg["/serverslist/all_servers/hide_private"] = "1"
|
||||||
|
} else {
|
||||||
|
ctx.Cfg.Cfg["/serverslist/all_servers/hide_private"] = "0"
|
||||||
|
}
|
||||||
|
ctx.Eventer.LaunchEvent("loadAllServers", map[string]string{})
|
||||||
|
}
|
||||||
|
|
||||||
// Executes when "Hide offline servers" checkbox changed it's state on
|
// Executes when "Hide offline servers" checkbox changed it's state on
|
||||||
// "Favorites" tab.
|
// "Favorites" tab.
|
||||||
func (m *MainWindow) hideOfflineFavoriteServers() {
|
func (m *MainWindow) hideOfflineFavoriteServers() {
|
||||||
@@ -322,6 +345,18 @@ func (m *MainWindow) hideOfflineFavoriteServers() {
|
|||||||
ctx.Eventer.LaunchEvent("loadFavoriteServers", map[string]string{})
|
ctx.Eventer.LaunchEvent("loadFavoriteServers", map[string]string{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Executes when "Hide passworded servers" checkbox changed it's state on
|
||||||
|
// "Favorites" tab.
|
||||||
|
func (m *MainWindow) hidePrivateFavoriteServers() {
|
||||||
|
fmt.Println("(Un)Hiding private servers in 'Favorite' tab...")
|
||||||
|
if m.all_servers_hide_private.GetActive() {
|
||||||
|
ctx.Cfg.Cfg["/serverslist/favorite/hide_private"] = "1"
|
||||||
|
} else {
|
||||||
|
ctx.Cfg.Cfg["/serverslist/favorite/hide_private"] = "0"
|
||||||
|
}
|
||||||
|
ctx.Eventer.LaunchEvent("loadFavoriteServers", map[string]string{})
|
||||||
|
}
|
||||||
|
|
||||||
func (m *MainWindow) loadAllServers(data map[string]string) {
|
func (m *MainWindow) loadAllServers(data map[string]string) {
|
||||||
fmt.Println("Loading all servers...")
|
fmt.Println("Loading all servers...")
|
||||||
for _, server := range ctx.Cache.Servers {
|
for _, server := range ctx.Cache.Servers {
|
||||||
@@ -343,6 +378,14 @@ func (m *MainWindow) loadAllServers(data map[string]string) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if m.all_servers_hide_private.GetActive() && server.Server.IsPrivate == "1" {
|
||||||
|
if server.AllServersIterInList && server.AllServersIterSet {
|
||||||
|
m.all_servers_store.Remove(iter)
|
||||||
|
server.AllServersIterInList = false
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if !server.AllServersIterInList && server.AllServersIterSet {
|
if !server.AllServersIterInList && server.AllServersIterSet {
|
||||||
m.all_servers_store.Append(iter)
|
m.all_servers_store.Append(iter)
|
||||||
server.AllServersIterInList = true
|
server.AllServersIterInList = true
|
||||||
@@ -395,6 +438,14 @@ func (m *MainWindow) loadFavoriteServers(data map[string]string) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if m.fav_servers_hide_private.GetActive() && server.Server.IsPrivate == "1" {
|
||||||
|
if server.FavServersIterInList && server.FavServersIterSet {
|
||||||
|
m.fav_servers_store.Remove(iter)
|
||||||
|
server.FavServersIterInList = false
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// If server on favorites widget, but not favorited (e.g. just
|
// If server on favorites widget, but not favorited (e.g. just
|
||||||
// removed from favorites) - remove it from list.
|
// removed from favorites) - remove it from list.
|
||||||
if server.Server.Favorite != "1" && server.FavServersIterSet && server.FavServersIterInList {
|
if server.Server.Favorite != "1" && server.FavServersIterSet && server.FavServersIterInList {
|
||||||
@@ -453,10 +504,40 @@ func (m *MainWindow) loadProfiles(data map[string]string) {
|
|||||||
|
|
||||||
m.old_profiles_count = len(ctx.Cache.Profiles)
|
m.old_profiles_count = len(ctx.Cache.Profiles)
|
||||||
fmt.Println("Added " + strconv.Itoa(m.old_profiles_count) + " profiles")
|
fmt.Println("Added " + strconv.Itoa(m.old_profiles_count) + " profiles")
|
||||||
|
|
||||||
|
m.profiles.SetActive(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MainWindow) tabChanged() {
|
||||||
|
if !m.initialized {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Active tab changed...")
|
||||||
|
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
|
||||||
|
fmt.Println(current_tab)
|
||||||
|
|
||||||
|
m.use_other_servers_tab = true
|
||||||
|
if strings.Contains(current_tab, "Servers") {
|
||||||
|
m.fav_servers.Emit("cursor-changed")
|
||||||
|
} else if strings.Contains(current_tab, "Favorites") {
|
||||||
|
m.all_servers.Emit("cursor-changed")
|
||||||
|
}
|
||||||
|
m.use_other_servers_tab = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MainWindow) serversUpdateCompleted(data map[string]string) {
|
func (m *MainWindow) serversUpdateCompleted(data map[string]string) {
|
||||||
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "Servers updated."})
|
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "Servers updated."})
|
||||||
|
// Trigger "selection-changed" events on currently active tab's
|
||||||
|
// servers list.
|
||||||
|
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
|
||||||
|
|
||||||
|
if strings.Contains(current_tab, "Servers") {
|
||||||
|
m.all_servers.Emit("cursor-changed")
|
||||||
|
} else if strings.Contains(current_tab, "Favorites") {
|
||||||
|
m.fav_servers.Emit("cursor-changed")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MainWindow) setQuickConnectDetails(data map[string]string) {
|
func (m *MainWindow) setQuickConnectDetails(data map[string]string) {
|
||||||
@@ -487,14 +568,17 @@ func (m *MainWindow) showHide() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MainWindow) showServerInformation() {
|
|
||||||
fmt.Println("Showing server's information...")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *MainWindow) showShortServerInformation() {
|
func (m *MainWindow) showShortServerInformation() {
|
||||||
fmt.Println("Server selection changed, updating server's information widget...")
|
fmt.Println("Server selection changed, updating server's information widget...")
|
||||||
m.server_info_store.Clear()
|
m.server_info_store.Clear()
|
||||||
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
|
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
|
||||||
|
if m.use_other_servers_tab {
|
||||||
|
if strings.Contains(current_tab, "Servers") {
|
||||||
|
current_tab = "Favorites"
|
||||||
|
} else if strings.Contains(current_tab, "Favorites") {
|
||||||
|
current_tab = "Servers"
|
||||||
|
}
|
||||||
|
}
|
||||||
srv_address := m.getIpFromServersList(current_tab)
|
srv_address := m.getIpFromServersList(current_tab)
|
||||||
|
|
||||||
// Getting server information from cache.
|
// Getting server information from cache.
|
||||||
@@ -567,12 +651,22 @@ func (m *MainWindow) showShortServerInformation() {
|
|||||||
m.server_info_store.Append(iter)
|
m.server_info_store.Append(iter)
|
||||||
m.server_info_store.SetValue(iter, 0, "<markup><span font_weight=\"bold\">PLAYERS</span></markup>")
|
m.server_info_store.SetValue(iter, 0, "<markup><span font_weight=\"bold\">PLAYERS</span></markup>")
|
||||||
|
|
||||||
for _, value := range parsed_players_info {
|
// Sorting keys of map.
|
||||||
|
players_map_keys := make([]string, 0, len(parsed_players_info))
|
||||||
|
for k := range parsed_players_info {
|
||||||
|
// ToDo: figure out how to do this properly without
|
||||||
|
// append().
|
||||||
|
players_map_keys = append(players_map_keys, k)
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Strings(players_map_keys)
|
||||||
|
|
||||||
|
for k := range players_map_keys {
|
||||||
iter = new(gtk.TreeIter)
|
iter = new(gtk.TreeIter)
|
||||||
nick := ctx.Colorizer.Fix(value["nick"])
|
nick := ctx.Colorizer.Fix(parsed_players_info[players_map_keys[k]]["nick"])
|
||||||
m.server_info_store.Append(iter)
|
m.server_info_store.Append(iter)
|
||||||
m.server_info_store.SetValue(iter, 0, nick)
|
m.server_info_store.SetValue(iter, 0, nick)
|
||||||
m.server_info_store.SetValue(iter, 1, "(frags: " + value["frags"] + " | ping: " + value["ping"] + ")")
|
m.server_info_store.SetValue(iter, 1, "(frags: " + parsed_players_info[players_map_keys[k]]["frags"] + " | ping: " + parsed_players_info[players_map_keys[k]]["ping"] + ")")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just a separator.
|
// Just a separator.
|
||||||
@@ -584,11 +678,19 @@ func (m *MainWindow) showShortServerInformation() {
|
|||||||
m.server_info_store.Append(iter)
|
m.server_info_store.Append(iter)
|
||||||
m.server_info_store.SetValue(iter, 0, "<markup><span font_weight=\"bold\">OTHER PARAMETERS</span></markup>")
|
m.server_info_store.SetValue(iter, 0, "<markup><span font_weight=\"bold\">OTHER PARAMETERS</span></markup>")
|
||||||
|
|
||||||
for key, value := range parsed_general_data {
|
// Sort it!
|
||||||
|
general_data_keys := make([]string, 0, len(parsed_general_data))
|
||||||
|
for k := range parsed_general_data {
|
||||||
|
general_data_keys = append(general_data_keys, k)
|
||||||
|
}
|
||||||
|
|
||||||
|
sort.Strings(general_data_keys)
|
||||||
|
|
||||||
|
for k := range general_data_keys {
|
||||||
iter = new(gtk.TreeIter)
|
iter = new(gtk.TreeIter)
|
||||||
m.server_info_store.Append(iter)
|
m.server_info_store.Append(iter)
|
||||||
m.server_info_store.SetValue(iter, 0, key)
|
m.server_info_store.SetValue(iter, 0, general_data_keys[k])
|
||||||
m.server_info_store.SetValue(iter, 1, value)
|
m.server_info_store.SetValue(iter, 1, parsed_general_data[general_data_keys[k]])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -605,6 +707,7 @@ func (m *MainWindow) unlockInterface() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *MainWindow) updateOneServer() {
|
func (m *MainWindow) updateOneServer() {
|
||||||
|
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "<markup><span foreground=\"red\" font_weight=\"bold\">Updating selected server...</span></markup>"})
|
||||||
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
|
current_tab := m.tab_widget.GetTabLabelText(m.tab_widget.GetNthPage(m.tab_widget.GetCurrentPage()))
|
||||||
srv_address := m.getIpFromServersList(current_tab)
|
srv_address := m.getIpFromServersList(current_tab)
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ func (m *MainWindow) Initialize() {
|
|||||||
m.vbox.PackStart(profile_and_launch_hbox, false, true, 5)
|
m.vbox.PackStart(profile_and_launch_hbox, false, true, 5)
|
||||||
|
|
||||||
// Separator
|
// Separator
|
||||||
sep := gtk.NewHSeparator()
|
sep := gtk.NewHBox(false, 0)
|
||||||
profile_and_launch_hbox.PackStart(sep, true, true, 5)
|
profile_and_launch_hbox.PackStart(sep, true, true, 5)
|
||||||
|
|
||||||
// Profile selection.
|
// Profile selection.
|
||||||
@@ -149,7 +149,7 @@ func (m *MainWindow) Initialize() {
|
|||||||
m.launch_button = gtk.NewButtonWithLabel("Launch!")
|
m.launch_button = gtk.NewButtonWithLabel("Launch!")
|
||||||
m.launch_button.SetTooltipText("Launch Urban Terror")
|
m.launch_button.SetTooltipText("Launch Urban Terror")
|
||||||
m.launch_button.Clicked(m.launchGame)
|
m.launch_button.Clicked(m.launchGame)
|
||||||
launch_button_image := gtk.NewImageFromPixbuf(logo.ScaleSimple(32, 32, gdkpixbuf.INTERP_NEAREST))
|
launch_button_image := gtk.NewImageFromPixbuf(logo.ScaleSimple(24, 24, gdkpixbuf.INTERP_HYPER))
|
||||||
m.launch_button.SetImage(launch_button_image)
|
m.launch_button.SetImage(launch_button_image)
|
||||||
profile_and_launch_hbox.PackStart(m.launch_button, false, true, 5)
|
profile_and_launch_hbox.PackStart(m.launch_button, false, true, 5)
|
||||||
|
|
||||||
@@ -165,6 +165,9 @@ func (m *MainWindow) Initialize() {
|
|||||||
ctx.Eventer.LaunchEvent("loadFavoriteServers", map[string]string{})
|
ctx.Eventer.LaunchEvent("loadFavoriteServers", map[string]string{})
|
||||||
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "URTrator is ready."})
|
ctx.Eventer.LaunchEvent("setToolbarLabelText", map[string]string{"text": "URTrator is ready."})
|
||||||
|
|
||||||
|
// Set flag that shows to other parts that we're initialized.
|
||||||
|
m.initialized = true
|
||||||
|
|
||||||
gtk.Main()
|
gtk.Main()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,11 +253,6 @@ func (m *MainWindow) initializeSidebar() {
|
|||||||
|
|
||||||
si_scroll.Add(m.server_info)
|
si_scroll.Add(m.server_info)
|
||||||
|
|
||||||
// Button to view additional server info.
|
|
||||||
additional_srv_info_button := gtk.NewButtonWithLabel("Additional information")
|
|
||||||
additional_srv_info_button.Clicked(m.showServerInformation)
|
|
||||||
si_vbox.PackStart(additional_srv_info_button, false, true, 5)
|
|
||||||
|
|
||||||
// Quick connect frame.
|
// Quick connect frame.
|
||||||
quick_connect_frame := gtk.NewFrame("Quick connect")
|
quick_connect_frame := gtk.NewFrame("Quick connect")
|
||||||
sidebar_vbox.PackStart(quick_connect_frame, false, true, 5)
|
sidebar_vbox.PackStart(quick_connect_frame, false, true, 5)
|
||||||
@@ -296,6 +294,9 @@ func (m *MainWindow) initializeSidebar() {
|
|||||||
|
|
||||||
// Initializes internal storages.
|
// Initializes internal storages.
|
||||||
func (m *MainWindow) initializeStorages() {
|
func (m *MainWindow) initializeStorages() {
|
||||||
|
// Application isn't initialized.
|
||||||
|
m.initialized = false
|
||||||
|
m.use_other_servers_tab = false
|
||||||
// Gamemodes.
|
// Gamemodes.
|
||||||
m.gamemodes = make(map[string]string)
|
m.gamemodes = make(map[string]string)
|
||||||
m.gamemodes = map[string]string{
|
m.gamemodes = map[string]string{
|
||||||
@@ -384,6 +385,7 @@ func (m *MainWindow) initializeStorages() {
|
|||||||
func (m *MainWindow) InitializeTabs() {
|
func (m *MainWindow) InitializeTabs() {
|
||||||
// Create tabs widget.
|
// Create tabs widget.
|
||||||
m.tab_widget = gtk.NewNotebook()
|
m.tab_widget = gtk.NewNotebook()
|
||||||
|
m.tab_widget.Connect("switch-page", m.tabChanged)
|
||||||
|
|
||||||
tab_allsrv_hbox := gtk.NewHBox(false, 0)
|
tab_allsrv_hbox := gtk.NewHBox(false, 0)
|
||||||
swin1 := gtk.NewScrolledWindow(nil, nil)
|
swin1 := gtk.NewScrolledWindow(nil, nil)
|
||||||
@@ -439,12 +441,7 @@ func (m *MainWindow) InitializeTabs() {
|
|||||||
|
|
||||||
// Sorting.
|
// Sorting.
|
||||||
// By default we are sorting by server name.
|
// By default we are sorting by server name.
|
||||||
// ToDo: remembering it to configuration storage.
|
|
||||||
// For some reason this cause panic on Windows, so disabling
|
|
||||||
// default sorting here.
|
|
||||||
if runtime.GOOS != "windows" {
|
|
||||||
m.all_servers_store_sortable.SetSortColumnId(m.column_pos["Servers"]["Name"], gtk.SORT_ASCENDING)
|
m.all_servers_store_sortable.SetSortColumnId(m.column_pos["Servers"]["Name"], gtk.SORT_ASCENDING)
|
||||||
}
|
|
||||||
|
|
||||||
// Sorting functions.
|
// Sorting functions.
|
||||||
// Race conditions and GC crazyness appears when activated, so for
|
// Race conditions and GC crazyness appears when activated, so for
|
||||||
@@ -476,6 +473,21 @@ func (m *MainWindow) InitializeTabs() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checkbox for hiding passworded servers.
|
||||||
|
m.all_servers_hide_private = gtk.NewCheckButtonWithLabel("Hide private servers")
|
||||||
|
m.all_servers_hide_private.SetTooltipText("Hide servers which requires password to enter")
|
||||||
|
tab_all_srv_ctl_vbox.PackStart(m.all_servers_hide_private, false, true, 5)
|
||||||
|
m.all_servers_hide_private.Clicked(m.hidePrivateAllServers)
|
||||||
|
// Restore checkbox value.
|
||||||
|
all_servers_hide_private_cb_val, ok := ctx.Cfg.Cfg["/serverslist/all_servers/hide_private"]
|
||||||
|
if !ok {
|
||||||
|
m.all_servers_hide_private.SetActive(true)
|
||||||
|
} else {
|
||||||
|
if all_servers_hide_private_cb_val == "1" {
|
||||||
|
m.all_servers_hide_private.SetActive(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Final separator.
|
// Final separator.
|
||||||
ctl_sep := gtk.NewVSeparator()
|
ctl_sep := gtk.NewVSeparator()
|
||||||
tab_all_srv_ctl_vbox.PackStart(ctl_sep, true, true, 5)
|
tab_all_srv_ctl_vbox.PackStart(ctl_sep, true, true, 5)
|
||||||
@@ -557,6 +569,21 @@ func (m *MainWindow) InitializeTabs() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checkbox for hiding passworded servers.
|
||||||
|
m.fav_servers_hide_private = gtk.NewCheckButtonWithLabel("Hide private servers")
|
||||||
|
m.fav_servers_hide_private.SetTooltipText("Hide servers which requires password to enter")
|
||||||
|
tab_fav_srv_ctl_vbox.PackStart(m.fav_servers_hide_private, false, true, 5)
|
||||||
|
m.fav_servers_hide_private.Clicked(m.hidePrivateFavoriteServers)
|
||||||
|
// Restore checkbox value.
|
||||||
|
fav_servers_hide_private_cb_val, ok := ctx.Cfg.Cfg["/serverslist/favorite/hide_private"]
|
||||||
|
if !ok {
|
||||||
|
m.fav_servers_hide_private.SetActive(true)
|
||||||
|
} else {
|
||||||
|
if fav_servers_hide_private_cb_val == "1" {
|
||||||
|
m.fav_servers_hide_private.SetActive(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Final separator.
|
// Final separator.
|
||||||
ctl_fav_sep := gtk.NewVSeparator()
|
ctl_fav_sep := gtk.NewVSeparator()
|
||||||
tab_fav_srv_ctl_vbox.PackStart(ctl_fav_sep, true, true, 5)
|
tab_fav_srv_ctl_vbox.PackStart(ctl_fav_sep, true, true, 5)
|
||||||
@@ -577,7 +604,7 @@ func (m *MainWindow) InitializeToolbar() {
|
|||||||
button_update_all_servers_icon_pixbuf.Write(button_update_all_servers_icon_bytes)
|
button_update_all_servers_icon_pixbuf.Write(button_update_all_servers_icon_bytes)
|
||||||
button_update_all_servers_icon := gtk.NewImageFromPixbuf(button_update_all_servers_icon_pixbuf.GetPixbuf())
|
button_update_all_servers_icon := gtk.NewImageFromPixbuf(button_update_all_servers_icon_pixbuf.GetPixbuf())
|
||||||
button_update_all_servers := gtk.NewToolButton(button_update_all_servers_icon, "Update all servers")
|
button_update_all_servers := gtk.NewToolButton(button_update_all_servers_icon, "Update all servers")
|
||||||
button_update_all_servers.SetTooltipText("Update all servers in all tabs")
|
button_update_all_servers.SetTooltipText("Update all servers in currently selected tab")
|
||||||
button_update_all_servers.OnClicked(m.UpdateServers)
|
button_update_all_servers.OnClicked(m.UpdateServers)
|
||||||
m.toolbar.Insert(button_update_all_servers, 0)
|
m.toolbar.Insert(button_update_all_servers, 0)
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ func (m *MainWindow) sortServersByName(model *gtk.TreeModel, a *gtk.TreeIter, b
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
name1 := ctx.Colorizer.ClearFromMarkup(name1_raw.GetString())
|
name1 := strings.ToLower(ctx.Colorizer.ClearFromMarkup(name1_raw.GetString()))
|
||||||
name2 := ctx.Colorizer.ClearFromMarkup(name2_raw.GetString())
|
name2 := strings.ToLower(ctx.Colorizer.ClearFromMarkup(name2_raw.GetString()))
|
||||||
|
|
||||||
if name1 < name2 {
|
if name1 < name2 {
|
||||||
return -1
|
return -1
|
||||||
|
|||||||
@@ -146,15 +146,33 @@ func (o *OptionsDialog) initializeAppearanceTab() {
|
|||||||
func (o *OptionsDialog) initializeGeneralTab() {
|
func (o *OptionsDialog) initializeGeneralTab() {
|
||||||
general_vbox := gtk.NewVBox(false, 0)
|
general_vbox := gtk.NewVBox(false, 0)
|
||||||
|
|
||||||
|
general_table := gtk.NewTable(2, 2, false)
|
||||||
|
|
||||||
// Tray icon checkbox.
|
// Tray icon checkbox.
|
||||||
o.show_tray_icon = gtk.NewCheckButtonWithLabel("Show tray icon?")
|
show_tray_icon_label := gtk.NewLabel("Show icon in tray")
|
||||||
|
show_tray_icon_label.SetAlignment(0, 0)
|
||||||
|
general_table.Attach(show_tray_icon_label, 0, 1, 0, 1, gtk.FILL, gtk.SHRINK, 5, 5)
|
||||||
|
|
||||||
|
o.show_tray_icon = gtk.NewCheckButtonWithLabel("")
|
||||||
o.show_tray_icon.SetTooltipText("Show icon in tray")
|
o.show_tray_icon.SetTooltipText("Show icon in tray")
|
||||||
general_vbox.PackStart(o.show_tray_icon, false, true, 5)
|
general_table.Attach(o.show_tray_icon, 1, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
|
||||||
|
|
||||||
// Autoupdate checkbox.
|
// Autoupdate checkbox.
|
||||||
o.autoupdate = gtk.NewCheckButtonWithLabel("Automatically update URTrator?")
|
autoupdate_tooltip := "Should URTrator check for updates and update itself? Not working now."
|
||||||
o.autoupdate.SetTooltipText("Should URTrator check for updates and update itself? Not working now.")
|
autoupdate_label := gtk.NewLabel("Automatically update URTrator?")
|
||||||
general_vbox.PackStart(o.autoupdate, false, true, 5)
|
autoupdate_label.SetTooltipText(autoupdate_tooltip)
|
||||||
|
autoupdate_label.SetAlignment(0, 0)
|
||||||
|
general_table.Attach(autoupdate_label, 0, 1, 1, 2, gtk.FILL, gtk.SHRINK, 5, 5)
|
||||||
|
|
||||||
|
o.autoupdate = gtk.NewCheckButtonWithLabel("")
|
||||||
|
o.autoupdate.SetTooltipText(autoupdate_tooltip)
|
||||||
|
general_table.Attach(o.autoupdate, 1, 2, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
|
||||||
|
|
||||||
|
// Vertical separator.
|
||||||
|
sep := gtk.NewVBox(false, 0)
|
||||||
|
|
||||||
|
general_vbox.PackStart(general_table, false, true, 0)
|
||||||
|
general_vbox.PackStart(sep, false, true, 0)
|
||||||
|
|
||||||
o.tab_widget.AppendPage(general_vbox, gtk.NewLabel("General"))
|
o.tab_widget.AppendPage(general_vbox, gtk.NewLabel("General"))
|
||||||
}
|
}
|
||||||
@@ -176,7 +194,7 @@ func (o *OptionsDialog) initializeTabs() {
|
|||||||
|
|
||||||
// Buttons for saving and discarding changes.
|
// Buttons for saving and discarding changes.
|
||||||
buttons_hbox := gtk.NewHBox(false, 0)
|
buttons_hbox := gtk.NewHBox(false, 0)
|
||||||
sep := gtk.NewHSeparator()
|
sep := gtk.NewHBox(false, 0)
|
||||||
|
|
||||||
cancel_button := gtk.NewButtonWithLabel("Cancel")
|
cancel_button := gtk.NewButtonWithLabel("Cancel")
|
||||||
cancel_button.Clicked(o.closeOptionsDialogByCancel)
|
cancel_button.Clicked(o.closeOptionsDialogByCancel)
|
||||||
@@ -195,7 +213,7 @@ func (o *OptionsDialog) initializeTabs() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (o *OptionsDialog) initializeUrtTab() {
|
func (o *OptionsDialog) initializeUrtTab() {
|
||||||
urt_hbox := gtk.NewHBox(false, 0)
|
urt_hbox := gtk.NewHBox(false, 5)
|
||||||
|
|
||||||
// Profiles list.
|
// Profiles list.
|
||||||
o.profiles_list = gtk.NewTreeView()
|
o.profiles_list = gtk.NewTreeView()
|
||||||
@@ -205,17 +223,13 @@ func (o *OptionsDialog) initializeUrtTab() {
|
|||||||
o.profiles_list.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Profile name", gtk.NewCellRendererText(), "text", 0))
|
o.profiles_list.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Profile name", gtk.NewCellRendererText(), "text", 0))
|
||||||
o.profiles_list.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Urban Terror version", gtk.NewCellRendererText(), "text", 1))
|
o.profiles_list.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Urban Terror version", gtk.NewCellRendererText(), "text", 1))
|
||||||
|
|
||||||
//crt := gtk.NewCellRendererToggle()
|
|
||||||
//second_x_column := gtk.NewTreeViewColumnWithAttributes("Second X session", crt, "bool", 2)
|
|
||||||
//o.profiles_list.AppendColumn(second_x_column)
|
|
||||||
|
|
||||||
// Profiles list buttons.
|
// Profiles list buttons.
|
||||||
urt_profiles_buttons_vbox := gtk.NewVBox(false, 0)
|
urt_profiles_buttons_vbox := gtk.NewVBox(false, 0)
|
||||||
|
|
||||||
button_add := gtk.NewButtonWithLabel("Add")
|
button_add := gtk.NewButtonWithLabel("Add")
|
||||||
button_add.SetTooltipText("Add new profile")
|
button_add.SetTooltipText("Add new profile")
|
||||||
button_add.Clicked(o.addProfile)
|
button_add.Clicked(o.addProfile)
|
||||||
urt_profiles_buttons_vbox.PackStart(button_add, false, true, 5)
|
urt_profiles_buttons_vbox.PackStart(button_add, false, true, 0)
|
||||||
|
|
||||||
button_edit := gtk.NewButtonWithLabel("Edit")
|
button_edit := gtk.NewButtonWithLabel("Edit")
|
||||||
button_edit.SetTooltipText("Edit selected profile. Do nothing if no profile was selected.")
|
button_edit.SetTooltipText("Edit selected profile. Do nothing if no profile was selected.")
|
||||||
@@ -223,13 +237,13 @@ func (o *OptionsDialog) initializeUrtTab() {
|
|||||||
urt_profiles_buttons_vbox.PackStart(button_edit, false, true, 5)
|
urt_profiles_buttons_vbox.PackStart(button_edit, false, true, 5)
|
||||||
|
|
||||||
// Spacer for profiles list buttons.
|
// Spacer for profiles list buttons.
|
||||||
sep := gtk.NewVSeparator()
|
sep := gtk.NewVBox(false, 0)
|
||||||
urt_profiles_buttons_vbox.PackStart(sep, true, true, 5)
|
urt_profiles_buttons_vbox.PackStart(sep, true, true, 5)
|
||||||
|
|
||||||
button_delete := gtk.NewButtonWithLabel("Delete")
|
button_delete := gtk.NewButtonWithLabel("Delete")
|
||||||
button_delete.SetTooltipText("Delete selected profile. Do nothing if no profile was selected.")
|
button_delete.SetTooltipText("Delete selected profile. Do nothing if no profile was selected.")
|
||||||
button_delete.Clicked(o.deleteProfile)
|
button_delete.Clicked(o.deleteProfile)
|
||||||
urt_profiles_buttons_vbox.PackStart(button_delete, false, true, 5)
|
urt_profiles_buttons_vbox.PackStart(button_delete, false, true, 0)
|
||||||
|
|
||||||
urt_hbox.Add(urt_profiles_buttons_vbox)
|
urt_hbox.Add(urt_profiles_buttons_vbox)
|
||||||
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ import (
|
|||||||
type OptionsProfile struct {
|
type OptionsProfile struct {
|
||||||
// Window.
|
// Window.
|
||||||
window *gtk.Window
|
window *gtk.Window
|
||||||
// Main Vertical Box.
|
// Main table.
|
||||||
vbox *gtk.VBox
|
table *gtk.Table
|
||||||
// Profile name.
|
// Profile name.
|
||||||
profile_name *gtk.Entry
|
profile_name *gtk.Entry
|
||||||
// Binary path.
|
// Binary path.
|
||||||
@@ -148,90 +148,85 @@ func (op *OptionsProfile) Initialize(update bool) {
|
|||||||
op.window.SetPosition(gtk.WIN_POS_CENTER)
|
op.window.SetPosition(gtk.WIN_POS_CENTER)
|
||||||
op.window.SetIcon(logo)
|
op.window.SetIcon(logo)
|
||||||
|
|
||||||
op.vbox = gtk.NewVBox(false, 0)
|
op.table = gtk.NewTable(6, 2, false)
|
||||||
|
op.table.SetRowSpacings(2)
|
||||||
|
|
||||||
// Profile name.
|
// Profile name.
|
||||||
profile_name_tooltip := "This how you will see profile on profiles lists."
|
profile_name_tooltip := "This how you will see profile on profiles lists."
|
||||||
pn_hbox := gtk.NewHBox(false, 0)
|
|
||||||
pn_label := gtk.NewLabel("Profile name:")
|
pn_label := gtk.NewLabel("Profile name:")
|
||||||
pn_label.SetTooltipText(profile_name_tooltip)
|
pn_label.SetTooltipText(profile_name_tooltip)
|
||||||
profile_name_sep := gtk.NewHSeparator()
|
pn_label.SetAlignment(0, 0)
|
||||||
profile_name_sep.SetTooltipText(profile_name_tooltip)
|
op.table.Attach(pn_label, 0, 1, 0, 1, gtk.FILL, gtk.SHRINK, 5, 5)
|
||||||
|
|
||||||
op.profile_name = gtk.NewEntry()
|
op.profile_name = gtk.NewEntry()
|
||||||
op.profile_name.SetTooltipText(profile_name_tooltip)
|
op.profile_name.SetTooltipText(profile_name_tooltip)
|
||||||
pn_hbox.PackStart(pn_label, false, true, 5)
|
op.table.Attach(op.profile_name, 1, 2, 0, 1, gtk.FILL, gtk.FILL, 5, 5)
|
||||||
pn_hbox.PackStart(profile_name_sep, true, true, 5)
|
|
||||||
pn_hbox.PackStart(op.profile_name, true, true, 5)
|
|
||||||
op.vbox.PackStart(pn_hbox, false, true, 5)
|
|
||||||
|
|
||||||
// Urban Terror version.
|
// Urban Terror version.
|
||||||
urt_version_tooltip := "Urban Terror version for which this profile applies."
|
urt_version_tooltip := "Urban Terror version for which this profile applies."
|
||||||
urt_version_hbox := gtk.NewHBox(false, 0)
|
|
||||||
urt_version_label := gtk.NewLabel("Urban Terror version:")
|
urt_version_label := gtk.NewLabel("Urban Terror version:")
|
||||||
urt_version_label.SetTooltipText(urt_version_tooltip)
|
urt_version_label.SetTooltipText(urt_version_tooltip)
|
||||||
urt_version_sep := gtk.NewHSeparator()
|
urt_version_label.SetAlignment(0, 0)
|
||||||
urt_version_sep.SetTooltipText(urt_version_tooltip)
|
op.table.Attach(urt_version_label, 0, 1, 1, 2, gtk.FILL, gtk.SHRINK, 5, 5)
|
||||||
|
|
||||||
op.urt_version_combo = gtk.NewComboBoxText()
|
op.urt_version_combo = gtk.NewComboBoxText()
|
||||||
op.urt_version_combo.SetTooltipText(urt_version_tooltip)
|
op.urt_version_combo.SetTooltipText(urt_version_tooltip)
|
||||||
op.urt_version_combo.AppendText("4.2.023")
|
op.urt_version_combo.AppendText("4.2.023")
|
||||||
op.urt_version_combo.AppendText("4.3.0")
|
op.urt_version_combo.AppendText("4.3.0")
|
||||||
op.urt_version_combo.AppendText("4.3.1")
|
op.urt_version_combo.AppendText("4.3.1")
|
||||||
op.urt_version_combo.SetActive(2)
|
op.urt_version_combo.SetActive(2)
|
||||||
urt_version_hbox.PackStart(urt_version_label, false, true, 5)
|
op.table.Attach(op.urt_version_combo, 1, 2, 1, 2, gtk.FILL, gtk.FILL, 5, 5)
|
||||||
urt_version_hbox.PackStart(urt_version_sep, true, true, 5)
|
|
||||||
urt_version_hbox.PackStart(op.urt_version_combo, true, true, 5)
|
|
||||||
op.vbox.PackStart(urt_version_hbox, false, true, 5)
|
|
||||||
|
|
||||||
// Urban Terror binary path.
|
// Urban Terror binary path.
|
||||||
select_binary_tooltip := "Urban Terror binary. Some checks will be executed, so make sure you have selected right binary:\n\nQuake3-UrT.i386 for linux-x86\nQuake3-UrT.x86_64 for linux-amd64\nQuake3-UrT.app for macOS"
|
select_binary_tooltip := "Urban Terror binary. Some checks will be executed, so make sure you have selected right binary:\n\nQuake3-UrT.i386 for linux-x86\nQuake3-UrT.x86_64 for linux-amd64\nQuake3-UrT.app for macOS"
|
||||||
binpath_hbox := gtk.NewHBox(false, 0)
|
binpath_hbox := gtk.NewHBox(false, 0)
|
||||||
binpath_label := gtk.NewLabel("Urban Terror binary:")
|
binpath_label := gtk.NewLabel("Urban Terror binary:")
|
||||||
binpath_label.SetTooltipText(select_binary_tooltip)
|
binpath_label.SetTooltipText(select_binary_tooltip)
|
||||||
binpath_sep := gtk.NewHSeparator()
|
binpath_label.SetAlignment(0, 0)
|
||||||
binpath_sep.SetTooltipText(select_binary_tooltip)
|
op.table.Attach(binpath_label, 0, 1, 2, 3, gtk.FILL, gtk.SHRINK, 5, 5)
|
||||||
|
|
||||||
op.binary_path = gtk.NewEntry()
|
op.binary_path = gtk.NewEntry()
|
||||||
op.binary_path.SetTooltipText(select_binary_tooltip)
|
op.binary_path.SetTooltipText(select_binary_tooltip)
|
||||||
button_select_binary := gtk.NewButtonWithLabel("Browse")
|
button_select_binary := gtk.NewButtonWithLabel("Browse")
|
||||||
button_select_binary.SetTooltipText(select_binary_tooltip)
|
button_select_binary.SetTooltipText(select_binary_tooltip)
|
||||||
button_select_binary.Clicked(op.browseForBinary)
|
button_select_binary.Clicked(op.browseForBinary)
|
||||||
binpath_hbox.PackStart(binpath_label, false, true, 5)
|
|
||||||
binpath_hbox.PackStart(binpath_sep, true, true, 5)
|
|
||||||
binpath_hbox.PackStart(op.binary_path, true, true, 5)
|
binpath_hbox.PackStart(op.binary_path, true, true, 5)
|
||||||
binpath_hbox.PackStart(button_select_binary, false, true, 5)
|
binpath_hbox.PackStart(button_select_binary, false, true, 5)
|
||||||
op.vbox.PackStart(binpath_hbox, false, true, 5)
|
op.table.Attach(binpath_hbox, 1, 2, 2, 3, gtk.FILL, gtk.FILL, 0, 0)
|
||||||
|
|
||||||
// Should we use additional X session?
|
// Should we use additional X session?
|
||||||
another_x_tooltip := "If this is checked, Urban Terror will be launched in another X session.\n\nThis could help if you're experiencing visual lag, glitches and FPS drops under compositing WMs, like Mutter and KWin."
|
another_x_tooltip := "If this is checked, Urban Terror will be launched in another X session.\n\nThis could help if you're experiencing visual lag, glitches and FPS drops under compositing WMs, like Mutter and KWin."
|
||||||
op.another_x_session = gtk.NewCheckButtonWithLabel("Start Urban Terror in another X session?")
|
another_x_label := gtk.NewLabel("Start Urban Terror in another X session?")
|
||||||
|
another_x_label.SetTooltipText(another_x_tooltip)
|
||||||
|
another_x_label.SetAlignment(0, 0)
|
||||||
|
op.table.Attach(another_x_label, 0, 1, 3, 4, gtk.FILL, gtk.SHRINK, 5, 5)
|
||||||
|
op.another_x_session = gtk.NewCheckButtonWithLabel("")
|
||||||
op.another_x_session.SetTooltipText(another_x_tooltip)
|
op.another_x_session.SetTooltipText(another_x_tooltip)
|
||||||
op.vbox.PackStart(op.another_x_session, false, true, 5)
|
// macOS and Windows can't do that :).
|
||||||
// macOS can't do that :).
|
|
||||||
if runtime.GOOS != "linux" {
|
if runtime.GOOS != "linux" {
|
||||||
op.another_x_session.SetSensitive(false)
|
op.another_x_session.SetSensitive(false)
|
||||||
}
|
}
|
||||||
|
op.table.Attach(op.another_x_session, 1, 2, 3, 4, gtk.FILL, gtk.FILL, 5, 5)
|
||||||
|
|
||||||
// Additional game parameters.
|
// Additional game parameters.
|
||||||
params_tooltip := "Additional parameters that will be passed to Urban Terror executable."
|
params_tooltip := "Additional parameters that will be passed to Urban Terror executable."
|
||||||
params_hbox := gtk.NewHBox(false, 0)
|
|
||||||
params_label := gtk.NewLabel("Additional parameters:")
|
params_label := gtk.NewLabel("Additional parameters:")
|
||||||
params_label.SetTooltipText(params_tooltip)
|
params_label.SetTooltipText(params_tooltip)
|
||||||
params_sep := gtk.NewHSeparator()
|
params_label.SetAlignment(0, 0)
|
||||||
params_sep.SetTooltipText(params_tooltip)
|
op.table.Attach(params_label, 0, 1, 4, 5, gtk.FILL, gtk.SHRINK, 5, 5)
|
||||||
|
|
||||||
op.additional_parameters = gtk.NewEntry()
|
op.additional_parameters = gtk.NewEntry()
|
||||||
op.additional_parameters.SetTooltipText(params_tooltip)
|
op.additional_parameters.SetTooltipText(params_tooltip)
|
||||||
params_hbox.PackStart(params_label, false, true, 5)
|
op.table.Attach(op.additional_parameters, 1, 2, 4, 5, gtk.FILL, gtk.FILL, 5, 5)
|
||||||
params_hbox.PackStart(params_sep, true, true, 5)
|
|
||||||
params_hbox.PackStart(op.additional_parameters, true, true, 5)
|
|
||||||
op.vbox.PackStart(params_hbox, false, true, 5)
|
|
||||||
|
|
||||||
// Vertical separator.
|
// Invisible thing.
|
||||||
vert_sep := gtk.NewVSeparator()
|
inv_label := gtk.NewLabel("")
|
||||||
op.vbox.PackStart(vert_sep, true, true, 5)
|
op.table.Attach(inv_label, 1, 2, 5, 6, gtk.EXPAND, gtk.FILL, 5, 5)
|
||||||
|
|
||||||
// The buttons.
|
// The buttons.
|
||||||
buttons_box := gtk.NewHBox(false, 0)
|
buttons_box := gtk.NewHBox(false, 0)
|
||||||
buttons_sep := gtk.NewHSeparator()
|
buttons_sep := gtk.NewHBox(false, 0)
|
||||||
|
|
||||||
cancel_button := gtk.NewButtonWithLabel("Cancel")
|
cancel_button := gtk.NewButtonWithLabel("Cancel")
|
||||||
cancel_button.SetTooltipText("Close without saving")
|
cancel_button.SetTooltipText("Close without saving")
|
||||||
@@ -251,9 +246,14 @@ func (op *OptionsProfile) Initialize(update bool) {
|
|||||||
add_button.Clicked(op.saveProfile)
|
add_button.Clicked(op.saveProfile)
|
||||||
buttons_box.PackStart(add_button, false, true, 5)
|
buttons_box.PackStart(add_button, false, true, 5)
|
||||||
|
|
||||||
op.vbox.PackStart(buttons_box, false, true, 5)
|
vert_sep_box := gtk.NewVBox(false, 0)
|
||||||
|
|
||||||
op.window.Add(op.vbox)
|
vbox := gtk.NewVBox(false, 0)
|
||||||
|
vbox.PackStart(op.table, false, true, 5)
|
||||||
|
vbox.PackStart(vert_sep_box, true, true, 5)
|
||||||
|
vbox.PackStart(buttons_box, false, true, 5)
|
||||||
|
|
||||||
|
op.window.Add(vbox)
|
||||||
op.window.ShowAll()
|
op.window.ShowAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,26 +262,23 @@ func (op *OptionsProfile) InitializeUpdate(profile_name string) {
|
|||||||
op.Initialize(true)
|
op.Initialize(true)
|
||||||
|
|
||||||
// Get profile data.
|
// Get profile data.
|
||||||
profile := []datamodels.Profile{}
|
profile := ctx.Cache.Profiles[profile_name].Profile
|
||||||
err := ctx.Database.Db.Select(&profile, ctx.Database.Db.Rebind("SELECT * FROM urt_profiles WHERE name=?"), profile_name)
|
op.profile_name.SetText(profile.Name)
|
||||||
if err != nil {
|
op.binary_path.SetText(profile.Binary)
|
||||||
fmt.Println(err.Error())
|
op.additional_parameters.SetText(profile.Additional_params)
|
||||||
}
|
if profile.Second_x_session == "1" {
|
||||||
|
|
||||||
op.profile_name.SetText(profile[0].Name)
|
|
||||||
op.binary_path.SetText(profile[0].Binary)
|
|
||||||
op.additional_parameters.SetText(profile[0].Additional_params)
|
|
||||||
if profile[0].Second_x_session == "1" {
|
|
||||||
op.another_x_session.SetActive(true)
|
op.another_x_session.SetActive(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if profile[0].Version == "4.3.0" {
|
if profile.Version == "4.3.0" {
|
||||||
op.urt_version_combo.SetActive(1)
|
op.urt_version_combo.SetActive(1)
|
||||||
|
} else if profile.Version == "4.3.1" {
|
||||||
|
op.urt_version_combo.SetActive(2)
|
||||||
} else {
|
} else {
|
||||||
op.urt_version_combo.SetActive(0)
|
op.urt_version_combo.SetActive(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
op.old_profile = &profile[0]
|
op.old_profile = profile
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user