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:
Stanislav Nikitin 2016-10-06 16:31:31 +05:00
parent 8691975dca
commit 99435a769f
3 changed files with 18 additions and 3 deletions

View File

@ -91,3 +91,13 @@ and nothing can be done on URTrator side.
## About box cause app crash on macOS
As previous, it is related to GTK+2, nothing I can do there.
## Why GTK+2?
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.
If you want to use GTK+3, well, you can write UI for yourself, Go
bindings exist.

View File

@ -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)
}
}

View File

@ -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() {