Freeciv-3.1
Loading...
Searching...
No Matches
soundset_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
26/* client */
27#include "audio.h"
28#include "client_main.h"
29
30/* client/gui-gtk-4.0 */
31#include "gui_main.h"
32#include "gui_stuff.h"
33
34#include "dialogs_g.h"
35
36/************************************************************************/
39static void soundset_suggestion_response(gint arg)
40{
41 if (arg == GTK_RESPONSE_YES) {
42 /* User accepted soundset loading */
45 }
46}
47
48/************************************************************************/
53{
54 GtkWidget *dialog, *label;
55 char buf[1024];
56
57 dialog = gtk_dialog_new_with_buttons(_("Preferred soundset"),
58 NULL,
59 0,
60 _("_Load soundset"),
61 GTK_RESPONSE_YES,
62 _("_Keep current soundset"),
63 GTK_RESPONSE_NO,
64 NULL);
65 setup_dialog(dialog, toplevel);
66 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
67 gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
68
69 fc_snprintf(buf, sizeof(buf),
70 _("Modpack suggests using %s soundset.\n"
71 "It might not work with other soundsets.\n"
72 "You are currently using soundset %s."),
74
75 label = gtk_label_new(buf);
76 gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), label);
77 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
78 gtk_widget_show(label);
79
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. */
84
85 gtk_window_destroy(GTK_WINDOW(dialog));
86}
87
88/************************************************************************/
91static void musicset_suggestion_response(gint arg)
92{
93 if (arg == GTK_RESPONSE_YES) {
94 /* User accepted musicset loading */
96 }
97}
98
99/************************************************************************/
104{
105 GtkWidget *dialog, *label;
106 char buf[1024];
107
108 dialog = gtk_dialog_new_with_buttons(_("Preferred musicset"),
109 NULL,
110 0,
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);
118
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."),
124
125 label = gtk_label_new(buf);
126 gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), label);
127 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
128 gtk_widget_show(label);
129
130 /* In case incoming rulesets are incompatible with current musicset
131 * we need to block their receive before user has accepted loading
132 * of the correct musicset. */
134
135 gtk_window_destroy(GTK_WINDOW(dialog));
136}
void audio_restart(const char *soundset_name, const char *musicset_name)
Definition audio.c:369
char music_set_name[512]
char sound_set_name[512]
#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
void popup_musicset_suggestion_dialog(void)
void popup_soundset_suggestion_dialog(void)
gint blocking_dialog(GtkWidget *dlg)
Definition gui_stuff.c:1126
static void soundset_suggestion_response(gint arg)
static void musicset_suggestion_response(gint arg)
struct packet_ruleset_control control
Definition game.h:83
char preferred_soundset[MAX_LEN_NAME]
char preferred_musicset[MAX_LEN_NAME]
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
#define TRUE
Definition support.h:46