Re: [evolution-patches] Addressbook patch to fix #55056 and add sth new
- From: sh <hao sheng sun com>
- To: toshok ximian com
- Cc: evolution-patches ximian com
- Subject: Re: [evolution-patches] Addressbook patch to fix #55056 and add sth new
- Date: Mon, 05 Apr 2004 19:44:55 -0400
Hi, Chris
Thank you for your review my patch.
I have used the new function (eab_editor_raise) to instead of the old
functions.
And also the patch has fixed the bug#41826.
I think the bug#41826 is one part of the #55056.
Would you like to spend a little time to review it again?
Best regards
Hao.sheng
Chris Toshok wrote:
This actually doesn't compile against HEAD anymore.
I added in the EABEditor superclass for both EContactEditor and
EContactListEditor, which defines eab_editor_raise. You should use this
instead of calling each of the (now removed)
e_contact{_list}_editor_raise functions.
Chris
On Sun, 2004-03-28 at 16:20 -0500, sh wrote:
Hi,
This patch is aimed for Head.
Fix the Bug #55056 on http://bugzilla.ximian.com.
(Summary: keyboard navigation is disable )
Attach is a patch to fix that.Would you like to spend a little time to
review it?
Best regards
hao.sheng
Index: e-minicard.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard.c,v
retrieving revision 1.112
diff -u -r1.112 e-minicard.c
--- e-minicard.c 24 Mar 2004 20:18:49 -0000 1.112
+++ e-minicard.c 5 Apr 2004 11:42:18 -0000
@@ -519,6 +519,46 @@
}
static gboolean
+activiate_editor(GnomeCanvasItem *item)
+{
+ EMinicard *e_minicard;
+ e_minicard = E_MINICARD (item);
+
+ if (e_minicard->editor) {
+ eab_editor_raise (e_minicard->editor);
+ } else {
+ EBook *book = NULL;
+ if (E_IS_MINICARD_VIEW(item->parent)) {
+ g_object_get(item->parent, "book", &book, NULL);
+ }
+
+ if (book != NULL) {
+ if (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)) {
+ EContactListEditor *editor = eab_show_contact_list_editor (book, e_minicard->contact,
+ FALSE, e_minicard->editable);
+ e_minicard->editor = G_OBJECT (editor);
+ }
+ else {
+ EContactEditor *editor = eab_show_contact_editor (book, e_minicard->contact,
+ FALSE, e_minicard->editable);
+ e_minicard->editor = G_OBJECT (editor);
+ }
+ g_object_ref (e_minicard->editor);
+
+ g_signal_connect (e_minicard->editor, "editor_closed",
+ G_CALLBACK (editor_closed_cb), e_minicard);
+
+ g_object_unref (book);
+ }
+ }
+
+ return TRUE;
+}
+
+
+
+
+static gboolean
e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
{
EMinicard *e_minicard;
@@ -601,38 +641,63 @@
break;
case GDK_2BUTTON_PRESS:
if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) {
- if (e_minicard->editor) {
- eab_editor_raise (e_minicard->editor);
- } else {
- EBook *book = NULL;
- if (E_IS_MINICARD_VIEW(item->parent)) {
- g_object_get(item->parent,
- "book", &book,
- NULL);
- }
-
- if (book != NULL) {
- if (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)) {
- EContactListEditor *editor = eab_show_contact_list_editor (book, e_minicard->contact,
- FALSE, e_minicard->editable);
- e_minicard->editor = EAB_EDITOR (editor);
- }
- else {
- EContactEditor *editor = eab_show_contact_editor (book, e_minicard->contact,
- FALSE, e_minicard->editable);
- e_minicard->editor = EAB_EDITOR (editor);
- }
- g_object_ref (e_minicard->editor);
-
- g_signal_connect (e_minicard->editor, "editor_closed",
- G_CALLBACK (editor_closed_cb), e_minicard);
-
- g_object_unref (book);
- }
- }
- return TRUE;
+ return activiate_editor(item);
}
break;
+ case GDK_KEY_PRESS:
+ if (event->key.keyval == GDK_Tab ||
+ event->key.keyval == GDK_KP_Tab ||
+ event->key.keyval == GDK_ISO_Left_Tab) {
+
+ GList *list, *focus_list;
+ EFocus has_focus = E_FOCUS_NONE;
+ EMinicardView *view = E_MINICARD_VIEW(item->parent);
+ EReflow *reflow = E_REFLOW(view);
+
+ if (reflow == NULL) {
+ return FALSE;
+ }
+
+ if (event->key.state & GDK_SHIFT_MASK) {
+ if (event->key.state & GDK_CONTROL_MASK) {
+ return FALSE;
+ } else {
+ int row_count = e_selection_model_row_count(reflow->selection);
+ int model_index = e_selection_model_cursor_row (reflow->selection);
+ int view_index = e_sorter_model_to_sorted (reflow->selection->sorter, model_index);
+
+ if (view_index == 0) {
+ view_index = row_count-1;
+ } else {
+ view_index--;
+ }
+ model_index = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), view_index);
+ e_canvas_item_grab_focus(reflow->items[model_index], FALSE);
+ return TRUE;
+ }
+ } else {
+ if (event->key.state & GDK_CONTROL_MASK) {
+ return FALSE;
+ } else {
+ int row_count = e_selection_model_row_count(reflow->selection);
+ int model_index = e_selection_model_cursor_row (reflow->selection);
+ int view_index = e_sorter_model_to_sorted (reflow->selection->sorter, model_index);
+
+ if (view_index == row_count-1) {
+ view_index = 0;
+ } else {
+ view_index++;
+ }
+ model_index = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), view_index);
+ e_canvas_item_grab_focus(reflow->items[model_index], FALSE);
+ return TRUE;
+ }
+ }
+ } else if (event->key.keyval == GDK_Return ||
+ event->key.keyval == GDK_KP_Enter) {
+ return activiate_editor(item);
+ }
+ break;
default:
break;
}
Index: e-minicard-view-widget.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard-view-widget.c,v
retrieving revision 1.31
diff -u -r1.31 e-minicard-view-widget.c
--- e-minicard-view-widget.c 21 Oct 2003 18:48:56 -0000 1.31
+++ e-minicard-view-widget.c 5 Apr 2004 11:42:19 -0000
@@ -39,6 +39,8 @@
static void e_minicard_view_widget_style_set (GtkWidget *widget, GtkStyle *previous_style);
static void e_minicard_view_widget_realize (GtkWidget *widget);
+static gboolean e_minicard_view_widget_real_focus_in_event (GtkWidget *widget, GdkEventFocus *event);
+
static ECanvasClass *parent_class = NULL;
/* The arguments we take */
@@ -158,6 +160,7 @@
widget_class->style_set = e_minicard_view_widget_style_set;
widget_class->realize = e_minicard_view_widget_realize;
widget_class->size_allocate = e_minicard_view_widget_size_allocate;
+ widget_class->focus_in_event = e_minicard_view_widget_real_focus_in_event;
canvas_class->reflow = e_minicard_view_widget_reflow;
@@ -165,6 +168,25 @@
klass->column_width_changed = NULL;
klass->right_click = NULL;
}
+
+static gboolean
+e_minicard_view_widget_real_focus_in_event(GtkWidget *widget, GdkEventFocus *event)
+{
+ GnomeCanvas *canvas;
+ EMinicardViewWidget *view;
+
+ canvas = GNOME_CANVAS (widget);
+ view = E_MINICARD_VIEW_WIDGET(widget);
+
+ if (!canvas->focused_item) {
+ EReflow *reflow = E_REFLOW (view->emv);
+ int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), 0);
+
+ canvas->focused_item = reflow->items [unsorted];
+ }
+
+ return GTK_WIDGET_CLASS(parent_class)->focus_in_event (widget, event);
+ }
static void
e_minicard_view_widget_init (EMinicardViewWidget *view)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]