121
123
* @pos: score-table position
124
* @endofgame: game state
124
127
* Displays the high-score table
127
show_scores (guint pos)
131
show_scores (gint pos, gboolean endofgame)
129
static GtkWidget *score_dialog = NULL;
133
if (properties_super_safe_moves ()) {
135
g_strdup_printf ("%s-super-safe",
136
game_config_filename (current_game_config ()));
137
} else if (properties_safe_moves ()) {
139
g_strdup_printf ("%s-safe",
140
game_config_filename (current_game_config ()));
143
g_strdup_printf ("%s", game_config_filename (current_game_config ()));
146
if (properties_super_safe_moves ()) {
147
nbuf = g_strdup_printf (_("'%s' with super-safe moves"),
148
_(game_config_name (current_game_config ())));
149
} else if (properties_safe_moves ()) {
150
nbuf = g_strdup_printf (_("'%s' with safe moves"),
151
_(game_config_name (current_game_config ())));
154
g_strdup_printf ("'%s'", _(game_config_name (current_game_config ())));
157
if (score_dialog != NULL) {
158
gtk_window_present (GTK_WINDOW (score_dialog));
161
score_dialog = gnome_scores_display (nbuf, GAME_NAME, sbuf, pos);
168
gtk_window_set_transient_for (GTK_WINDOW (score_dialog), GTK_WINDOW (app));
169
gtk_dialog_set_has_separator (GTK_DIALOG (score_dialog), FALSE);
170
gtk_container_set_border_width (GTK_CONTAINER (score_dialog), 5);
171
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (score_dialog)->vbox), 2);
172
gtk_window_set_resizable (GTK_WINDOW (score_dialog), FALSE);
173
g_signal_connect (G_OBJECT (score_dialog), "destroy",
174
G_CALLBACK (gtk_widget_destroyed), &score_dialog);
134
static GtkWidget *scoresdialog = NULL;
135
static GtkWidget *sorrydialog = NULL;
139
if (endofgame && (pos <= 0)) {
140
if (sorrydialog != NULL) {
141
gtk_window_present (GTK_WINDOW (sorrydialog));
143
sorrydialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (app),
144
GTK_DIALOG_DESTROY_WITH_PARENT,
151
("Great work, but unfortunately your score did not make the top ten."));
152
gtk_dialog_add_buttons (GTK_DIALOG (sorrydialog), GTK_STOCK_QUIT,
153
GTK_RESPONSE_REJECT, _("_New Game"),
154
GTK_RESPONSE_ACCEPT, NULL);
155
gtk_dialog_set_default_response (GTK_DIALOG (sorrydialog),
156
GTK_RESPONSE_ACCEPT);
157
gtk_window_set_title (GTK_WINDOW (sorrydialog), "");
159
dialog = sorrydialog;
162
if (scoresdialog != NULL) {
163
gtk_window_present (GTK_WINDOW (scoresdialog));
165
scoresdialog = games_scores_dialog_new (GTK_WINDOW (app),
166
highscores, _("Klotski Scores"));
167
games_scores_dialog_set_category_description (GAMES_SCORES_DIALOG
173
games_scores_dialog_set_hilight (GAMES_SCORES_DIALOG (scoresdialog),
175
message = g_strdup_printf ("<b>%s</b>\n\n%s",
176
_("Congratulations!"),
177
_("Your score has made the top ten."));
178
games_scores_dialog_set_message (GAMES_SCORES_DIALOG (scoresdialog),
182
games_scores_dialog_set_message (GAMES_SCORES_DIALOG (scoresdialog),
187
games_scores_dialog_set_buttons (GAMES_SCORES_DIALOG (scoresdialog),
188
GAMES_SCORES_QUIT_BUTTON |
189
GAMES_SCORES_NEW_GAME_BUTTON);
191
games_scores_dialog_set_buttons (GAMES_SCORES_DIALOG (scoresdialog), 0);
193
dialog = scoresdialog;
196
result = gtk_dialog_run (GTK_DIALOG (dialog));
197
gtk_widget_hide (dialog);