Re: [evolution-patches] New patch for trunk #51626: can't navigate to the Click to add area by Tab key




ahh right, i see, its only a canvas item, blah.

sure, go for it.  consider the patch approved.


On Thu, 2004-04-29 at 17:26 -0400, Bruce Tao wrote:
I tried "key_press_event", but it says this signal is invalid for both 
the two.

And in the callback functions i only deals with the key press event, 
returning false for other events,
which enables other functions to catch them.

If there is any trick to solve this problem ?

- Regards from bruce.


Not Zed wrote:

> On Wed, 2004-04-28 at 16:31 -0400, Bruce Tao wrote:
>
>>Sorry , i forget the patch just now.
>>
>>Thx for your reviews!
>>
>>Now i've justified the code style.
>>    
>>
> There's still an
> }
> else {
> in there.
>
> Also, you're still listening to event rather than key_pressed_event.
>
>>Further, as you see, i don't override the Tab key event of e-table-item, 
>>but add a Ctrl+Tab dealer, for i intend to let the user
>>jump out of the "click to add" area immediately instead of going right 
>>until the last column and then jump out.
>>    
>>
>Right yep, i misread that, sorry.
>  
>
>> 
>>    
>>
> 	*Michael Zucchi* <notzed ximian com <mailto:notzed ximian com>>
>
> /Ximian Evolution <http://codeblogs.ximian.com/blogs/evolution/> and 
> Free Software <http://www.gnu.org/philosophy/free-sw.html> Developer/ 	
>
> *Novell, Inc. <http://www.novell.com/>*
>

Plain text document attachment (patch)
Index: gal/e-table/ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v
retrieving revision 1.925
diff -u -r1.925 ChangeLog
--- gal/e-table/ChangeLog	10 Mar 2004 06:28:46 -0000	1.925
+++ gal/e-table/ChangeLog	29 Apr 2004 08:14:20 -0000
@@ -1,3 +1,19 @@
+2004-04-22  Bruce Tao  <bruce tao sun com>
+
+	Fixes #51626
+
+	* e-table-click-to-add.c: (etcta_event):
+	Add an entry for focus_in event, do the same thing as button_press event.
+
+	* e-table-item.c: (eti_event):
+	Mask the Ctrl+Tab processing routine.
+
+	* e-table.c: (table_canvas_focus_event_cb), (canvas_vbox_event),
+	(click_to_add_event), (e_table_setup_table):
+	Enable you to navigate between click_to_add and the existing tasks by
+	pressing Ctrl+Tab. However, if there is no existing task, you can still jump
+	out of click_to_add by this way.
+
 2004-03-10  Hao Sheng  <hao sheng sun com>
 
 	Fixes #55198
Index: gal/e-table/e-table-click-to-add.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-click-to-add.c,v
retrieving revision 1.37
diff -u -r1.37 e-table-click-to-add.c
--- gal/e-table/e-table-click-to-add.c	17 Dec 2003 02:35:20 -0000	1.37
+++ gal/e-table/e-table-click-to-add.c	29 Apr 2004 08:14:21 -0000
@@ -348,6 +348,10 @@
 	ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item);
 
 	switch (e->type){
+	case GDK_FOCUS_CHANGE:
+		if (!e->focus_change.in)
+			return TRUE;
+
 	case GDK_BUTTON_PRESS:
 		if (etcta->text) {
 			gtk_object_destroy(etcta->text);
Index: gal/e-table/e-table-item.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-item.c,v
retrieving revision 1.233
diff -u -r1.233 e-table-item.c
--- gal/e-table/e-table-item.c	26 Feb 2004 11:45:52 -0000	1.233
+++ gal/e-table/e-table-item.c	29 Apr 2004 08:14:29 -0000
@@ -2682,6 +2682,10 @@
 		case GDK_Tab:
 		case GDK_KP_Tab:
 		case GDK_ISO_Left_Tab:
+			if ((e->key.state & GDK_CONTROL_MASK) != 0) {
+				return_val = FALSE;
+				break;
+			}
 			if (eti->cursor_mode == E_CURSOR_SPREADSHEET) {
 				if ((e->key.state & GDK_SHIFT_MASK) != 0){
 				/* shift tab */
Index: gal/e-table/e-table.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table.c,v
retrieving revision 1.228
diff -u -r1.228 e-table.c
--- gal/e-table/e-table.c	2 Dec 2003 07:55:14 -0000	1.228
+++ gal/e-table/e-table.c	29 Apr 2004 08:14:40 -0000
@@ -1117,8 +1117,62 @@
 
 	etable = E_TABLE (data);
 
-	if (!canvas->focused_item && etable->group)
-		focus_first_etable_item (etable->group);
+	if (e_table_model_row_count(etable->model) < 1 
+	    && (etable->click_to_add) 
+	    && !(E_TABLE_CLICK_TO_ADD(etable->click_to_add)->row)) {
+		gnome_canvas_item_grab_focus (etable->canvas_vbox);
+		gnome_canvas_item_grab_focus (etable->click_to_add);
+	} else if (!canvas->focused_item && etable->group) {
+        	focus_first_etable_item (etable->group);
+	}
+
+	return TRUE;
+}
+
+static gboolean
+canvas_vbox_event (ECanvasVbox *vbox, GdkEventKey *key, ETable *etable)
+{
+	GnomeCanvas *canvas;
+
+	canvas = GNOME_CANVAS (etable->table_canvas);
+	switch (key->keyval) {
+		case GDK_Tab:
+		case GDK_KP_Tab:
+		case GDK_ISO_Left_Tab:
+			if ((key->state & GDK_CONTROL_MASK) && etable->click_to_add) {
+				gnome_canvas_item_grab_focus (etable->click_to_add);
+				break;
+			}
+		default:
+			return FALSE;
+	}
+
+	return TRUE;
+}
+
+static gboolean
+click_to_add_event (ETableClickToAdd *etcta, GdkEventKey *key, ETable *etable)
+{
+	GnomeCanvas *canvas;
+
+	canvas = GNOME_CANVAS (etable->table_canvas);
+	switch (key->keyval) {
+		case GDK_Tab:
+		case GDK_KP_Tab:
+		case GDK_ISO_Left_Tab:
+			if (key->state & GDK_CONTROL_MASK) {
+				if (etable->group) {
+					if (e_table_model_row_count(etable->model) > 0)
+						focus_first_etable_item (etable->group);
+					else
+						gtk_widget_child_focus (
+							gtk_widget_get_toplevel(GTK_WIDGET(etable->table_canvas)), GTK_DIR_TAB_FORWARD);
+					break;
+				}
+			}
+		default:
+			return FALSE;
+	}
 
 	return TRUE;
 }
@@ -1190,6 +1244,10 @@
 		"spacing", 10.0,
 		NULL);
 
+	g_signal_connect (
+		G_OBJECT (e_table->canvas_vbox), "event",
+		G_CALLBACK (canvas_vbox_event), e_table);
+
 	et_build_groups(e_table);
 
 	if (e_table->use_click_to_add) {
@@ -1211,8 +1269,11 @@
 				e_table->click_to_add);
 
 		g_signal_connect (
-			G_OBJECT (e_table->click_to_add), "cursor_change",
-			G_CALLBACK (click_to_add_cursor_change), e_table);
+			G_OBJECT (e_table->click_to_add), "event",
+			G_CALLBACK (click_to_add_event), e_table);
+                g_signal_connect (
+                        G_OBJECT (e_table->click_to_add), "cursor_change",
+                        G_CALLBACK (click_to_add_cursor_change), e_table);
 	}
 }
 
Michael Zucchi <notzed ximian com>

Ximian Evolution and Free Software Developer


Novell, Inc.


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