Do not return NULL as boolean from wonder_is_lost() nor wonder_is_built()
[freeciv.git] / client / gui-gtk-2.0 / tileset_dlg.c
blobdd6710f3e94030c341973047c819bef62788c415
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)
6 any later version.
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 ***********************************************************************/
14 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif
18 #include <gtk/gtk.h>
20 /* utility */
21 #include "fcintl.h"
23 /* common */
24 #include "game.h"
25 #include "unitlist.h"
27 /* client */
28 #include "tilespec.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
47 used.
48 *****************************************************************/
49 void popup_tileset_suggestion_dialog(void)
51 GtkWidget *dialog, *label;
52 char buf[1024];
54 dialog = gtk_dialog_new_with_buttons(_("Preferred tileset"),
55 NULL,
57 _("Load tileset"),
58 GTK_RESPONSE_YES,
59 _("Keep current tileset"),
60 GTK_RESPONSE_NO,
61 NULL);
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);