Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2003:
[Freeciv-Dev] Re: (PR#6205) fix unit popup dialog for gui-gtk
Home

[Freeciv-Dev] Re: (PR#6205) fix unit popup dialog for gui-gtk

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#6205) fix unit popup dialog for gui-gtk
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 21 Sep 2003 21:06:34 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Gregory Berkolaiko wrote:
> On Fri, 19 Sep 2003, Jason Short wrote:
> 
> 
>>Now that the unit popup dialog can be given non-owned units (well, it 
>>always could, but now it's official) some things need to change:
>>
>>- Better handling of when whe don't know the homecity.  Rather than 
>>"Musketeers()" we should just have "Musketeers".
>>
>>- Disable the "Ready all" button if we don't own any units on the tile.
>>
>>This patch is just for gui-gtk.  Similar changes should be made to other 

And the patch.

jason

Index: client/gui-gtk/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.130
diff -u -r1.130 dialogs.c
--- client/gui-gtk/dialogs.c    2003/08/04 15:42:46     1.130
+++ client/gui-gtk/dialogs.c    2003/09/19 21:24:38
@@ -1679,6 +1679,7 @@
   char buffer[512];
   GtkWidget *pix, *hbox, *table;
   GtkWidget *unit_select_all_command, *unit_select_close_command;
+  bool can_ready = FALSE;
 
   if (!unit_select_dialog_shell){
   gtk_widget_set_sensitive(top_vbox, FALSE);
@@ -1703,6 +1704,9 @@
     struct unit_type *punittemp=unit_type(punit);
     struct city *pcity;
 
+    /* The "Ready all" button is activated if any units are owned by us. */
+    can_ready = can_ready || (unit_owner(punit) == game.player_ptr);
+
     hbox = gtk_hbox_new(FALSE,10);
     gtk_table_attach_defaults(GTK_TABLE(table), hbox, 
                                (i/r), (i/r)+1,
@@ -1713,10 +1717,13 @@
 
     pcity=player_find_city_by_id(game.player_ptr, punit->homecity);
 
-    my_snprintf(buffer, sizeof(buffer), "%s(%s)\n%s",
-           punittemp->name, 
-           pcity ? pcity->name : "",
-           unit_activity_text(punit));
+    if (pcity) {
+      my_snprintf(buffer, sizeof(buffer), "%s (%s)\n%s",
+                 punittemp->name, pcity->name, unit_activity_text(punit));
+    } else {
+      my_snprintf(buffer, sizeof(buffer), "%s\n%s",
+                 punittemp->name, unit_activity_text(punit));
+    }
 
     pix = gtk_pixcomm_new(root_window, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
 
@@ -1752,6 +1759,7 @@
   gtk_box_pack_start( 
GTK_BOX(GTK_DIALOG(unit_select_dialog_shell)->action_area),
        unit_select_all_command, TRUE, TRUE, 0 );
   GTK_WIDGET_SET_FLAGS( unit_select_all_command, GTK_CAN_DEFAULT );
+  gtk_widget_set_sensitive(unit_select_all_command, can_ready);
 
   gtk_signal_connect(GTK_OBJECT(unit_select_close_command), "clicked",
        GTK_SIGNAL_FUNC(unit_select_callback), NULL);

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