* src/widgets/modest-attachments-view.c:
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 19 Sep 2007 21:35:49 +0000 (21:35 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 19 Sep 2007 21:35:49 +0000 (21:35 +0000)
        * Wops, we should use "focus" event instead of focus-in.

pmo-trunk-r3359

src/widgets/modest-attachments-view.c

index 6f617a4..aec2c18 100644 (file)
@@ -68,7 +68,7 @@ static gboolean motion_notify_event (GtkWidget *widget, GdkEventMotion *event, M
 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);
@@ -263,7 +263,7 @@ modest_attachments_view_instance_init (GTypeInstance *instance, gpointer g_class
        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);
 
@@ -785,10 +785,15 @@ focus_out_event (GtkWidget *widget, GdkEventFocus *event, ModestAttachmentsView
 }
 
 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) {