1 /***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
15 #include <fc_config.h>
30 #include "dialogs_g.h"
32 static void tileset_suggestion_callback(GtkWidget
*dlg
, gint arg
);
34 /****************************************************************
35 Callback either loading suggested tileset or doing nothing
36 *****************************************************************/
37 static void tileset_suggestion_callback(GtkWidget
*dlg
, gint arg
)
39 if (arg
== GTK_RESPONSE_YES
) {
40 /* User accepted tileset loading */
41 tilespec_reread(game
.control
.preferred_tileset
, FALSE
);
45 /****************************************************************
46 Popup dialog asking if ruleset suggested tileset should be
48 *****************************************************************/
49 void popup_tileset_suggestion_dialog(void)
51 GtkWidget
*dialog
, *label
;
54 dialog
= gtk_dialog_new_with_buttons(_("Preferred tileset"),
59 _("Keep current tileset"),
62 gtk_dialog_set_default_response(GTK_DIALOG(dialog
), GTK_RESPONSE_YES
);
63 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog
), TRUE
);
65 fc_snprintf(buf
, sizeof(buf
),
66 _("Modpack suggests using %s tileset.\n"
67 "It might not work with other tilesets.\n"
68 "You are currently using tileset %s."),
69 game
.control
.preferred_tileset
, tileset_basename(tileset
));
71 label
= gtk_label_new(buf
);
72 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog
)->vbox
), label
);
73 gtk_label_set_justify(GTK_LABEL(label
), GTK_JUSTIFY_CENTER
);
74 gtk_widget_show(label
);
76 g_signal_connect(dialog
, "response",
77 G_CALLBACK(tileset_suggestion_callback
), NULL
);
79 /* In case incoming rulesets are incompatible with current tileset
80 * we need to block their receive before user has accepted loading
81 * of the correct tileset. */
82 gtk_dialog_run(GTK_DIALOG(dialog
));
84 gtk_widget_destroy(dialog
);