Freeciv-3.1
Loading...
Searching...
No Matches
tileset_dlg.c
Go to the documentation of this file.
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.
7
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***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include <gtk/gtk.h>
19
20/* utility */
21#include "fcintl.h"
22
23/* common */
24#include "game.h"
25#include "unitlist.h"
26
27/* client */
28#include "tilespec.h"
29
30/* client/gui-gtk-3.0 */
31#include "gui_main.h"
32#include "gui_stuff.h"
33
34#include "dialogs_g.h"
35extern char forced_tileset_name[512];
36static void tileset_suggestion_callback(GtkWidget *dlg, gint arg);
37
38/************************************************************************/
41static void tileset_suggestion_callback(GtkWidget *dlg, gint arg)
42{
43 if (arg == GTK_RESPONSE_YES) {
44 /* User accepted tileset loading */
48 _("Can't load requested tileset."));
49 }
50 }
51}
52
53/************************************************************************/
58{
59 GtkWidget *dialog, *label;
60 char buf[1024];
61
62 dialog = gtk_dialog_new_with_buttons(_("Preferred tileset"),
63 NULL,
64 0,
65 _("_Load tileset"),
66 GTK_RESPONSE_YES,
67 _("_Keep current tileset"),
68 GTK_RESPONSE_NO,
69 NULL);
70 setup_dialog(dialog, toplevel);
71 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
72 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
73
74 fc_snprintf(buf, sizeof(buf),
75 _("Modpack suggests using %s tileset.\n"
76 "It might not work with other tilesets.\n"
77 "You are currently using tileset %s."),
79
80 label = gtk_label_new(buf);
81 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), label);
82 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
83 gtk_widget_show(label);
84
85 g_signal_connect(dialog, "response",
86 G_CALLBACK(tileset_suggestion_callback), NULL);
87
88 /* In case incoming rulesets are incompatible with current tileset
89 * we need to block their receive before user has accepted loading
90 * of the correct tileset. */
91 gtk_dialog_run(GTK_DIALOG(dialog));
92
93 gtk_widget_destroy(dialog);
94}
#define _(String)
Definition fcintl.h:67
struct civ_game game
Definition game.c:57
GtkWidget * toplevel
Definition gui_main.c:124
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
Definition gui_stuff.c:281
char forced_tileset_name[512]
void popup_tileset_suggestion_dialog(void)
Definition tileset_dlg.c:57
static void tileset_suggestion_callback(GtkWidget *dlg, gint arg)
Definition tileset_dlg.c:41
@ LOG_ERROR
Definition log.h:30
struct packet_ruleset_control control
Definition game.h:83
char preferred_tileset[MAX_LEN_NAME]
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
#define sz_strlcpy(dest, src)
Definition support.h:167
#define TRUE
Definition support.h:46
const char * tileset_basename(const struct tileset *t)
Definition tilespec.c:667
void tileset_error(enum log_level level, const char *tset_name, const char *format,...)
Definition tilespec.c:587
bool tilespec_reread(const char *new_tileset_name, bool game_fully_initialized, float scale)
Definition tilespec.c:1299