Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#10819) help dialog opened without cause
Home

[Freeciv-Dev] (PR#10819) help dialog opened without cause

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#10819) help dialog opened without cause
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Mon, 1 Nov 2004 11:33:06 -0800
Reply-to: rt@xxxxxxxxxxx

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

> [chrisk - Mon Nov 01 08:20:28 2004]:
> 
> CVS 01 NOV 2004 S2_0 GTK2
> 
> I activate help in science dialog, call help on some items, and close the
> help dialog again.
> 
> Later in game, when I come back so the science tab, in some
situations, the
> help reopens for the item I called help the last time.

This fixes that, but you will need to double-click on the tech list to
open help.

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.61
diff -u -u -r1.61 repodlgs.c
--- client/gui-gtk-2.0/repodlgs.c       31 Oct 2004 20:45:55 -0000      1.61
+++ client/gui-gtk-2.0/repodlgs.c       1 Nov 2004 19:30:55 -0000
@@ -53,7 +53,10 @@
 /******************************************************************/
 
 static void create_science_dialog(bool make_modal);
-static void science_help_callback(GtkTreeSelection *ts, GtkTreeModel *model);
+static void science_help_callback(GtkTreeView *view,
+                                 GtkTreePath *arg1,
+                                 GtkTreeViewColumn *arg2,
+                                 gpointer data);
 static void science_change_callback(GtkWidget * widget, gpointer data);
 static void science_goal_callback(GtkWidget * widget, gpointer data);
 
@@ -255,8 +258,8 @@
        "text", 0, NULL);
     gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
 
-    g_signal_connect(selection, "changed",
-                    G_CALLBACK(science_help_callback), science_model[i]);
+    g_signal_connect(view, "row_activated",
+       G_CALLBACK(science_help_callback), NULL);
   }
 
   gui_dialog_show_all(science_dialog_shell);
@@ -327,24 +330,24 @@
 /****************************************************************
 ...
 *****************************************************************/
-static void science_help_callback(GtkTreeSelection *ts, GtkTreeModel *model)
+static void science_help_callback(GtkTreeView *view,
+                                 GtkTreePath *arg1,
+                                 GtkTreeViewColumn *arg2,
+                                 gpointer data)
 {
-  GtkTreeIter it;
-
-  if (!gtk_tree_selection_get_selected(ts, NULL, &it))
-    return;
-
-  gtk_tree_selection_unselect_all(ts);
+  GtkTreeModel *model = gtk_tree_view_get_model(view);
 
-  if (GTK_TOGGLE_BUTTON(science_help_toggle)->active)
-  {
+  if (GTK_TOGGLE_BUTTON(science_help_toggle)->active) {
+    GtkTreeIter it;
     char *s;
 
+    gtk_tree_model_get_iter(model, &it, arg1);
     gtk_tree_model_get(model, &it, 0, &s, -1);
-    if (*s != '\0')
+    if (*s != '\0') {
       popup_help_dialog_typed(s, HELP_TECH);
-    else
+    } else {
       popup_help_dialog_string(HELP_TECHS_ITEM);
+    }
   }
 }
 

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