aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets/e-minicard-view-widget.c
diff options
context:
space:
mode:
authorMengjie Yu <meng-jie.yu@sun.com>2005-04-22 16:08:11 +0800
committerHarry Lu <haip@src.gnome.org>2005-04-22 16:08:11 +0800
commit8d44e799c3d6c544c9b139677a1946357774566f (patch)
tree23464e97c16c41c271b9a6b18a98bad962c31880 /addressbook/gui/widgets/e-minicard-view-widget.c
parent4ef011fee458a41efea4dd5023fbb38a505127bb (diff)
downloadgsoc2013-evolution-8d44e799c3d6c544c9b139677a1946357774566f.tar.gz
gsoc2013-evolution-8d44e799c3d6c544c9b139677a1946357774566f.tar.zst
gsoc2013-evolution-8d44e799c3d6c544c9b139677a1946357774566f.zip
Add focus_in_event function.
2005-04-21 Mengjie Yu <meng-jie.yu@sun.com> * gui/widgets/e-minicard-view-widget.c: (e_minicard_view_widget_class_init), (e_minicard_view_widget_real_focus_in_event): Add focus_in_event function. Fixes #300968 (gnome bugzilla bugID) svn path=/trunk/; revision=29225
Diffstat (limited to 'addressbook/gui/widgets/e-minicard-view-widget.c')
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index ff1bdc1f06..5490db25cd 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -38,6 +38,8 @@ static void e_minicard_view_widget_reflow (ECanvas *canvas);
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,6 +160,8 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
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;
@@ -438,3 +442,30 @@ e_minicard_view_widget_get_view (EMinicardViewWidget *view)
else
return 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);
+ if (reflow->count) {
+ int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), 0);
+
+ if (unsorted != -1)
+ canvas->focused_item = reflow->items [unsorted];
+ }
+ }
+
+ if (GTK_WIDGET_CLASS(parent_class)->focus_in_event)
+ return GTK_WIDGET_CLASS(parent_class)->focus_in_event (widget, event);
+
+ return FALSE;
+
+}
+