[g-a-devel]Patch for bug 91993 in at-poke



The attached patch fixes bug 91993; it does not attempt to select two elements 
when no element is selected.

I will apply if there are no objections.

Padraig
? config.h.in
? icons/Makefile
? icons/Makefile.in
cvs server: Diffing .
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/at-poke/ChangeLog,v
retrieving revision 1.36
diff -u -p -r1.36 ChangeLog
--- ChangeLog	24 Sep 2002 13:14:48 -0000	1.36
+++ ChangeLog	1 Oct 2002 12:21:50 -0000
@@ -1,3 +1,14 @@
+2002-10-01  Padraig O'Briain   <padraig obriain sun com>
+
+	* src/poke.c
+	Add idle handler id for selection-changed to Poker data structure.
+	(update_if_selection): Ignore child which is a TableColumnHeader
+	(do_selection): Idle handler for doing the selection.
+	(selection_changed_cb): Do the selection in an idle handler.
+	(poke): Remove idle handler for selection change if it exists.
+
+	These changes fix bug #91993.
+
 2002-09-24  Padraig O'Briain   <padraig obriain sun com>
 
 	* src/accessible-tree-model.c 
cvs server: Diffing glade
cvs server: Diffing icons
cvs server: Diffing src
Index: src/poke.c
===================================================================
RCS file: /cvs/gnome/at-poke/src/poke.c,v
retrieving revision 1.25
diff -u -p -r1.25 poke.c
--- src/poke.c	19 Sep 2002 16:45:45 -0000	1.25
+++ src/poke.c	1 Oct 2002 12:21:50 -0000
@@ -88,6 +88,7 @@ typedef struct {
 
 	AccessibleCoordType ctype;
 	gboolean      poker_died;
+	guint         selection_changed_idle_id;
 } Poker;
 
 enum {
@@ -769,8 +770,13 @@ update_if_selection (Poker *poker, Acces
 		
 		child = Accessible_getChildAtIndex (parent, i);
 
-		name = Accessible_getName (child);
 		role = Accessible_getRole (child);
+		if (role == SPI_ROLE_TABLE_COLUMN_HEADER) {
+			Accessible_unref (child);
+			continue;
+		}
+		name = Accessible_getName (child);
+		
 		descr = Accessible_getDescription (child);
 
 		if (!name || !name [0]) {
@@ -819,13 +825,18 @@ select_accessible_cb (GtkTreeModel *mode
 	AccessibleSelection_selectChild (selection, g_value_get_int (idx));
 }
 
-static void
-selection_changed_cb (GtkTreeSelection *tree_selection, Poker *poker)
+static gboolean
+do_selection (Poker *poker)
 {
 	AccessibleSelection *selection;
+	GtkTreeSelection *tree_selection;
+
+	poker->selection_changed_idle_id = 0;
 
 	selection = Accessible_getSelection (poker->selected);
-	g_return_if_fail (selection != NULL);
+	g_return_val_if_fail (selection != NULL, FALSE);
+
+	tree_selection = gtk_tree_view_get_selection (poker->selection_view);
 
 	gtk_tree_selection_selected_foreach (
 		tree_selection, select_accessible_cb, selection);
@@ -833,6 +844,21 @@ selection_changed_cb (GtkTreeSelection *
 /*	update_if_selection (poker, selection); */
 
 	AccessibleSelection_unref (selection);
+
+	return FALSE;
+}
+
+static void
+selection_changed_cb (GtkTreeSelection *tree_selection, Poker *poker)
+{
+	/*
+	 * When one clicks on a row in the TreeView which currently does not
+	 * have any row selected one first gets notification of selection for 
+	 * the first row and then a subsequent notification for the selected
+	 * row if it is different from the first row.
+	 */
+	if (!poker->selection_changed_idle_id)
+		poker->selection_changed_idle_id = gtk_idle_add (do_selection, poker);
 }
 
 static void
@@ -1414,6 +1440,9 @@ poke (Accessible *accessible)
 		gtk_widget_destroy (poker->window);
 	g_object_unref (poker->tree_model);	
 	g_object_unref (poker->xml);
+	if (poker->selection_changed_idle_id)
+		gtk_idle_remove (poker->selection_changed_idle_id);
+
 	poker_died = poker->poker_died;
 	g_free (poker);
 	if (!poker_died)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]