Profiles handling fixes.
Fixed profile update with some fields changed, now it won't show error dialog. Removed "Second X session" checkbox column from profiles list, have no idea (for now) how to properly use them.
This commit is contained in:
@@ -12,6 +12,7 @@ package ui
|
||||
import (
|
||||
// stdlib
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
// Local
|
||||
"github.com/pztrn/urtrator/datamodels"
|
||||
@@ -181,8 +182,10 @@ func (o *OptionsDialog) initializeUrtTab() {
|
||||
o.profiles_list.SetModel(o.profiles_list_store)
|
||||
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))
|
||||
crt := gtk.NewCellRendererToggle()
|
||||
o.profiles_list.AppendColumn(gtk.NewTreeViewColumnWithAttributes("Second X session", crt, "bool", 2))
|
||||
|
||||
//crt := gtk.NewCellRendererToggle()
|
||||
//second_x_column := gtk.NewTreeViewColumnWithAttributes("Second X session", crt, "bool", 2)
|
||||
//o.profiles_list.AppendColumn(second_x_column)
|
||||
|
||||
// Profiles list buttons.
|
||||
urt_profiles_buttons_vbox := gtk.NewVBox(false, 0)
|
||||
@@ -229,6 +232,8 @@ func (o *OptionsDialog) loadProfiles() {
|
||||
o.profiles_list_store.Append(&iter)
|
||||
o.profiles_list_store.Set(&iter, 0, profiles[p].Name)
|
||||
o.profiles_list_store.Set(&iter, 1, profiles[p].Version)
|
||||
//state, _ := strconv.ParseBool(profiles[p].Second_x_session)
|
||||
//o.profiles_list_store.Set(&iter, 2, state)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -324,7 +324,7 @@ func (op *OptionsProfile) saveProfile() {
|
||||
}
|
||||
}
|
||||
|
||||
if found {
|
||||
if found && profile.Version == op.old_profile.Version && profile.Binary == op.old_profile.Binary && profile.Name == op.old_profile.Name && profile.Second_x_session == op.old_profile.Second_x_session {
|
||||
mbox_string := "Game profile with same name already exist.\nRename profile for saving."
|
||||
m := gtk.NewMessageDialog(op.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, mbox_string)
|
||||
m.Response(func() {
|
||||
|
Reference in New Issue
Block a user