Do not return NULL as boolean from wonder_is_lost() nor wonder_is_built()
[freeciv.git] / client / gui-gtk-2.0 / soundset_dlg.c
blobcbb7b17a8336ede35b3b59cd8f44bb85a5ac7207
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"
26 /* client */
27 #include "audio.h"
28 #include "client_main.h"
30 #include "dialogs_g.h"
32 static void soundset_suggestion_callback(GtkWidget *dlg, gint arg);
33 static void musicset_suggestion_callback(GtkWidget *dlg, gint arg);
35 /****************************************************************
36 Callback either loading suggested soundset or doing nothing
37 *****************************************************************/
38 static void soundset_suggestion_callback(GtkWidget *dlg, gint arg)
40 if (arg == GTK_RESPONSE_YES) {
41 /* User accepted soundset loading */
42 audio_restart(game.control.preferred_soundset, music_set_name);
46 /****************************************************************
47 Popup dialog asking if ruleset suggested soundset should be
48 used.
49 *****************************************************************/
50 void popup_soundset_suggestion_dialog(void)
52 GtkWidget *dialog, *label;
53 char buf[1024];
55 dialog = gtk_dialog_new_with_buttons(_("Preferred soundset"),
56 NULL,
58 _("Load soundset"),
59 GTK_RESPONSE_YES,
60 _("Keep current soundset"),
61 GTK_RESPONSE_NO,
62 NULL);
63 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
64 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
66 fc_snprintf(buf, sizeof(buf),
67 _("Modpack suggests using %s soundset.\n"
68 "It might not work with other soundsets.\n"
69 "You are currently using soundset %s."),
70 game.control.preferred_soundset, sound_set_name);
72 label = gtk_label_new(buf);
73 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
74 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
75 gtk_widget_show(label);
77 g_signal_connect(dialog, "response",
78 G_CALLBACK(soundset_suggestion_callback), NULL);
80 /* In case incoming rulesets are incompatible with current soundset
81 * we need to block their receive before user has accepted loading
82 * of the correct soundset. */
83 gtk_dialog_run(GTK_DIALOG(dialog));
85 gtk_widget_destroy(dialog);
88 /****************************************************************
89 Callback either loading suggested musicset or doing nothing
90 *****************************************************************/
91 static void musicset_suggestion_callback(GtkWidget *dlg, gint arg)
93 if (arg == GTK_RESPONSE_YES) {
94 /* User accepted musicset loading */
95 audio_restart(sound_set_name, game.control.preferred_musicset);
99 /****************************************************************
100 Popup dialog asking if ruleset suggested musicset should be
101 used.
102 *****************************************************************/
103 void popup_musicset_suggestion_dialog(void)
105 GtkWidget *dialog, *label;
106 char buf[1024];
108 dialog = gtk_dialog_new_with_buttons(_("Preferred musicset"),
109 NULL,
111 _("Load musicset"),
112 GTK_RESPONSE_YES,
113 _("Keep current musicset"),
114 GTK_RESPONSE_NO,
115 NULL);
116 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
117 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
119 fc_snprintf(buf, sizeof(buf),
120 _("Modpack suggests using %s musicset.\n"
121 "It might not work with other musicsets.\n"
122 "You are currently using musicset %s."),
123 game.control.preferred_musicset, music_set_name);
125 label = gtk_label_new(buf);
126 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
127 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
128 gtk_widget_show(label);
130 g_signal_connect(dialog, "response",
131 G_CALLBACK(musicset_suggestion_callback), NULL);
133 /* In case incoming rulesets are incompatible with current musicset
134 * we need to block their receive before user has accepted loading
135 * of the correct soundset. */
136 gtk_dialog_run(GTK_DIALOG(dialog));
138 gtk_widget_destroy(dialog);