static gboolean button_release_event (GtkWidget *widget, GdkEventButton *event, ModestAttachmentsView *atts_view);
static gboolean key_press_event (GtkWidget *widget, GdkEventKey *event, ModestAttachmentsView *atts_view);
static gboolean focus_out_event (GtkWidget *widget, GdkEventFocus *event, ModestAttachmentsView *atts_view);
-static gboolean focus_in_event (GtkWidget *widget, GdkEventFocus *event, ModestAttachmentsView *atts_view);
+static gboolean focus (GtkWidget *widget, GtkDirectionType direction, ModestAttachmentsView *atts_view);
static GtkWidget *get_att_view_at_coords (ModestAttachmentsView *atts_view,
gdouble x, gdouble y);
static void unselect_all (ModestAttachmentsView *atts_view);
g_signal_connect (G_OBJECT (instance), "motion-notify-event", G_CALLBACK (motion_notify_event), instance);
g_signal_connect (G_OBJECT (instance), "key-press-event", G_CALLBACK (key_press_event), instance);
g_signal_connect (G_OBJECT (instance), "focus-out-event", G_CALLBACK (focus_out_event), instance);
- g_signal_connect (G_OBJECT (instance), "focus-in-event", G_CALLBACK (focus_in_event), instance);
+ g_signal_connect (G_OBJECT (instance), "focus", G_CALLBACK (focus), instance);
GTK_WIDGET_SET_FLAGS (instance, GTK_CAN_FOCUS);
}
static gboolean
-focus_in_event (GtkWidget *widget, GdkEventFocus *event, ModestAttachmentsView *atts_view)
+focus (GtkWidget *widget, GtkDirectionType direction, ModestAttachmentsView *atts_view)
{
ModestAttachmentsViewPrivate *priv = MODEST_ATTACHMENTS_VIEW_GET_PRIVATE (atts_view);
GList *children = NULL;
+ GtkWidget *toplevel = NULL;
+
+ toplevel = gtk_widget_get_toplevel (widget);
+ if (!gtk_window_has_toplevel_focus (GTK_WINDOW (toplevel)))
+ return FALSE;
children = gtk_container_get_children (GTK_CONTAINER (priv->box));
if (children != NULL) {