[Freeciv-Dev] (PR#10714) In GTK2 unit list dialog, no choice to load uni
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10714 >
> [bretta - Mon Oct 25 02:46:40 2004]:
>
> Now that sentrying doesn't load units into a transport, there doesn't
> seem to be an option to load them in the GTK2 "present units" city
> dialog in the overview tab. The choices are:
> Activate Unit
> Activate Unit, close dialog
> sentry unit
> fortify unit
> disband unit
> make new homecity
> upgrade unit
>
> We should haver an option that says "Load unit".
Here is a patch.
Index: client/gui-gtk-2.0/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/citydlg.c,v
retrieving revision 1.97
diff -u -r1.97 citydlg.c
--- client/gui-gtk-2.0/citydlg.c 23 Oct 2004 21:02:36 -0000 1.97
+++ client/gui-gtk-2.0/citydlg.c 25 Oct 2004 03:00:17 -0000
@@ -230,6 +230,7 @@
gpointer data);
static void present_unit_activate_close_callback(GtkWidget * w,
gpointer data);
+static void unit_load_callback(GtkWidget * w, gpointer data);
static void unit_sentry_callback(GtkWidget * w, gpointer data);
static void unit_fortify_callback(GtkWidget * w, gpointer data);
static void unit_disband_callback(GtkWidget * w, gpointer data);
@@ -1944,6 +1945,16 @@
GINT_TO_POINTER(punit->id));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+ item = gtk_menu_item_new_with_mnemonic(_("_Load unit"));
+ g_signal_connect(item, "activate",
+ G_CALLBACK(unit_load_callback),
+ GINT_TO_POINTER(punit->id));
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+
+ if (!can_unit_load(punit, find_transporter_for_unit(punit, punit->tile))) {
+ gtk_widget_set_sensitive(item, FALSE);
+ }
+
item = gtk_menu_item_new_with_mnemonic(_("_Sentry unit"));
g_signal_connect(item, "activate",
G_CALLBACK(unit_sentry_callback),
@@ -2109,6 +2120,18 @@
/****************************************************************
...
*****************************************************************/
+static void unit_load_callback(GtkWidget * w, gpointer data)
+{
+ struct unit *punit;
+
+ if ((punit = player_find_unit_by_id(game.player_ptr, (size_t) data))) {
+ request_unit_load(punit, NULL);
+ }
+}
+
+/****************************************************************
+...
+*****************************************************************/
static void unit_sentry_callback(GtkWidget * w, gpointer data)
{
struct unit *punit;
|
|