This repository has been archived on 2022-06-29. You can view files and clone it, but cannot push or open issues or pull requests.
urtrator/ui/mainwindow_helpers.go
pztrn 13e091d52b Refactored mainwindow source, columns size and pos remembering.
Refactored MainWindow source, splitted initialization and
helper functions into separate files.

Now lists headers sizes and positions are remembered and correctly
restored on launch.
2016-10-07 21:14:48 +05:00

36 lines
978 B
Go

package ui
import (
// stdlib
"strings"
// other
"github.com/mattn/go-gtk/glib"
"github.com/mattn/go-gtk/gtk"
)
func (m *MainWindow) getIpFromServersList(current_tab string) string {
// Getting server's address from list.
sel := m.all_servers.GetSelection()
model := m.all_servers.GetModel()
iter := new(gtk.TreeIter)
_ = sel.GetSelected(iter)
// Getting server address.
var srv_addr string
srv_addr_gval := glib.ValueFromNative(srv_addr)
model.GetValue(iter, m.column_pos["Servers"]["IP"], srv_addr_gval)
if strings.Contains(current_tab, "Favorites") {
// Getting server's address from list.
sel = m.fav_servers.GetSelection()
model = m.fav_servers.GetModel()
iter := new(gtk.TreeIter)
_ = sel.GetSelected(iter)
model.GetValue(iter, m.column_pos["Favorites"]["IP"], srv_addr_gval)
}
server_address := srv_addr_gval.GetString()
return server_address
}