[Freeciv-Dev] Re: (PR#18773) Reordering worklist smeshes it up if there
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] Re: (PR#18773) Reordering worklist smeshes it up if there is just bought unit |
From: |
"Tommi Björkbacka" <tommibj@xxxxxxxxx> |
Date: |
Fri, 21 Jul 2006 09:58:53 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=18773 >
Here is quick fix for this bug. This patch is only for gui-gtk-2.0.
Maybe there should be some information for user why he can't move unit
in worklist(?).
- Tommi
--- wldlg.c.orig 2006-07-21 19:19:40.000000000 +0300
+++ wldlg.c 2006-07-21 19:32:08.000000000 +0300
@@ -602,6 +602,7 @@
GtkTreePath *path;
GtkTreeViewColumn *col;
GtkTreeModel *model;
+ gboolean foundpath;
if (!GTK_WIDGET_IS_SENSITIVE(ptr->dst_view)) {
return;
@@ -616,13 +617,21 @@
gtk_tree_model_get_iter(model, &it_prev, path);
it = it_prev;
gtk_tree_model_iter_next(model, &it);
-
- gtk_list_store_swap(GTK_LIST_STORE(model), &it, &it_prev);
-
- gtk_tree_view_set_cursor(GTK_TREE_VIEW(ptr->dst_view), path, col, FALSE);
- commit_worklist(ptr);
+
+ foundpath = gtk_tree_path_prev(path);
+ if (!ptr->pcity->did_buy || foundpath) {
+ if (foundpath) {
+ gtk_tree_path_next(path);
+ }
+
+ gtk_list_store_swap(GTK_LIST_STORE(model), &it, &it_prev);
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(ptr->dst_view),
+ path, col, FALSE);
+ commit_worklist(ptr);
+ }
}
}
+
gtk_tree_path_free(path);
}
@@ -649,6 +658,7 @@
GtkTreePath *path;
GtkTreeViewColumn *col;
GtkTreeModel *model;
+ gboolean foundpath;
if (!GTK_WIDGET_IS_SENSITIVE(ptr->dst_view)) {
return;
@@ -662,11 +672,18 @@
gtk_tree_model_get_iter(model, &it, path);
it_next = it;
if (gtk_tree_model_iter_next(model, &it_next)) {
- gtk_list_store_swap(GTK_LIST_STORE(model), &it, &it_next);
-
- gtk_tree_path_next(path);
- gtk_tree_view_set_cursor(GTK_TREE_VIEW(ptr->dst_view), path, col, FALSE);
- commit_worklist(ptr);
+ foundpath = gtk_tree_path_prev(path);
+ if (!ptr->pcity->did_buy || foundpath) {
+ if (foundpath) {
+ gtk_tree_path_next(path);
+ }
+
+ gtk_list_store_swap(GTK_LIST_STORE(model), &it, &it_next);
+ gtk_tree_path_next(path);
+ gtk_tree_view_set_cursor(GTK_TREE_VIEW(ptr->dst_view),
+ path, col, FALSE);
+ commit_worklist(ptr);
+ }
}
}
gtk_tree_path_free(path);
|
|