diff --git a/ChangeLog b/ChangeLog index 9240ec06..610f0d80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 15/03/2009: v2.3.2 - added Turkish translation and hints (thanks to Cem Uykun) - added Greek translation and hints (thanks to Ilias Makris) + - added more meaning to autosave filenames (user, country etc.) + - added W-L-D and cup round robin rank info to the next opponent view + - added possibility to edit player names 29/01/2009: v2.3.1 - added possibility for multiple tables in leagues (think diff --git a/src/callback_func.c b/src/callback_func.c index ce4b9e3b..336603ef 100644 --- a/src/callback_func.c +++ b/src/callback_func.c @@ -120,7 +120,8 @@ callback_player_activate(gint idx) selected_row = idx; on_menu_move_to_youth_academy_activate(NULL, NULL); } - else + else if(gtk_notebook_get_current_page( + GTK_NOTEBOOK(lookup_widget(window.main, "notebook_player"))) == 0) { if(selected_row == -1) { @@ -911,5 +912,5 @@ callback_show_youth_academy(void) treeview_show_player_list( GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")), player_get_pointers_from_array(current_user.youth_academy.players), - attributes, FALSE); + attributes, FALSE, FALSE); } diff --git a/src/treeview.c b/src/treeview.c index b62c720f..efb1bdd9 100644 --- a/src/treeview.c +++ b/src/treeview.c @@ -290,7 +290,8 @@ treeview_create_player_list(GPtrArray *players, gint *attributes, gint max, /** Set up the tree view for a player list */ void treeview_set_up_player_list(GtkTreeView *treeview, gint *attributes, gint max, - gboolean show_separator, gboolean sortable) + gboolean show_separator, gboolean transfer_list, + gboolean sortable) { #ifdef DEBUG printf("treeview_set_up_player_list\n"); @@ -356,6 +357,23 @@ treeview_set_up_player_list(GtkTreeView *treeview, gint *attributes, gint max, GINT_TO_POINTER(attributes[i]), NULL); + if(transfer_list && attributes[i] == PLAYER_LIST_ATTRIBUTE_NAME) + { + g_object_set(renderer, "editable", TRUE, NULL); + g_signal_connect (renderer, + "editing-started", + G_CALLBACK (treeview_helper_player_name_editing_started), + NULL); + g_signal_connect (renderer, + "editing-canceled", + G_CALLBACK (treeview_helper_player_name_editing_canceled), + NULL); + g_signal_connect (renderer, + "edited", + G_CALLBACK (treeview_helper_player_name_editing_done), + NULL); + } + if(attributes[i] != PLAYER_LIST_ATTRIBUTE_NAME && attributes[i] != PLAYER_LIST_ATTRIBUTE_TEAM && attributes[i] != PLAYER_LIST_ATTRIBUTE_LEAGUE_CUP) @@ -404,11 +422,12 @@ treeview_set_up_player_list(GtkTreeView *treeview, gint *attributes, gint max, @param treeview The treeview we fill. @param players The pointer array with the players. We free it afterwards. @param attrib The #PlayerListAttribute that determines which attributes to show. - @param show_separator Whether we draw a blank line after the 11th player. */ + @param show_separator Whether we draw a blank line after the 11th player. + @param transfer_list Whether we show the second player list used for transfer view. */ void treeview_show_player_list(GtkTreeView *treeview, GPtrArray *players, PlayerListAttribute attribute, - gboolean show_separator) + gboolean show_separator, gboolean transfer_list) { #ifdef DEBUG printf("treeview_show_player_list\n"); @@ -429,7 +448,7 @@ treeview_show_player_list(GtkTreeView *treeview, GPtrArray *players, attributes[cnt++] = i; } - treeview_set_up_player_list(treeview, attributes, columns, show_separator, sortable); + treeview_set_up_player_list(treeview, attributes, columns, show_separator, transfer_list, sortable); model = treeview_create_player_list(players, attributes, columns, show_separator, @@ -461,7 +480,7 @@ treeview_show_user_player_list(void) { players = player_get_pointers_from_array(current_user.tm->players); user_set_player_list_attributes(¤t_user, &attribute, i + 1); - treeview_show_player_list(GTK_TREE_VIEW(treeview[i]), players, attribute, TRUE); + treeview_show_player_list(GTK_TREE_VIEW(treeview[i]), players, attribute, TRUE, (i == 1)); } } @@ -477,7 +496,7 @@ treeview_show_player_list_team(GtkTreeView *treeview, const Team *tm, gint scout GPtrArray *players = player_get_pointers_from_array(tm->players); treeview_show_player_list(treeview, players, - treeview_helper_get_attributes_from_scout(scout), TRUE); + treeview_helper_get_attributes_from_scout(scout), TRUE, FALSE); } /** Show the commentary and the minute belonging to the unit. @@ -1739,7 +1758,7 @@ treeview_show_transfer_list(GtkTreeView *treeview) g_ptr_array_add(players, player_of_id_team(trans(i).tm, trans(i).id)); treeview_show_player_list(treeview, players, - treeview_helper_get_attributes_from_scout(current_user.scout), FALSE); + treeview_helper_get_attributes_from_scout(current_user.scout), FALSE, FALSE); } /** Create attack, midfield and defend bars. */ @@ -2067,7 +2086,7 @@ treeview_show_all_players(gint clid) treeview_show_player_list(GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")), players, - treeview_helper_get_attributes_from_scout(current_user.scout), FALSE); + treeview_helper_get_attributes_from_scout(current_user.scout), FALSE, FALSE); } GtkTreeModel* diff --git a/src/treeview.h b/src/treeview.h index 6aae2982..4c4f8bfe 100644 --- a/src/treeview.h +++ b/src/treeview.h @@ -49,12 +49,14 @@ treeview_create_player_list(GPtrArray *players, gint *attributes, gint max, gboolean show_separator, gboolean sortable, gboolean status); void -treeview_set_up_player_list (GtkTreeView *treeview, gint *attributes, gint max, - gboolean show_separator, gboolean sortable); +treeview_set_up_player_list(GtkTreeView *treeview, gint *attributes, gint max, + gboolean show_separator, gboolean transfer_list, + gboolean sortable); void -treeview_show_player_list(GtkTreeView *treeview, GPtrArray *players, PlayerListAttribute attribute, - gboolean show_separator); +treeview_show_player_list(GtkTreeView *treeview, GPtrArray *players, + PlayerListAttribute attribute, + gboolean show_separator, gboolean transfer_list); void treeview_show_user_player_list(void); diff --git a/src/treeview_helper.c b/src/treeview_helper.c index e586a0dd..777ead1d 100644 --- a/src/treeview_helper.c +++ b/src/treeview_helper.c @@ -1976,3 +1976,42 @@ treeview_helper_job_exchange(GtkTreeViewColumn *col, g_object_set(renderer, "text", buf, NULL); } + +void +treeview_helper_player_name_editing_done(GtkCellRendererText *renderer, + gchar *path, + gchar *new_text, + gpointer user_data) +{ + gint idx; + + idx = (gint)strtol(path, NULL, 0); + + if(idx == 11) + return; + + idx = (idx > 11) ? idx - 1 : idx; + g_free(g_array_index(current_user.tm->players, Player, idx).name); + g_array_index(current_user.tm->players, Player, idx).name = g_strdup(new_text); + + gtk_widget_set_sensitive(lookup_widget(window.main, "menubar1"), TRUE); + gtk_widget_set_sensitive(lookup_widget(window.main, "hbox1"), TRUE); +} + +void +treeview_helper_player_name_editing_canceled(GtkCellRendererText *renderer, + gpointer user_data) +{ + gtk_widget_set_sensitive(lookup_widget(window.main, "menubar1"), TRUE); + gtk_widget_set_sensitive(lookup_widget(window.main, "hbox1"), TRUE); +} + +void +treeview_helper_player_name_editing_started(GtkCellRenderer *renderer, + GtkCellEditable *editable, + gchar *path, + gpointer user_data) +{ + gtk_widget_set_sensitive(lookup_widget(window.main, "menubar1"), FALSE); + gtk_widget_set_sensitive(lookup_widget(window.main, "hbox1"), FALSE); +} diff --git a/src/treeview_helper.h b/src/treeview_helper.h index 2332172b..73478da3 100644 --- a/src/treeview_helper.h +++ b/src/treeview_helper.h @@ -243,4 +243,19 @@ treeview_helper_news_additional(GtkTreeViewColumn *col, GtkTreeIter *iter, gpointer user_data); +void +treeview_helper_player_name_editing_done(GtkCellRendererText *renderer, + gchar *path, + gchar *new_text, + gpointer user_data); +void +treeview_helper_player_name_editing_started(GtkCellRenderer *renderer, + GtkCellEditable *editable, + gchar *path, + gpointer user_data); + +void +treeview_helper_player_name_editing_canceled(GtkCellRendererText *renderer, + gpointer user_data); + #endif diff --git a/support_files/definitions/europe/germany/cup_germany_supercup.xml b/support_files/definitions/europe/germany/cup_germany_supercup.xml index a91c8d27..0b04e6f6 100644 --- a/support_files/definitions/europe/germany/cup_germany_supercup.xml +++ b/support_files/definitions/europe/germany/cup_germany_supercup.xml @@ -20,6 +20,7 @@ 1 1 + germany_dfb 1