Freeciv-3.3
Loading...
Searching...
No Matches
client
gui-gtk-3.22
theme_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
/* client */
24
#include "
dialogs_g.h
"
25
#include "
options.h
"
26
27
/* gui-gtk-3.22 */
28
#include "
gui_main.h
"
29
30
static
bool
load_theme
=
FALSE
;
31
32
static
void
theme_suggestion_callback
(
GtkWidget
*dlg,
gint
arg);
33
34
/************************************************************************/
37
static
void
theme_suggestion_callback
(
GtkWidget
*dlg,
gint
arg)
38
{
39
load_theme
= (arg ==
GTK_RESPONSE_YES
);
40
}
41
42
/************************************************************************/
46
bool
popup_theme_suggestion_dialog
(
const
char
*
theme_name
)
47
{
48
GtkWidget
*dialog, *label;
49
char
buf
[1024];
50
char
*
current_name
=
GUI_GTK_OPTION
(
default_theme_name
);
51
52
if
(
current_name
==
NULL
) {
53
/* gui option default_theme_name is not yet set.
54
* This can happen when we load tileset requested at command line and
55
* user has not saved theme information to .freeciv-client-rc.A.B. */
56
current_name
=
FC_GTK3_22_DEFAULT_THEME_NAME
;
57
}
58
59
dialog =
gtk_dialog_new_with_buttons
(
_
(
"Theme suggested"
),
60
NULL
,
61
0,
62
_
(
"Load theme"
),
63
GTK_RESPONSE_YES
,
64
_
(
"Keep current theme"
),
65
GTK_RESPONSE_NO
,
66
NULL
);
67
gtk_dialog_set_default_response
(
GTK_DIALOG
(dialog),
GTK_RESPONSE_YES
);
68
gtk_window_set_destroy_with_parent
(
GTK_WINDOW
(dialog),
TRUE
);
69
70
fc_snprintf
(
buf
,
sizeof
(
buf
),
71
_
(
"Tileset suggests using %s theme.\n"
72
"You are currently using %s."
),
73
theme_name
,
current_name
);
74
75
label =
gtk_label_new
(
buf
);
76
gtk_container_add
(
GTK_CONTAINER
(
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
g_signal_connect
(dialog,
"response"
,
81
G_CALLBACK
(
theme_suggestion_callback
),
NULL
);
82
83
gtk_dialog_run
(
GTK_DIALOG
(dialog));
84
85
gtk_widget_destroy
(dialog);
86
87
return
load_theme
;
88
}
incite_cost
char * incite_cost
Definition
comments.c:76
dialogs_g.h
fcintl.h
_
#define _(String)
Definition
fcintl.h:67
GUI_GTK_OPTION
#define GUI_GTK_OPTION(optname)
Definition
gui_main.h:25
theme_suggestion_callback
static void theme_suggestion_callback(GtkWidget *dlg, gint arg)
Definition
theme_dlg.c:37
popup_theme_suggestion_dialog
bool popup_theme_suggestion_dialog(const char *theme_name)
Definition
theme_dlg.c:46
load_theme
static bool load_theme
Definition
theme_dlg.c:30
gui_main.h
options.h
FC_GTK3_22_DEFAULT_THEME_NAME
#define FC_GTK3_22_DEFAULT_THEME_NAME
Definition
options.h:301
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition
support.c:960
TRUE
#define TRUE
Definition
support.h:46
FALSE
#define FALSE
Definition
support.h:47
Generated on Sun Dec 22 2024 22:30:35 for Freeciv-3.3 by
1.9.8