Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#7366) sell all ...not really a bug...low priority...
Home

[Freeciv-Dev] (PR#7366) sell all ...not really a bug...low priority...

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: hunter@xxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#7366) sell all ...not really a bug...low priority...
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Wed, 31 Mar 2004 13:58:32 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7366 >

> [i-freeciv-lists@xxxxxxxxxxxxx - Mon Feb 02 11:54:03 2004]:
> 
> On Sun, Feb 01, 2004 at 11:21:00AM -0800, Hunter L. Cook wrote:
> > 
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=7366 >
> > 
> > Hello-
> > 
> > I've been playing freeciv for a long time now...probably around 4
years. 
> > First off, GREAT JOB!!!! This game is outstanding; I always wanted civ2 
> > to have multiplayer capability, and losing that clunky interface in 
> > favor of standard gtk was a big plus too.
> > 
> > Anyhow, the reason I'm writing you guys is to suggest the addition of a 
> > warning dialogue of some kind when you click "sell all" in the economy 
> > window. I keep clicking it accidentally instead of the "ok" button when 
> > I want the screen to go away, and it always sells all my aqueducts. 
> > Sure, it's my stupidity, and I save pretty often, so no big deal....but 
> > it sure would be handy to have. It could say the number and type of 
> > things to sell and the amount you'll get.
> > 
> > Clearly this is of very low priority, but I'd sure appreciate it if you 
> > would consider it for a future release. Also, I must admit that I'm 
> > using 1.14.0, not the latest, so my apologies if this is already done.

And the patch.

Index: client/gui-gtk-2.0/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/repodlgs.c,v
retrieving revision 1.43
diff -u -r1.43 repodlgs.c
--- client/gui-gtk-2.0/repodlgs.c       25 Feb 2004 20:09:50 -0000      1.43
+++ client/gui-gtk-2.0/repodlgs.c       31 Mar 2004 21:52:19 -0000
@@ -64,6 +64,10 @@
 static GtkWidget *popupmenu, *goalmenu;
 
 /******************************************************************/
+enum {
+  ECONOMY_SELL_OBSOLETE = 1, ECONOMY_SELL_ALL
+};
+
 static void create_economy_report_dialog(bool make_modal);
 static void economy_command_callback(GtkWidget *w, gint response_id);
 static void economy_selection_callback(GtkTreeSelection *selection,
@@ -667,14 +671,14 @@
        economy_label2, FALSE, FALSE, 0);
   gtk_misc_set_padding(GTK_MISC(economy_label2), 5, 5);
 
-  sellobsolete_command = gtk_button_new_with_mnemonic(_("Sell Obsolete"));
+  sellobsolete_command = gtk_button_new_with_mnemonic(_("Sell _Obsolete"));
   gtk_dialog_add_action_widget(GTK_DIALOG(economy_dialog_shell),
-                              sellobsolete_command, 1);
+                              sellobsolete_command, ECONOMY_SELL_OBSOLETE);
   gtk_widget_set_sensitive(sellobsolete_command, FALSE);
 
-  sellall_command = gtk_button_new_with_mnemonic(_("Sell All"));
+  sellall_command = gtk_button_new_with_mnemonic(_("Sell _All"));
   gtk_dialog_add_action_widget(GTK_DIALOG(economy_dialog_shell),
-                              sellall_command, 2);
+                              sellall_command, ECONOMY_SELL_ALL);
   gtk_widget_set_sensitive(sellall_command, FALSE);
 
   gtk_dialog_add_button(GTK_DIALOG(economy_dialog_shell),
@@ -734,10 +738,9 @@
   gint row;
   GtkWidget *shell;
 
-  switch (response_id) {
-    case 1:
-    case 2:     break;
-    default:   gtk_widget_destroy(economy_dialog_shell);       return;
+  if (response_id != ECONOMY_SELL_OBSOLETE && response_id != ECONOMY_SELL_ALL) 
{
+    gtk_widget_destroy(economy_dialog_shell);
+    return;
   }
 
   /* sell obsolete and sell all. */
@@ -746,9 +749,26 @@
   i = economy_row_type[row].type;
 
   if (is_impr == TRUE) {
+    if (response_id == ECONOMY_SELL_ALL) {
+      shell = gtk_message_dialog_new(
+         GTK_WINDOW(economy_dialog_shell),
+         GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
+         GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
+         _("Do you really wish to sell your %s?\n"),
+         get_improvement_name(i));
+      gtk_window_set_title(GTK_WINDOW(shell), _("Sell Improvements"));
+
+      if (gtk_dialog_run(GTK_DIALOG(shell)) == GTK_RESPONSE_YES) {
+       gtk_widget_destroy(shell);
+      } else {
+       gtk_widget_destroy(shell);
+       return;
+      }
+    }
+
     city_list_iterate(game.player_ptr->cities, pcity) {
       if (!pcity->did_sell && city_got_building(pcity, i ) &&
-         (response_id == 2 ||
+         (response_id == ECONOMY_SELL_ALL ||
           improvement_obsolete(game.player_ptr, i) ||
           wonder_replacement(pcity, i) )) {
        count++; 
@@ -778,7 +798,7 @@
         * up-to-dates ones. And they are also all obsolete at the same
         * time so if the user want to sell them off, he can use the
         * sell all button */
-       if (punit->type == i && response_id == 2) {
+       if (punit->type == i && response_id == ECONOMY_SELL_ALL) {
          count++;
          request_unit_disband(punit);
        }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7366) sell all ...not really a bug...low priority..., Vasco Alexandre da Silva Costa <=