[evolution-patches] Patch for the bug #41830



hi,

Attach is the patch to fix the bug #41830 on http://bugzilla.ximian.com.
"Keyboard: Can only select two categories with keyboard."

Would you like to spend a little time to review it, please?

Best regards
hao.sheng

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.899
diff -u -r1.899 ChangeLog
--- ChangeLog	17 Sep 2004 07:58:00 -0000	1.899
+++ ChangeLog	20 Sep 2004 06:53:13 -0000
@@ -1,3 +1,20 @@
+2004-09-20  Hao Sheng  <hao sheng sun com>
+
+	Fixed BugzillaID #41830 "Keyboard: Can only select two categories
+	with keyboard."
+
+	* gal/widgets/e-categories.c:
+	(e_categories_rebuild): grab the focus on the cell of the Etable
+	again after rebuilt the e-categories.
+	(focus_current_etable_item): Finds the current descendant of the group
+	that is an ETableItem and focuses it.
+	(e_categories_has_save_id): return false and make the Etable widget
+	can't be focused.
+	(table_click): grab the focus on the cell of the Etable
+	again after rebuilt the e-categories.
+	(e_categories_toggle): the same
+	(e_categories_set_value_at): the same
+
 2004-09-17  JP Rosevear  <jpr novell com>
 
 	* Makefile.am (DISTCLEANFILES): dist clean the .pc file for make
Index: gal/widgets/e-categories.c
===================================================================
RCS file: /cvs/gnome/gal/gal/widgets/e-categories.c,v
retrieving revision 1.35
diff -u -r1.35 e-categories.c
--- gal/widgets/e-categories.c	10 Jun 2004 17:01:14 -0000	1.35
+++ gal/widgets/e-categories.c	20 Sep 2004 06:53:16 -0000
@@ -78,6 +78,7 @@
 static char * e_categories_value_to_string (ETableModel *etc, int col, const void *value, gpointer data);
 static void e_categories_toggle (ECategories *categories, int row);
 static void e_categories_rebuild (ECategories *categories);
+static void focus_current_etable_item (ETableGroup *group, int row);
 
 #define PARENT_TYPE GTK_TYPE_DIALOG
 static GtkDialogClass *parent_class = NULL;
@@ -462,6 +463,7 @@
 	if (col == 1) {
 		categories->priv->selected_list[row] = !categories->priv->selected_list[row];
 		e_categories_rebuild (categories);
+		focus_current_etable_item (E_TABLE_GROUP(categories->priv->table->group), row);
 	}
 	return TRUE;
 }
@@ -731,6 +733,28 @@
 		return categories->priv->category_list[row];
 }
 
+/* Finds the current descendant of the group that is an ETableItem and focuses it */
+static void
+focus_current_etable_item (ETableGroup *group, int row)
+{
+	GnomeCanvasGroup *cgroup;
+	GList *l;
+        
+	cgroup = GNOME_CANVAS_GROUP (group);
+
+	for (l = cgroup->item_list; l; l = l->next) {
+		GnomeCanvasItem *i;
+		i = GNOME_CANVAS_ITEM (l->data);
+
+		if (E_IS_TABLE_GROUP (i))
+			focus_current_etable_item (E_TABLE_GROUP (i), row);
+		else if (E_IS_TABLE_ITEM (i)) {
+			e_table_item_set_cursor (E_TABLE_ITEM (i), 0, row);
+			gnome_canvas_item_grab_focus (i);
+		}
+	}
+}
+
 static void
 e_categories_rebuild (ECategories *categories)
 {
@@ -755,6 +779,7 @@
 {
 	categories->priv->selected_list[row] = !categories->priv->selected_list[row];
 	e_categories_rebuild (categories);
+	focus_current_etable_item (E_TABLE_GROUP(categories->priv->table->group), row);
 }
 
 /* This function sets the value at a particular point in our ETableModel. */
@@ -766,6 +791,7 @@
 		categories->priv->selected_list[row] =
 			GPOINTER_TO_INT (val);
 		e_categories_rebuild (categories);
+		focus_current_etable_item (E_TABLE_GROUP(categories->priv->table->group), row);
 	}
 	if ( col == 1 )
 		return;
@@ -781,7 +807,7 @@
 static gboolean
 e_categories_has_save_id (ETableModel *etc, gpointer data)
 {
-	return TRUE;
+	return FALSE;
 }
 
 static char *



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