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>
24 #include "dialogs_g.h"
29 static bool load_theme
= FALSE
;
31 static void theme_suggestion_callback(GtkWidget
*dlg
, gint arg
);
33 /****************************************************************
34 Callback deciding if the theme may be loaded or not
35 *****************************************************************/
36 static void theme_suggestion_callback(GtkWidget
*dlg
, gint arg
)
38 load_theme
= (arg
== GTK_RESPONSE_YES
);
41 /****************************************************************
42 Popup dialog asking if tileset suggested theme should be
44 *****************************************************************/
45 bool popup_theme_suggestion_dialog(const char *theme_name
)
47 GtkWidget
*dialog
, *label
;
49 char *current_name
= gui_options
.gui_gtk2_default_theme_name
;
51 if (current_name
== NULL
) {
52 /* gui_gtk2_default_theme_name is not yet set.
53 * This can happen when we load tileset requested at command line and
54 * user has not saved theme information to .freeciv-client-rc-A.B. */
55 current_name
= FC_GTK2_DEFAULT_THEME_NAME
;
58 dialog
= gtk_dialog_new_with_buttons(_("Theme suggested"),
63 _("Keep current theme"),
66 gtk_dialog_set_default_response(GTK_DIALOG(dialog
), GTK_RESPONSE_YES
);
67 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog
), TRUE
);
69 fc_snprintf(buf
, sizeof(buf
),
70 _("Tileset suggests using %s theme.\n"
71 "You are currently using %s."),
72 theme_name
, current_name
);
74 label
= gtk_label_new(buf
);
75 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog
)->vbox
), label
);
76 gtk_label_set_justify(GTK_LABEL(label
), GTK_JUSTIFY_CENTER
);
77 gtk_widget_show(label
);
79 g_signal_connect(dialog
, "response",
80 G_CALLBACK(theme_suggestion_callback
), NULL
);
82 gtk_dialog_run(GTK_DIALOG(dialog
));
84 gtk_widget_destroy(dialog
);