[Fwd: Re: [evolution-patches] patch for Contacts (was:addressbook) bug #41826 -- need review -- resent]



bleah, didn't reply to list
--- Begin Message ---
sorry to take so long getting back to you about this, was knee deep in
other things for too long.

There's only 1 problem with this patch - it focuses the first item in
the unsorted list, so the focus will appear randomly (it actually
focuses the last item in both my contact folders, not the first.)

attached is what i'm planning to commit, a slighly revised version of
your patch.

Chris

On Thu, 2003-05-22 at 20:27, Gilbert Fang wrote:
> Hi, Chris
>  
>  Please review the patch for   bug #41826 --   Minicard view can't be focused with keyboard.
> 
> 
> Thanks 
> Gilbert 
Index: e-minicard-view-widget.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-minicard-view-widget.c,v
retrieving revision 1.29
diff -u -r1.29 e-minicard-view-widget.c
--- e-minicard-view-widget.c	8 Apr 2003 04:44:57 -0000	1.29
+++ e-minicard-view-widget.c	23 Jun 2003 22:20:15 -0000
@@ -38,6 +38,7 @@
 static void e_minicard_view_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
 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;
 
@@ -158,12 +159,33 @@
 	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;
 
 	klass->selection_change     = NULL;
 	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

--- End Message ---


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