[Freeciv-Dev] (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 >
> [jdorje - Sat May 08 00:21:53 2004]:
>
> Here's a patch for the gtk2 client.
>
> There was one place where a const char is passed to g_list_append. This
> discards the const qualifier but is probably harmless. I didn't make
> any changes to it.
This patch replaces that GtkComboBox with a GtkOptionMenu that shouldn't
give the same warning.
Index: client/gui-gtk-2.0/connectdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/connectdlg.c,v
retrieving revision 1.35
diff -u -r1.35 connectdlg.c
--- client/gui-gtk-2.0/connectdlg.c 11 May 2004 17:52:25 -0000 1.35
+++ client/gui-gtk-2.0/connectdlg.c 11 May 2004 19:25:37 -0000
@@ -716,19 +716,12 @@
const char *get_aiskill_setting(void)
{
int i;
- char buf[32];
- sz_strlcpy(buf, gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(aiskill)->entry)));
-
- for (i = 0; i < NUM_SKILL_LEVELS; i++) {
- if (strcmp(buf, _(skill_level_names[i])) == 0) {
- return skill_level_names[i];
- }
+ if ((i = gtk_option_menu_get_history(GTK_OPTION_MENU(aiskill))) != -1) {
+ return skill_level_names[i];
+ } else {
+ return /* TRANS: don't translate */ "normal";
}
-
- /* an error of some kind, should never get here. */
- assert(0);
- return /* TRANS: don't translate */ "normal";
}
/**************************************************************************
@@ -737,14 +730,13 @@
void gui_server_connect(void)
{
GtkWidget *label, *table, *scrolled, *listsaved, *listmeta, *listlan;
- GtkWidget *hbox, *vbox, *updatemeta, *updatelan, *align;
+ GtkWidget *hbox, *vbox, *updatemeta, *updatelan, *align, *menu, *item;
GtkWidget *radio;
int i;
char buf[256];
GtkCellRenderer *trenderer, *prenderer;
GtkTreeSelection *selectionsaved, *selectionmeta, *selectionlan;
GSList *group = NULL;
- GList *items = NULL;
GtkAdjustment *adj;
if (dialog) {
@@ -858,13 +850,13 @@
NULL);
gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
- aiskill = gtk_combo_new();
-
- gtk_editable_set_editable(GTK_EDITABLE(GTK_COMBO(aiskill)->entry), FALSE);
+ aiskill = gtk_option_menu_new();
+ menu = gtk_menu_new();
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
- items = g_list_append(items, _(skill_level_names[i]));
+ item = gtk_menu_item_new_with_label(_(skill_level_names[i]));
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
}
- gtk_combo_set_popdown_strings(GTK_COMBO(aiskill), items);
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(aiskill), menu);
gtk_box_pack_start(GTK_BOX(hbox), aiskill, FALSE, FALSE, 0);
|
|