<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40677 >

This is the S2_1 port of 40621, and is part of the "basic
usability features" for multiplayer 2.1 games. The patch
moves the city report governor menu to its own city report
toplevel menu entry for ease of accessibility.


-----------------------------------------------------------------------
砲撃は始まります。
diff --git a/client/gui-gtk-2.0/cityrep.c b/client/gui-gtk-2.0/cityrep.c
index fef2336..99eb2ee 100644
--- a/client/gui-gtk-2.0/cityrep.c
+++ b/client/gui-gtk-2.0/cityrep.c
@@ -95,15 +95,17 @@ static void popup_last_menu(GtkMenuShell *menu, gpointer data);
 static void popup_first_menu(GtkMenuShell *menu, gpointer data);
 static void popup_next_menu(GtkMenuShell *menu, gpointer data);
 
-static GtkWidget *city_center_command, *city_popup_command, *city_buy_command;
+static GtkWidget *city_center_command;
+static GtkWidget *city_popup_command;
+static GtkWidget *city_buy_command;
 static GtkWidget *city_production_command;
+static GtkWidget *city_governor_command;
 static GtkWidget *city_total_buy_cost_label;
 
 
 static GtkWidget *change_improvements_item;
 static GtkWidget *change_units_item;
 static GtkWidget *change_wonders_item;
-static GtkWidget *change_cma_item;
 
 static GtkWidget *last_improvements_item;
 static GtkWidget *last_units_item;
@@ -542,6 +544,11 @@ static void append_cma_to_menu_item(GtkMenuItem *parent_item, bool change_cma)
   struct cm_parameter parameter;
   GtkWidget *w;
 
+  w = gtk_menu_item_get_submenu(parent_item);
+  if (w != NULL && GTK_WIDGET_VISIBLE(w)) {
+    return;
+  }
+
   gtk_menu_item_remove_submenu(parent_item);
   if (!can_client_issue_orders()) {
     return;
@@ -712,6 +719,11 @@ static GtkWidget *create_city_report_menubar(void)
   gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
   create_last_menu(item);
 
+  item = gtk_menu_item_new_with_mnemonic(_("Gover_nor"));
+  city_governor_command = item;
+  gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
+  append_cma_to_menu_item(GTK_MENU_ITEM(item), TRUE);
+
   item = gtk_menu_item_new_with_mnemonic(_("_Select"));
   gtk_menu_shell_append(GTK_MENU_SHELL(menubar), item);
   create_select_menu(item);
@@ -1173,6 +1185,10 @@ void city_report_dialog_update(void)
 
     city_selection_changed_callback(city_selection);
 
+    if (GTK_WIDGET_SENSITIVE(city_governor_command)) {
+      append_cma_to_menu_item(GTK_MENU_ITEM(city_governor_command), TRUE);
+    }
+
     select_menu_cached = FALSE;
   }
 }
@@ -1228,8 +1244,6 @@ static void create_change_menu(GtkWidget *item)
   gtk_menu_shell_append(GTK_MENU_SHELL(menu), change_improvements_item);
   change_wonders_item = gtk_menu_item_new_with_label(_("Wonders"));
   gtk_menu_shell_append(GTK_MENU_SHELL(menu), change_wonders_item);
-  change_cma_item = gtk_menu_item_new_with_label(_("Citizen Governor"));
-  gtk_menu_shell_append(GTK_MENU_SHELL(menu), change_cma_item);
 }
 
 /****************************************************************
@@ -1312,7 +1326,6 @@ static void popup_change_menu(GtkMenuShell *menu, gpointer data)
 				  FALSE, TRUE, CO_CHANGE,
 				  city_can_build_impr_or_unit,
 				  G_CALLBACK(select_impr_or_unit_callback), n);
-  append_cma_to_menu_item(GTK_MENU_ITEM(change_cma_item), TRUE);
 }
 
 /****************************************************************
@@ -1588,6 +1601,7 @@ static void city_selection_changed_callback(GtkTreeSelection *selection)
 
   if (n == 0) {
     gtk_widget_set_sensitive(city_production_command, FALSE);
+    gtk_widget_set_sensitive(city_governor_command, FALSE);
     gtk_widget_set_sensitive(city_center_command, FALSE);
     gtk_widget_set_sensitive(city_popup_command, FALSE);
     gtk_widget_set_sensitive(city_buy_command, FALSE);
@@ -1601,6 +1615,8 @@ static void city_selection_changed_callback(GtkTreeSelection *selection)
 
     gtk_widget_set_sensitive(city_production_command,
 			     can_client_issue_orders());
+    gtk_widget_set_sensitive(city_governor_command,
+                             can_client_issue_orders());
     gtk_widget_set_sensitive(city_center_command, TRUE);
     gtk_widget_set_sensitive(city_popup_command, TRUE);
     gtk_widget_set_sensitive(city_buy_command, can_client_issue_orders());
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to