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>
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
49 *****************************************************************/
50 void popup_soundset_suggestion_dialog(void)
52 GtkWidget
*dialog
, *label
;
55 dialog
= gtk_dialog_new_with_buttons(_("Preferred soundset"),
60 _("Keep current soundset"),
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
102 *****************************************************************/
103 void popup_musicset_suggestion_dialog(void)
105 GtkWidget
*dialog
, *label
;
108 dialog
= gtk_dialog_new_with_buttons(_("Preferred musicset"),
113 _("Keep current musicset"),
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
);