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

The worklist editor assumes that if ptr->pcity is NULL, you can't edit
the worklist. This reverses that to allow the global worklist editor
to enable all buttons.

The original reporter only mentions the prepend button but the append
button should also have been affected.

Attached simple patches to trunk and 21 branches that fix this by
modifying the sensitivity check.

Old check:
client can issue commands AND pcity not NULL AND player owns pcity
New check
client can issue commands AND ( (pcity not NULL AND player owns pcity)
OR pcity is NULL)

The "extra" null check is so that we don't get a crash on looking up
an owner for city NULL, of course.

Can someone test this? I can't find any other case than the global
worklist editor where pcity is NULL.

Ulrik

>From 32957c4d9520d8363ae891c18b9bb4fe7427586a Mon Sep 17 00:00:00 2001
From: Ulrik Sverdrup <[EMAIL PROTECTED]>
Date: Thu, 10 Apr 2008 17:41:50 +0200
Subject: [PATCH] (PR#39821) Global Lists Bug... Can't Add to top of list?

The global worklist editor would not allow the < buttons (prepend and
append) to become sensitive, since ptr->pcity is NULL for global
worklits. This fixes that case.

This is a patch for S2_1 branch
---
 client/gui-gtk-2.0/wldlg.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/client/gui-gtk-2.0/wldlg.c b/client/gui-gtk-2.0/wldlg.c
index 29cccdc..4b4d133 100644
--- a/client/gui-gtk-2.0/wldlg.c
+++ b/client/gui-gtk-2.0/wldlg.c
@@ -898,7 +898,9 @@ static void src_selection_callback(GtkTreeSelection *selection, gpointer data)
   /* update widget sensitivity. */
   if (gtk_tree_selection_get_selected(selection, NULL, NULL)) {
     if (can_client_issue_orders()
-	&& ptr->pcity && city_owner(ptr->pcity) == game.player_ptr) {
+      && ( (ptr->pcity && city_owner(ptr->pcity) == game.player_ptr)
+      || !ptr->pcity )) {
+      /* if ptr->pcity is NULL, this is a global worklist */
       gtk_widget_set_sensitive(ptr->change_cmd, TRUE);
       gtk_widget_set_sensitive(ptr->prepend_cmd, TRUE);
       gtk_widget_set_sensitive(ptr->append_cmd, TRUE);
-- 
1.5.4.4

>From 425efab7beb72aec45daccad3ac03f1ddf20c110 Mon Sep 17 00:00:00 2001
From: Ulrik Sverdrup <[EMAIL PROTECTED]>
Date: Thu, 10 Apr 2008 17:41:50 +0200
Subject: [PATCH] (PR#39821) Global Lists Bug... Can't Add to top of list?

The global worklist editor would not allow the < buttons (prepend and
append) to become sensitive, since ptr->pcity is NULL for global
worklits. This fixes that case.
---
 client/gui-gtk-2.0/wldlg.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/client/gui-gtk-2.0/wldlg.c b/client/gui-gtk-2.0/wldlg.c
index a3373d1..6f39638 100644
--- a/client/gui-gtk-2.0/wldlg.c
+++ b/client/gui-gtk-2.0/wldlg.c
@@ -873,7 +873,9 @@ static void src_selection_callback(GtkTreeSelection *selection, gpointer data)
   /* update widget sensitivity. */
   if (gtk_tree_selection_get_selected(selection, NULL, NULL)) {
     if (can_client_issue_orders()
-	&& ptr->pcity && city_owner(ptr->pcity) == client.conn.playing) {
+      && ( (ptr->pcity && city_owner(ptr->pcity) == client.conn.playing)
+      || !ptr->pcity )) {
+      /* if ptr->pcity is NULL, this is a global worklist */
       gtk_widget_set_sensitive(ptr->change_cmd, TRUE);
       gtk_widget_set_sensitive(ptr->prepend_cmd, TRUE);
       gtk_widget_set_sensitive(ptr->append_cmd, TRUE);
-- 
1.5.4.4

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to