[Freeciv-Dev] Re: (PR#8664) gettext and const char *'s
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8664 >
Jason Short wrote:
> We should probably treat every gettext-returned string as a const char *
> rather than a char *. (This may or may not relate to PR#8661.)
This patch changes the gtk client.
There were numerous problem cases, which I dealt with by the liberal use
of casts.
The problem is that gtk_clist_xxx_row functions take a string array that
is a gchar **. But the list being passed is usually a const char **.
Hence a cast is needed. There is probably no reasonable way around this.
jason
? eff
Index: client/gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.183
diff -u -r1.183 citydlg.c
--- client/gui-gtk/citydlg.c 5 May 2004 20:39:15 -0000 1.183
+++ client/gui-gtk/citydlg.c 11 May 2004 19:35:30 -0000
@@ -574,7 +574,7 @@
N_("Pollution:")
};
- char **output_intl_label = NULL;
+ const char **output_intl_label = NULL;
hbox = gtk_hbox_new(TRUE, 0); /* to give the table padding inside the
frame */
@@ -615,14 +615,11 @@
int i;
GtkWidget *halves, *hbox, *vbox, *page, *align;
GtkWidget *frame, *table, *label, *scrolledwin;
-
const char *improvement_title[] = { N_("City improvements"),
N_("Upkeep")
};
-
- char *tab_title = _("City _Overview");
-
- char **improvement_clist_title = NULL;
+ const char *tab_title = _("City _Overview");
+ const char **improvement_clist_title = NULL;
page = gtk_vbox_new(FALSE, 1);
@@ -857,7 +854,7 @@
improvement_clist_title = intl_slist(2, improvement_title);
}
pdialog->overview.improvement_list =
- gtk_clist_new_with_titles(2, improvement_clist_title);
+ gtk_clist_new_with_titles(2, (gchar **)improvement_clist_title);
gtk_clist_column_titles_passive(GTK_CLIST
(pdialog->overview.improvement_list));
gtk_clist_set_column_justification(GTK_CLIST
@@ -917,7 +914,7 @@
int i, num;
GtkWidget *hbox, **hbox_row, *vbox, *page;
GtkWidget *label;
- char *tab_title = _("_Units");
+ const char *tab_title = _("_Units");
page = gtk_vbox_new(FALSE, 0);
@@ -1130,7 +1127,7 @@
*****************************************************************/
static void create_and_append_worklist_page(struct city_dialog *pdialog)
{
- char *tab_title = _("_Worklist");
+ const char *tab_title = _("_Worklist");
GtkWidget *label = gtk_label_new(tab_title);
notebook_tab_accels[WORKLIST_PAGE] =
@@ -1153,7 +1150,7 @@
static void create_and_append_happiness_page(struct city_dialog *pdialog)
{
GtkWidget *page, *vbox, *label, *table, *align;
- char *tab_title = _("_Happiness");
+ const char *tab_title = _("_Happiness");
page = gtk_hbox_new(FALSE, 0);
@@ -1207,7 +1204,7 @@
static void create_and_append_cma_page(struct city_dialog *pdialog)
{
GtkWidget *page, *label;
- char *tab_title = _("CM_A");
+ const char *tab_title = _("CM_A");
page = gtk_vbox_new(FALSE, 0);
@@ -1229,7 +1226,7 @@
static void create_and_append_trade_page(struct city_dialog *pdialog)
{
GtkWidget *page, *frame, *label;
- char *tab_title = _("_Trade Routes");
+ const char *tab_title = _("_Trade Routes");
page = gtk_hbox_new(TRUE, 0);
@@ -1261,7 +1258,7 @@
GtkWidget *hbox, *vbox, *page, *table, *frame, *label;
GSList *group = NULL;
- char *tab_title = _("_Misc. Settings");
+ const char *tab_title = _("_Misc. Settings");
const char *new_citizens_label[] = {
N_("Entertainers"),
@@ -1288,9 +1285,9 @@
N_("Last active page")
};
- char **new_citizens_intl_label = NULL;
- char **city_opts_intl_label = NULL;
- char **misc_whichtab_intl_label = NULL;
+ const char **new_citizens_intl_label = NULL;
+ const char **city_opts_intl_label = NULL;
+ const char **misc_whichtab_intl_label = NULL;
/* initialize signal_blocker */
pdialog->misc.block_signal = 0;
@@ -2802,7 +2799,7 @@
int i;
static const gchar *title_[4] =
{ N_("Type"), N_("Info"), N_("Cost"), N_("Turns") };
- static gchar **title = NULL;
+ static const gchar **title = NULL;
GtkAccelGroup *accel = gtk_accel_group_new();
char *row[4];
char buf[4][64];
@@ -2825,7 +2822,7 @@
gtk_accel_group_attach(accel, GTK_OBJECT(cshell));
gtk_window_set_title(GTK_WINDOW(cshell), _("Change Production"));
- pdialog->change_list = gtk_clist_new_with_titles(4, title);
+ pdialog->change_list = gtk_clist_new_with_titles(4, (gchar **)title);
gtk_clist_column_titles_passive(GTK_CLIST(pdialog->change_list));
scrolled = gtk_scrolled_window_new(NULL, NULL);
gtk_container_add(GTK_CONTAINER(scrolled), pdialog->change_list);
Index: client/gui-gtk/cityrep.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/cityrep.c,v
retrieving revision 1.85
diff -u -r1.85 cityrep.c
--- client/gui-gtk/cityrep.c 1 May 2004 03:34:57 -0000 1.85
+++ client/gui-gtk/cityrep.c 11 May 2004 19:35:31 -0000
@@ -226,7 +226,7 @@
...
*****************************************************************/
static void append_impr_or_unit_to_menu_sub(GtkWidget * menu,
- gchar * nothing_appended_text,
+ const gchar * nothing_appended_text,
bool append_units,
bool append_wonders,
gboolean change_prod,
@@ -325,7 +325,8 @@
/****************************************************************
...
*****************************************************************/
-static void append_impr_or_unit_to_menu(GtkWidget * menu, char *label,
+static void append_impr_or_unit_to_menu(GtkWidget * menu,
+ const char *label,
bool change_prod,
bool append_improvements,
bool append_units,
@@ -1000,7 +1001,7 @@
static const char *title_[2][1] = { {N_("From:")},
{N_("To:")}
};
- static gchar **title[2];
+ static const gchar **title[2];
int i, j;
cid cids[B_LAST + U_LAST];
int cids_used;
@@ -1031,7 +1032,8 @@
box = gtk_hbox_new(FALSE, 10);
/* make a list of everything we're currently building */
- city_change_all_from_list = gtk_clist_new_with_titles(1, title[0]);
+ city_change_all_from_list
+ = gtk_clist_new_with_titles(1, (gchar **)title[0]);
gtk_clist_column_titles_passive(GTK_CLIST(city_change_all_from_list));
gtk_clist_set_selection_mode(GTK_CLIST(city_change_all_from_list),
GTK_SELECTION_EXTENDED);
@@ -1083,7 +1085,8 @@
/* make a list of everything we could build */
- city_change_all_to_list = gtk_clist_new_with_titles(1, title[1]);
+ city_change_all_to_list
+ = gtk_clist_new_with_titles(1, (gchar **)title[1]);
gtk_clist_column_titles_passive(GTK_CLIST(city_change_all_to_list));
gtk_clist_set_selection_mode(GTK_CLIST(city_change_all_to_list),
GTK_SELECTION_SINGLE);
Index: client/gui-gtk/cma_fe.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/cma_fe.c,v
retrieving revision 1.21
diff -u -r1.21 cma_fe.c
--- client/gui-gtk/cma_fe.c 5 May 2004 20:39:15 -0000 1.21
+++ client/gui-gtk/cma_fe.c 11 May 2004 19:35:31 -0000
@@ -136,7 +136,7 @@
GtkWidget *frame, *page, *hbox, *label, *table;
GtkWidget *vbox, *scrolledwindow, *hscale;
static const char *preset_title_[] = { N_("Presets") };
- static gchar **preset_title = NULL;
+ static const gchar **preset_title = NULL;
int i;
cmafec_get_fe_parameter(pcity, ¶m);
@@ -164,7 +164,8 @@
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- pdialog->preset_list = gtk_clist_new_with_titles(1, preset_title);
+ pdialog->preset_list
+ = gtk_clist_new_with_titles(1, (gchar **)preset_title);
gtk_container_add(GTK_CONTAINER(scrolledwindow), pdialog->preset_list);
gtk_clist_set_column_auto_resize(GTK_CLIST(pdialog->preset_list), 0, TRUE);
gtk_clist_column_titles_show(GTK_CLIST(pdialog->preset_list));
@@ -397,7 +398,7 @@
N_("including sample presets,"),
N_("see README.cma.")
};
- static char **info_message = NULL;
+ static const char **info_message = NULL;
if (!info_message) {
info_message = intl_slist(4, info_message_);
@@ -464,7 +465,7 @@
{
struct cma_dialog *pdialog = (struct cma_dialog *) data;
GList *selection = GTK_CLIST(pdialog->preset_list)->selection;
- char *default_name;
+ const char *default_name;
if (selection) {
default_name = cmafec_preset_get_descr(GPOINTER_TO_INT(selection->data));
Index: client/gui-gtk/connectdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/connectdlg.c,v
retrieving revision 1.46
diff -u -r1.46 connectdlg.c
--- client/gui-gtk/connectdlg.c 10 Apr 2004 03:47:48 -0000 1.46
+++ client/gui-gtk/connectdlg.c 11 May 2004 19:35:31 -0000
@@ -382,7 +382,7 @@
GtkWidget *label, *table, *scrolled, *vbox, *update_meta, *update_lan;
static const char *titles_[6]= {N_("Server Name"), N_("Port"), N_("Version"),
N_("Status"), N_("Players"), N_("Comment")};
- static char **titles;
+ static const char **titles;
char buf [256];
int i;
@@ -472,7 +472,7 @@
vbox=gtk_vbox_new(FALSE, 2);
gtk_notebook_append_page (GTK_NOTEBOOK (book), vbox, label);
- meta_list = gtk_clist_new_with_titles(6, titles);
+ meta_list = gtk_clist_new_with_titles(6, (gchar **)titles);
for (i = 0; i < 6; i++) {
gtk_clist_set_column_auto_resize(GTK_CLIST(meta_list), i, TRUE);
@@ -493,7 +493,7 @@
vbox = gtk_vbox_new(FALSE, 2);
gtk_notebook_append_page (GTK_NOTEBOOK (book), vbox, label);
- lan_list = gtk_clist_new_with_titles(6, titles);
+ lan_list = gtk_clist_new_with_titles(6, (gchar **)titles);
for (i = 0; i < 6; i++) {
gtk_clist_set_column_auto_resize(GTK_CLIST(lan_list), i, TRUE);
Index: client/gui-gtk/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.140
diff -u -r1.140 dialogs.c
--- client/gui-gtk/dialogs.c 8 May 2004 00:00:22 -0000 1.140
+++ client/gui-gtk/dialogs.c 11 May 2004 19:35:31 -0000
@@ -79,7 +79,7 @@
static GtkWidget *notebook;
static int num_classes;
-static char *class_names[MAX_NUM_ITEMS];
+static const char *class_names[MAX_NUM_ITEMS];
static GList *leader_strings = NULL;
@@ -249,7 +249,8 @@
/****************************************************************
...
*****************************************************************/
-static void notify_dialog_update(char *caption, char *headline, char *lines)
+static void notify_dialog_update(const char *caption, const char *headline,
+ const char *lines)
{
gtk_window_set_title(GTK_WINDOW(notify_dialog_shell), caption);
gtk_label_set_text(GTK_LABEL(notify_headline), headline);
@@ -678,7 +679,7 @@
GtkWidget *close_command, *scrolled;
int i, j;
static const char *title_[1] = { N_("Select Advance to Steal") };
- static gchar **title;
+ static const gchar **title;
GtkAccelGroup *accel=gtk_accel_group_new();
if (!title) title = intl_slist(1, title_);
@@ -688,7 +689,7 @@
gtk_window_set_position (GTK_WINDOW(spy_tech_shell), GTK_WIN_POS_MOUSE);
gtk_accel_group_attach(accel, GTK_OBJECT(spy_tech_shell));
- spy_advances_list = gtk_clist_new_with_titles(1, title);
+ spy_advances_list = gtk_clist_new_with_titles(1, (gchar **)title);
gtk_clist_column_titles_passive(GTK_CLIST(spy_advances_list));
scrolled = gtk_scrolled_window_new(NULL,NULL);
@@ -729,7 +730,7 @@
advance_type[j] = -1;
if (pvictim) { /* you don't want to know what lag can do -- Syela */
- gchar *row[1];
+ const gchar *row[1];
for(i=A_FIRST; i<game.num_tech_types; i++) {
if(get_invention(pvictim, i)==TECH_KNOWN &&
@@ -737,25 +738,22 @@
get_invention(pplayer, i)==TECH_REACHABLE)) {
row[0] = advances[i].name;
- gtk_clist_append(GTK_CLIST(spy_advances_list), row);
+ gtk_clist_append(GTK_CLIST(spy_advances_list), (gchar **)row);
advance_type[j++] = i;
}
}
if(j > 0) {
row[0] = _("At Spy's Discretion");
- gtk_clist_append(GTK_CLIST(spy_advances_list), row);
+ gtk_clist_append(GTK_CLIST(spy_advances_list), (gchar **)row);
advance_type[j++] = game.num_tech_types;
}
}
if(j == 0) {
- static const char *row_[1] = { N_("NONE") };
- static gchar **row;
-
- if (!row) row = intl_slist(1, row_);
+ const char *row[1] = { _("NONE") };
- gtk_clist_append(GTK_CLIST(spy_advances_list), row);
+ gtk_clist_append(GTK_CLIST(spy_advances_list), (gchar **)row);
j++;
}
gtk_clist_thaw(GTK_CLIST(spy_advances_list));
@@ -775,9 +773,9 @@
{
GtkWidget *close_command, *scrolled;
int j;
- gchar *row[1];
+ const gchar *row[1];
static const char *title_[1] = { N_("Select Improvement to Sabotage") };
- static gchar **title;
+ static const gchar **title;
GtkAccelGroup *accel=gtk_accel_group_new();
if (!title) title = intl_slist(1, title_);
@@ -787,7 +785,7 @@
gtk_window_set_position (GTK_WINDOW(spy_sabotage_shell), GTK_WIN_POS_MOUSE);
gtk_accel_group_attach(accel, GTK_OBJECT(spy_sabotage_shell));
- spy_improvements_list = gtk_clist_new_with_titles(1, title);
+ spy_improvements_list = gtk_clist_new_with_titles(1, (gchar **)title);
gtk_clist_column_titles_passive(GTK_CLIST(spy_improvements_list));
scrolled = gtk_scrolled_window_new(NULL,NULL);
gtk_container_add(GTK_CONTAINER(scrolled), spy_improvements_list);
@@ -825,20 +823,20 @@
j = 0;
row[0] = _("City Production");
- gtk_clist_append(GTK_CLIST(spy_improvements_list), row);
+ gtk_clist_append(GTK_CLIST(spy_improvements_list), (gchar **)row);
improvement_type[j++] = -1;
built_impr_iterate(pcity, i) {
if(i != B_PALACE && !is_wonder(i)) {
row[0] = (char *) get_impr_name_ex(pcity, i);
- gtk_clist_append(GTK_CLIST(spy_improvements_list), row);
+ gtk_clist_append(GTK_CLIST(spy_improvements_list), (gchar **)row);
improvement_type[j++] = i;
}
} built_impr_iterate_end;
if(j > 1) {
row[0] = _("At Spy's Discretion");
- gtk_clist_append(GTK_CLIST(spy_improvements_list), row);
+ gtk_clist_append(GTK_CLIST(spy_improvements_list), (gchar **)row);
improvement_type[j++] = B_LAST;
} else {
improvement_type[0] = B_LAST; /* fake "discretion", since must be
production */
Index: client/gui-gtk/diplodlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/diplodlg.c,v
retrieving revision 1.43
diff -u -r1.43 diplodlg.c
--- client/gui-gtk/diplodlg.c 5 May 2004 20:39:15 -0000 1.43
+++ client/gui-gtk/diplodlg.c 11 May 2004 19:35:31 -0000
@@ -287,7 +287,7 @@
char buf[512];
static const char *titles_[1]
= { N_("The following clauses have been agreed upon:") };
- static gchar **titles;
+ static const gchar **titles;
struct Diplomacy_dialog *pdialog;
GtkWidget *button,*label,*item,*table,*scrolled;
@@ -512,7 +512,7 @@
pdialog->dip_labelm, TRUE, FALSE, 2);
- pdialog->dip_clauselist = gtk_clist_new_with_titles(1, titles);
+ pdialog->dip_clauselist = gtk_clist_new_with_titles(1, (gchar **)titles);
gtk_clist_column_titles_passive(GTK_CLIST(pdialog->dip_clauselist));
scrolled = gtk_scrolled_window_new(NULL,NULL);
gtk_container_add(GTK_CONTAINER(scrolled),pdialog->dip_clauselist);
Index: client/gui-gtk/gui_stuff.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gui_stuff.c,v
retrieving revision 1.23
diff -u -r1.23 gui_stuff.c
--- client/gui-gtk/gui_stuff.c 4 Apr 2003 15:47:46 -0000 1.23
+++ client/gui-gtk/gui_stuff.c 11 May 2004 19:35:31 -0000
@@ -162,9 +162,9 @@
(This is not directly gui/gtk related, but it fits in here
because so far it is used for doing i18n for gtk titles...)
**************************************************************************/
-char **intl_slist(int n, const char **s)
+const char **intl_slist(int n, const char **s)
{
- char **ret = fc_malloc(n * sizeof(char*));
+ const char **ret = fc_malloc(n * sizeof(char*));
int i;
for(i=0; i<n; i++) {
Index: client/gui-gtk/gui_stuff.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gui_stuff.h,v
retrieving revision 1.8
diff -u -r1.8 gui_stuff.h
--- client/gui-gtk/gui_stuff.h 3 Mar 2003 22:41:23 -0000 1.8
+++ client/gui-gtk/gui_stuff.h 11 May 2004 19:35:31 -0000
@@ -23,6 +23,6 @@
void gtk_window_hide(GtkWindow *window);
void gtk_window_show(GtkWindow *window);
-char **intl_slist(int n, const char **s);
+const char **intl_slist(int n, const char **s);
#endif /* FC__GUI_STUFF_H */
Index: client/gui-gtk/inputdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/inputdlg.c,v
retrieving revision 1.8
diff -u -r1.8 inputdlg.c
--- client/gui-gtk/inputdlg.c 14 Nov 2002 09:14:54 -0000 1.8
+++ client/gui-gtk/inputdlg.c 11 May 2004 19:35:31 -0000
@@ -97,8 +97,8 @@
/****************************************************************
...
*****************************************************************/
-GtkWidget *input_dialog_create(GtkWidget * parent, char *dialogname,
- char *text, char *postinputtest,
+GtkWidget *input_dialog_create(GtkWidget * parent, const char *dialogname,
+ const char *text, const char *postinputtest,
void (*ok_callback) (const char *, gpointer),
gpointer ok_data,
void (*cancel_callback) (gpointer),
Index: client/gui-gtk/inputdlg.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/inputdlg.h,v
retrieving revision 1.3
diff -u -r1.3 inputdlg.h
--- client/gui-gtk/inputdlg.h 13 Jun 2002 22:43:23 -0000 1.3
+++ client/gui-gtk/inputdlg.h 11 May 2004 19:35:31 -0000
@@ -15,8 +15,8 @@
#include <gtk/gtk.h>
-GtkWidget *input_dialog_create(GtkWidget * parent, char *dialogname,
- char *text, char *postinputtest,
+GtkWidget *input_dialog_create(GtkWidget * parent, const char *dialogname,
+ const char *text, const char *postinputtest,
void (*ok_callback) (const char *, gpointer),
gpointer ok_data,
void (*cancel_callback) (gpointer),
Index: client/gui-gtk/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/menu.c,v
retrieving revision 1.83
diff -u -r1.83 menu.c
--- client/gui-gtk/menu.c 16 Apr 2004 17:24:54 -0000 1.83
+++ client/gui-gtk/menu.c 11 May 2004 19:35:32 -0000
@@ -58,7 +58,7 @@
static GtkItemFactory *item_factory = NULL;
static enum unit_activity road_activity;
-static void menus_rename(const char *path, char *s);
+static void menus_rename(const char *path, const char *s);
/****************************************************************
...
@@ -837,7 +837,8 @@
strcpy(res, path);
#else
static struct astring in, out, tmp; /* these are never free'd */
- char *tok, *s, *trn, *t;
+ char *tok, *s, *t;
+ const char *trn;
int len;
char *res;
@@ -981,7 +982,7 @@
/****************************************************************
...
*****************************************************************/
-static void menus_rename(const char *path, char *s)
+static void menus_rename(const char *path, const char *s)
{
GtkWidget *item;
@@ -1104,11 +1105,11 @@
}
if((punit=get_unit_in_focus())) {
- char *irrfmt = _("Change to %s (_I)");
- char *minfmt = _("Change to %s (_M)");
- char *transfmt = _("Transf_orm to %s");
+ const char *irrfmt = _("Change to %s (_I)");
+ const char *minfmt = _("Change to %s (_M)");
+ const char *transfmt = _("Transf_orm to %s");
char irrtext[128], mintext[128], transtext[128];
- char *roadtext;
+ const char *roadtext;
enum tile_terrain_type ttype;
struct tile_type * tinfo;
Index: client/gui-gtk/messagewin.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/messagewin.c,v
retrieving revision 1.39
diff -u -r1.39 messagewin.c
--- client/gui-gtk/messagewin.c 4 Apr 2003 15:47:47 -0000 1.39
+++ client/gui-gtk/messagewin.c 11 May 2004 19:35:32 -0000
@@ -127,7 +127,7 @@
void create_meswin_dialog(void)
{
static const char *titles_[1] = { N_("Messages") };
- static gchar **titles;
+ static const gchar **titles;
GtkWidget *scrolled;
GtkAccelGroup *accel = gtk_accel_group_new();
@@ -147,7 +147,7 @@
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(meswin_dialog_shell)->vbox),
scrolled, TRUE, TRUE, 0);
- meswin_list = gtk_clist_new_with_titles(1, titles);
+ meswin_list = gtk_clist_new_with_titles(1, (gchar **)titles);
gtk_container_add(GTK_CONTAINER(scrolled),meswin_list);
gtk_clist_column_titles_passive(GTK_CLIST(meswin_list));
gtk_clist_set_column_auto_resize(GTK_CLIST(meswin_list), 0, TRUE);
Index: client/gui-gtk/plrdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/plrdlg.c,v
retrieving revision 1.54
diff -u -r1.54 plrdlg.c
--- client/gui-gtk/plrdlg.c 1 May 2004 17:45:34 -0000 1.54
+++ client/gui-gtk/plrdlg.c 11 May 2004 19:35:32 -0000
@@ -142,7 +142,7 @@
N_("Embassy"), N_("Dipl.State"), N_("Vision"), N_("Reputation"),
N_("State"), N_("Host"), N_("Idle"), N_("Ping")
};
- static gchar **titles;
+ static const gchar **titles;
int i;
GtkAccelGroup *accel = gtk_accel_group_new();
GtkWidget *sw;
@@ -167,7 +167,7 @@
gtk_window_set_title(GTK_WINDOW(players_dialog_shell), _("Players"));
- players_list=gtk_clist_new_with_titles(NUM_COLUMNS, titles);
+ players_list=gtk_clist_new_with_titles(NUM_COLUMNS, (gchar **)titles);
for(i=0; i<NUM_COLUMNS; i++)
gtk_clist_set_column_auto_resize (GTK_CLIST (players_list), i, TRUE);
Index: client/gui-gtk/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/repodlgs.c,v
retrieving revision 1.81
diff -u -r1.81 repodlgs.c
--- client/gui-gtk/repodlgs.c 23 Apr 2004 22:58:05 -0000 1.81
+++ client/gui-gtk/repodlgs.c 11 May 2004 19:35:32 -0000
@@ -580,7 +580,7 @@
GtkWidget *close_command, *scrolled;
static const char *titles_[4] = { N_("Building Name"), N_("Count"),
N_("Cost"), N_("U Total") };
- static gchar **titles;
+ static const gchar **titles;
int i;
GtkAccelGroup *accel=gtk_accel_group_new();
@@ -593,7 +593,7 @@
gtk_window_set_title(GTK_WINDOW(economy_dialog_shell),_("Economy"));
- economy_list = gtk_clist_new_with_titles( 4, titles );
+ economy_list = gtk_clist_new_with_titles(4, (gchar **)titles );
gtk_clist_column_titles_passive(GTK_CLIST(economy_list));
scrolled = gtk_scrolled_window_new(NULL,NULL);
gtk_clist_set_selection_mode(GTK_CLIST (economy_list),
GTK_SELECTION_EXTENDED);
@@ -875,7 +875,7 @@
static const char *titles_[AU_COL]
= { N_("Unit Type"), N_("U"), N_("In-Prog"), N_("Active"),
N_("Shield"), N_("Food"), N_("Gold") };
- static gchar **titles;
+ static const gchar **titles;
int i;
GtkAccelGroup *accel=gtk_accel_group_new();
@@ -888,7 +888,7 @@
gtk_window_set_title(GTK_WINDOW(activeunits_dialog_shell),_("Units"));
- activeunits_list = gtk_clist_new_with_titles( AU_COL, titles );
+ activeunits_list = gtk_clist_new_with_titles(AU_COL, (gchar **)titles);
gtk_clist_column_titles_passive(GTK_CLIST(activeunits_list));
for ( i = 0; i < AU_COL; i++ ) {
gtk_clist_set_column_auto_resize(GTK_CLIST(activeunits_list),i,TRUE);
@@ -1121,7 +1121,7 @@
*****************************************************************/
static void create_endgame_report(struct packet_endgame_report *packet)
{
- static gchar **titles;
+ static const gchar **titles;
GtkAccelGroup *accel = gtk_accel_group_new();
char *row[NUM_SCORE_COLS];
char stat[NUM_SCORE_COLS][64];
@@ -1159,7 +1159,7 @@
gtk_accel_group_attach(accel, GTK_OBJECT(endgame_report_shell));
gtk_window_set_title(GTK_WINDOW(endgame_report_shell),
_("The Greatest Civilizations in the world."));
- scores_list = gtk_clist_new_with_titles(NUM_SCORE_COLS, titles);
+ scores_list = gtk_clist_new_with_titles(NUM_SCORE_COLS, (gchar **)titles);
sw = gtk_scrolled_window_new(NULL, NULL);
gtk_container_add(GTK_CONTAINER(sw), scores_list);
Index: client/gui-gtk/wldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/wldlg.c,v
retrieving revision 1.36
diff -u -r1.36 wldlg.c
--- client/gui-gtk/wldlg.c 8 Apr 2004 18:19:09 -0000 1.36
+++ client/gui-gtk/wldlg.c 11 May 2004 19:35:32 -0000
@@ -144,7 +144,7 @@
GtkWidget *button, *scrolled;
GtkAccelGroup *accel;
const char *title[1] = { N_("Available worklists") };
- static char **clist_title = NULL;
+ static const char **clist_title = NULL;
/* Report window already open */
if (report_dialog && report_dialog->shell)
@@ -176,7 +176,7 @@
if (!clist_title) {
clist_title = intl_slist(1, title);
}
- report_dialog->list = gtk_clist_new_with_titles(1, clist_title);
+ report_dialog->list = gtk_clist_new_with_titles(1, (gchar **)clist_title);
gtk_clist_column_titles_passive(GTK_CLIST(report_dialog->list));
gtk_signal_connect(GTK_OBJECT(report_dialog->list), "select_row",
@@ -310,13 +310,13 @@
GtkWidget *button, *scrolled, *dialog_hbox, *hbox, *vbox, *frame;
GtkAccelGroup *accel = gtk_accel_group_new();
- static char **wl_clist_titles = NULL;
+ static const char **wl_clist_titles = NULL;
const char *wl_titles[] = { N_("Type"),
N_("Info"),
N_("Cost")
};
- static char **avail_clist_titles = NULL;
+ static const char **avail_clist_titles = NULL;
const char *avail_titles[] = { N_("Type"),
N_("Info"),
N_("Cost"),
@@ -367,7 +367,7 @@
/* Make the list for current worklist. */
- peditor->worklist = gtk_clist_new_with_titles(3, wl_clist_titles);
+ peditor->worklist = gtk_clist_new_with_titles(3, (gchar **)wl_clist_titles);
gtk_container_add(GTK_CONTAINER(scrolled), peditor->worklist);
for (i = 0; i < 3; i++) {
@@ -430,7 +430,7 @@
/* Make the list for available targets. */
- peditor->avail = gtk_clist_new_with_titles(4, avail_clist_titles);
+ peditor->avail = gtk_clist_new_with_titles(4, (gchar **)avail_clist_titles);
gtk_container_add(GTK_CONTAINER(scrolled), peditor->avail);
for (i = 0; i < 4; i++) {
- [Freeciv-Dev] Re: (PR#8664) gettext and const char *'s,
Jason Short <=
|
|