mirror of https://github.com/tstellar/bygfoot.git
Constants editing done.
This commit is contained in:
parent
e4e16947c7
commit
1692d228c4
|
@ -8,6 +8,8 @@
|
|||
- corrected some supercup definition errors which resulted in
|
||||
crashes
|
||||
- foul probabilities in the live game are more sophisticated now
|
||||
- added a simple GUI for editing Bygfoot constants in the
|
||||
preferences (enabling users to fine-tune the game)
|
||||
|
||||
29/01/2009: v2.3.1
|
||||
- added possibility for multiple tables in leagues (think
|
||||
|
|
|
@ -3682,7 +3682,7 @@
|
|||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="default_width">550</property>
|
||||
<property name="default_width">650</property>
|
||||
<property name="default_height">700</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
|
@ -3702,7 +3702,7 @@
|
|||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="notebook2">
|
||||
<widget class="GtkNotebook" id="notebook_constants">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_tabs">True</property>
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "option_gui.h"
|
||||
#include "support.h"
|
||||
#include "training.h"
|
||||
#include "treeview2.h"
|
||||
#include "user.h"
|
||||
#include "variables.h"
|
||||
#include "window.h"
|
||||
|
@ -221,15 +222,15 @@ void
|
|||
on_button_constants_reload_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
if(window.options != NULL)
|
||||
{
|
||||
printf("hu\n");
|
||||
file_load_opt_file(gtk_entry_get_text(GTK_ENTRY(lookup_widget(window.options, "entry_constants_file"))),
|
||||
&constants, TRUE);
|
||||
}
|
||||
else
|
||||
if(gtk_notebook_get_current_page(
|
||||
GTK_NOTEBOOK(lookup_widget(GTK_WIDGET(button), "notebook_constants"))) == 3)
|
||||
file_load_opt_file(opt_str("string_opt_appearance_file"),
|
||||
&constants_app, TRUE);
|
||||
else
|
||||
file_load_opt_file(opt_str("string_opt_constants_file"),
|
||||
&constants, TRUE);
|
||||
|
||||
treeview2_show_constants();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1452,7 +1452,7 @@ create_window_constants (void)
|
|||
{
|
||||
GtkWidget *window_constants;
|
||||
GtkWidget *vbox12;
|
||||
GtkWidget *notebook2;
|
||||
GtkWidget *notebook_constants;
|
||||
GtkWidget *scrolledwindow1;
|
||||
GtkWidget *treeview_constants_integer;
|
||||
GtkWidget *label50;
|
||||
|
@ -1487,19 +1487,19 @@ create_window_constants (void)
|
|||
gtk_container_set_border_width (GTK_CONTAINER (window_constants), 5);
|
||||
gtk_window_set_title (GTK_WINDOW (window_constants), _("window1"));
|
||||
gtk_window_set_position (GTK_WINDOW (window_constants), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window_constants), 550, 700);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window_constants), 650, 700);
|
||||
|
||||
vbox12 = gtk_vbox_new (FALSE, 5);
|
||||
gtk_widget_show (vbox12);
|
||||
gtk_container_add (GTK_CONTAINER (window_constants), vbox12);
|
||||
|
||||
notebook2 = gtk_notebook_new ();
|
||||
gtk_widget_show (notebook2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox12), notebook2, TRUE, TRUE, 0);
|
||||
notebook_constants = gtk_notebook_new ();
|
||||
gtk_widget_show (notebook_constants);
|
||||
gtk_box_pack_start (GTK_BOX (vbox12), notebook_constants, TRUE, TRUE, 0);
|
||||
|
||||
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow1);
|
||||
gtk_container_add (GTK_CONTAINER (notebook2), scrolledwindow1);
|
||||
gtk_container_add (GTK_CONTAINER (notebook_constants), scrolledwindow1);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN);
|
||||
|
||||
|
@ -1509,11 +1509,11 @@ create_window_constants (void)
|
|||
|
||||
label50 = gtk_label_new (_("Integer"));
|
||||
gtk_widget_show (label50);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 0), label50);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_constants), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_constants), 0), label50);
|
||||
|
||||
scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow2);
|
||||
gtk_container_add (GTK_CONTAINER (notebook2), scrolledwindow2);
|
||||
gtk_container_add (GTK_CONTAINER (notebook_constants), scrolledwindow2);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN);
|
||||
|
||||
|
@ -1523,11 +1523,11 @@ create_window_constants (void)
|
|||
|
||||
label51 = gtk_label_new (_("Float"));
|
||||
gtk_widget_show (label51);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 1), label51);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_constants), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_constants), 1), label51);
|
||||
|
||||
scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow3);
|
||||
gtk_container_add (GTK_CONTAINER (notebook2), scrolledwindow3);
|
||||
gtk_container_add (GTK_CONTAINER (notebook_constants), scrolledwindow3);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow3), GTK_SHADOW_IN);
|
||||
|
||||
|
@ -1537,11 +1537,11 @@ create_window_constants (void)
|
|||
|
||||
label52 = gtk_label_new (_("String"));
|
||||
gtk_widget_show (label52);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 2), label52);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_constants), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_constants), 2), label52);
|
||||
|
||||
scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow4);
|
||||
gtk_container_add (GTK_CONTAINER (notebook2), scrolledwindow4);
|
||||
gtk_container_add (GTK_CONTAINER (notebook_constants), scrolledwindow4);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_SHADOW_IN);
|
||||
|
||||
|
@ -1551,7 +1551,7 @@ create_window_constants (void)
|
|||
|
||||
label53 = gtk_label_new (_("Appearance"));
|
||||
gtk_widget_show (label53);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook2), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook2), 3), label53);
|
||||
gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_constants), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_constants), 3), label53);
|
||||
|
||||
hseparator9 = gtk_hseparator_new ();
|
||||
gtk_widget_show (hseparator9);
|
||||
|
@ -1619,7 +1619,7 @@ create_window_constants (void)
|
|||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF (window_constants, window_constants, "window_constants");
|
||||
GLADE_HOOKUP_OBJECT (window_constants, vbox12, "vbox12");
|
||||
GLADE_HOOKUP_OBJECT (window_constants, notebook2, "notebook2");
|
||||
GLADE_HOOKUP_OBJECT (window_constants, notebook_constants, "notebook_constants");
|
||||
GLADE_HOOKUP_OBJECT (window_constants, scrolledwindow1, "scrolledwindow1");
|
||||
GLADE_HOOKUP_OBJECT (window_constants, treeview_constants_integer, "treeview_constants_integer");
|
||||
GLADE_HOOKUP_OBJECT (window_constants, label50, "label50");
|
||||
|
|
|
@ -816,6 +816,8 @@ treeview2_set_up_constants(GtkTreeView *treeview, gint type)
|
|||
g_object_set(renderer, "editable", TRUE, NULL);
|
||||
g_signal_connect (renderer,
|
||||
"edited",
|
||||
(type == CONSTANTS_TYPE_APP) ?
|
||||
G_CALLBACK (treeview_helper_constants_app_editing_done) :
|
||||
G_CALLBACK (treeview_helper_constants_editing_done),
|
||||
treeview);
|
||||
}
|
||||
|
|
|
@ -2064,3 +2064,20 @@ treeview_helper_constants_editing_done(GtkCellRendererText *renderer,
|
|||
gtk_list_store_set(GTK_LIST_STORE(model), &iter, 1, new_text, -1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
treeview_helper_constants_app_editing_done(GtkCellRendererText *renderer,
|
||||
gchar *path,
|
||||
gchar *new_text,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkTreeModel *model = gtk_tree_view_get_model((GtkTreeView*)user_data);
|
||||
GtkTreeIter iter;
|
||||
const gchar *name;
|
||||
|
||||
gtk_tree_model_get_iter_from_string(model, &iter, path);
|
||||
gtk_tree_model_get(model, &iter, 0, &name, -1);
|
||||
|
||||
option_set_string(name, &constants_app, new_text);
|
||||
gtk_list_store_set(GTK_LIST_STORE(model), &iter, 1, new_text, -1);
|
||||
}
|
||||
|
|
|
@ -271,4 +271,10 @@ treeview_helper_constants_editing_done(GtkCellRendererText *renderer,
|
|||
gchar *new_text,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
treeview_helper_constants_app_editing_done(GtkCellRendererText *renderer,
|
||||
gchar *path,
|
||||
gchar *new_text,
|
||||
gpointer user_data);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue