[evolution-patches] 40996: combo cells require double click to select



This fixes the problem by using the selection_changed signal to manage
the popping down of the popup list.

Mike
Index: NEWS
===================================================================
RCS file: /cvs/gnome/gal/NEWS,v
retrieving revision 1.12
diff -u -p -r1.12 NEWS
--- NEWS	29 Apr 2003 21:32:04 -0000	1.12
+++ NEWS	30 Apr 2003 16:31:03 -0000
@@ -4,6 +4,7 @@ gal-1.99.5  ????-??-??
 
 Bugzilla bugs fixed (see http://bugzilla.ximian.com/show_bug.cgi):
 
+	#40996 - Combo cells require double click to select item.(Mike)
 	#41158 - Incorrect button ordering on categories dialog. (Toshok)
 
 ----------------------
Index: gal/e-table/ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v
retrieving revision 1.889
diff -u -p -r1.889 ChangeLog
--- gal/e-table/ChangeLog	29 Apr 2003 18:27:04 -0000	1.889
+++ gal/e-table/ChangeLog	30 Apr 2003 16:31:09 -0000
@@ -1,3 +1,9 @@
+2003-04-30  Mike Kestner  <mkestner ximian com>
+
+	* e-cell-combo.c (e_cell_combo_selection_changed): new
+	(e_cell_combo_init): connect to selection_changed on popup_list
+	(e_cell_combo_do_popup): block selection_changed while popping up
+	
 2003-04-29  Mike Kestner  <mkestner ximian com>
 
 	* e-cell-text.c (build_layout): don't use unicode ellipsis so
Index: gal/e-table/e-cell-combo.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-cell-combo.c,v
retrieving revision 1.14
diff -u -p -r1.14 e-cell-combo.c
--- gal/e-table/e-cell-combo.c	17 Nov 2002 00:02:52 -0000	1.14
+++ gal/e-table/e-cell-combo.c	30 Apr 2003 16:31:10 -0000
@@ -92,6 +92,8 @@ static void e_cell_combo_get_popup_pos	(
 					 gint		*height,
 					 gint		*width);
 
+static void e_cell_combo_selection_changed(GtkWidget *popup_list, ECellCombo *ecc);
+
 static gint e_cell_combo_button_press	(GtkWidget	*popup_window,
 					 GdkEvent	*event,
 					 ECellCombo	*ecc);
@@ -163,16 +165,20 @@ e_cell_combo_init			(ECellCombo	*ecc)
 					     gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
 	gtk_widget_show (ecc->popup_list);
 
+	g_signal_connect (ecc->popup_list,
+			  "selection_changed",
+			  G_CALLBACK (e_cell_combo_selection_changed),
+			  ecc);
 	g_signal_connect (ecc->popup_window,
 			  "button_press_event",
 			  G_CALLBACK (e_cell_combo_button_press),
 			  ecc);
 	/* We use connect_after here so the list updates the selection before
 	   we hide the popup and update the cell. */
-	g_signal_connect_after (ecc->popup_window,
-				"button_release_event",
-				G_CALLBACK (e_cell_combo_button_release),
-				ecc);
+	g_signal_connect (ecc->popup_window,
+			  "button_release_event",
+			  G_CALLBACK (e_cell_combo_button_release),
+			  ecc);
 	g_signal_connect (ecc->popup_window,
 			  "key_press_event",
 			  G_CALLBACK (e_cell_combo_key_press), ecc);
@@ -257,8 +263,10 @@ e_cell_combo_do_popup			(ECellPopup	*ecp
 	guint32 time;
 	gint error_code;
 
+	g_signal_handlers_block_by_func(ecc->popup_list, e_cell_combo_selection_changed, ecc);
 	e_cell_combo_show_popup (ecc, row, view_col);
 	e_cell_combo_select_matching_item (ecc);
+	g_signal_handlers_unblock_by_func(ecc->popup_list, e_cell_combo_selection_changed, ecc);
 
 	if (event->type == GDK_BUTTON_PRESS) {
 		GTK_LIST (ecc->popup_list)->drag_selection = TRUE;
@@ -489,8 +497,21 @@ e_cell_combo_get_popup_pos		(ECellCombo	
 		*height = work_height + list_requisition.height;
 }
 
+static void
+e_cell_combo_selection_changed(GtkWidget *popup_list, ECellCombo *ecc)
+{
+	if (!GTK_LIST(popup_list)->selection || !GTK_WIDGET_REALIZED(ecc->popup_window))
+		return;
 
+	gtk_grab_remove (ecc->popup_window);
+	gdk_pointer_ungrab (gtk_get_current_event_time());
+	gtk_widget_hide (ecc->popup_window);
 
+	e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE);
+
+	e_cell_combo_update_cell (ecc);
+	e_cell_combo_restart_edit (ecc);
+}
 
 /* This handles button press events in the popup window.
    Note that since we have a pointer grab on this window, we also get button


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