Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2003:
[Freeciv-Dev] Re: (PR#3590) Correct parameter: s/int/bool/
Home

[Freeciv-Dev] Re: (PR#3590) Correct parameter: s/int/bool/

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#3590) Correct parameter: s/int/bool/
From: "Raimar Falke" <rf13@xxxxxxxxxxxxxxxxx>
Date: Wed, 26 Mar 2003 10:52:09 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Sun, Mar 02, 2003 at 01:46:46PM -0800, Raimar Falke wrote:
> On Sun, Mar 02, 2003 at 03:38:16AM -0500, Jason Dorje Short wrote:
> > I think the second parameter to translate_menu_path should be a bool

And the patch.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "A common mistake that people make, when trying to design 
  something completely foolproof is to underestimate the 
  ingenuity of complete fools."
    -- Douglas Adams in Mostly Harmless

Index: client/gui-gtk/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/menu.c,v
retrieving revision 1.73
diff -u -u -r1.73 menu.c
--- client/gui-gtk/menu.c       2003/03/02 01:36:33     1.73
+++ client/gui-gtk/menu.c       2003/03/26 18:50:21
@@ -801,7 +801,7 @@
 
   Path should include underscores like in the menu itself.
 *****************************************************************/
-static const char *translate_menu_path(const char *path, int remove_uline)
+static const char *translate_menu_path(const char *path, bool remove_uline)
 {
 #ifndef ENABLE_NLS
   static char res[100];
@@ -867,8 +867,9 @@
 
   item_factory=gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel);
    
-  for(i=0; i<nmenu_items; i++) {
-    menu_items[i].path = mystrdup(translate_menu_path(menu_items[i].path, 0));
+  for (i = 0; i < nmenu_items; i++) {
+    menu_items[i].path =
+       mystrdup(translate_menu_path(menu_items[i].path, FALSE));
   }
   
   gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, NULL);
@@ -890,7 +891,7 @@
 {
   GtkWidget *item;
 
-  path = translate_menu_path(path, 1);
+  path = translate_menu_path(path, TRUE);
   
   if(!(item=gtk_item_factory_get_widget(item_factory, path))) {
     freelog(LOG_ERROR,
@@ -910,7 +911,7 @@
 {
   GtkWidget *item;
 
-  path = translate_menu_path(path, 1);
+  path = translate_menu_path(path, TRUE);
 
   if (!(item = gtk_item_factory_get_widget(item_factory, path))) {
     freelog(LOG_ERROR,
@@ -931,7 +932,7 @@
 {
   GtkWidget *item;
   
-  path = translate_menu_path(path, 1);
+  path = translate_menu_path(path, TRUE);
   
   if(!(item=gtk_item_factory_get_widget(item_factory, path))) {
     freelog(LOG_ERROR, "Can't show non-existent menu %s.", path);
@@ -955,7 +956,7 @@
 {
   GtkWidget *item;
   
-  path = translate_menu_path(path, 1);
+  path = translate_menu_path(path, TRUE);
   
   if(!(item=gtk_item_factory_get_widget(item_factory, path))) {
     freelog(LOG_ERROR, "Can't rename non-existent menu %s.", path);
@@ -992,12 +993,12 @@
     menus_set_sensitive("<main>/_Orders", FALSE);
   } else {
     struct unit *punit;
-    GtkWidget *parent, *item;
-    const char *path;
+    GtkWidget *item;
+    const char *path =
+       translate_menu_path("<main>/_Kingdom/_Government", TRUE);
+    GtkWidget *parent = gtk_item_factory_get_widget(item_factory, path);
 
-    path = translate_menu_path("<main>/_Kingdom/_Government", 1);
-
-    if ((parent = gtk_item_factory_get_widget(item_factory, path))) {
+    if (parent) {
       int i;
       GList *iter, *iter_next;
 
Index: client/gui-gtk-2.0/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/menu.c,v
retrieving revision 1.15
diff -u -u -r1.15 menu.c
--- client/gui-gtk-2.0/menu.c   2003/03/07 01:07:22     1.15
+++ client/gui-gtk-2.0/menu.c   2003/03/26 18:50:21
@@ -826,7 +826,7 @@
 /****************************************************************
 ...
 *****************************************************************/
-static const char *translate_menu_path(const char *path, int remove_uline)
+static const char *translate_menu_path(const char *path, bool remove_uline)
 {
 #ifndef ENABLE_NLS
   static char res[100];
@@ -893,8 +893,9 @@
   item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, 
"<main>",toplevel_accel);
   gtk_accel_group_lock(toplevel_accel);
    
-  for(i=0; i<nmenu_items; i++) {
-    menu_items[i].path = mystrdup(translate_menu_path(menu_items[i].path, 0));
+  for (i = 0; i < nmenu_items; i++) {
+    menu_items[i].path =
+       mystrdup(translate_menu_path(menu_items[i].path, FALSE));
   }
   
   gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, NULL);
@@ -912,7 +913,7 @@
 {
   GtkWidget *item;
 
-  path = translate_menu_path(path, 1);
+  path = translate_menu_path(path, TRUE);
   
   if(!(item=gtk_item_factory_get_item(item_factory, path))) {
     freelog(LOG_ERROR,
@@ -930,7 +931,7 @@
 {
   GtkWidget *item;
 
-  path = translate_menu_path(path, 1);
+  path = translate_menu_path(path, TRUE);
 
   if (!(item = gtk_item_factory_get_item(item_factory, path))) {
     freelog(LOG_ERROR,
@@ -949,7 +950,7 @@
 {
   GtkWidget *item;
   
-  path = translate_menu_path(path, 1);
+  path = translate_menu_path(path, TRUE);
   
   if(!(item=gtk_item_factory_get_item(item_factory, path))) {
     freelog(LOG_ERROR, "Can't show non-existent menu %s.", path);
@@ -970,7 +971,7 @@
 {
   GtkWidget *item;
   
-  path = translate_menu_path(path, 1);
+  path = translate_menu_path(path, TRUE);
   
   if(!(item=gtk_item_factory_get_item(item_factory, path))) {
     freelog(LOG_ERROR, "Can't rename non-existent menu %s.", path);
@@ -1002,12 +1003,12 @@
     menus_set_sensitive("<main>/_Orders", FALSE);
   } else {
     struct unit *punit;
-    GtkWidget *parent, *item;
-    const char *path;
+    GtkWidget *item;
+    const char *path =
+       translate_menu_path("<main>/_Kingdom/_Government", TRUE);
+    GtkWidget *parent = gtk_item_factory_get_widget(item_factory, path);
 
-    path = translate_menu_path("<main>/_Kingdom/_Government", 1);
-
-    if ((parent = gtk_item_factory_get_widget(item_factory, path))) {
+    if (parent) {
       int i;
       GList *iter, *iter_next;
 

[Prev in Thread] Current Thread [Next in Thread]