mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
tests: Stop using ::focus-in/out-event
The has-focus property works just as well here.
This commit is contained in:
parent
e3e00a2673
commit
6d1dbec9dd
@ -178,20 +178,12 @@ keynav_failed (GtkWidget *view,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
focus_out (GtkWidget *view,
|
||||
GdkEventFocus *event,
|
||||
static void
|
||||
focus_changed (GtkWidget *view,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_icon_view_unselect_all (GTK_ICON_VIEW (view));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
focus_in (GtkWidget *view,
|
||||
GdkEventFocus *event,
|
||||
gpointer data)
|
||||
if (gtk_widget_has_focus (view))
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
||||
@ -203,8 +195,11 @@ focus_in (GtkWidget *view,
|
||||
|
||||
gtk_icon_view_select_path (GTK_ICON_VIEW (view), path);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_icon_view_unselect_all (GTK_ICON_VIEW (view));
|
||||
}
|
||||
}
|
||||
|
||||
#define CSS \
|
||||
@ -254,18 +249,10 @@ main (int argc, char *argv[])
|
||||
NULL);
|
||||
views.view2 = get_view (FALSE);
|
||||
|
||||
g_signal_connect (views.view1, "keynav-failed",
|
||||
G_CALLBACK (keynav_failed), &views);
|
||||
g_signal_connect (views.view2, "keynav-failed",
|
||||
G_CALLBACK (keynav_failed), &views);
|
||||
g_signal_connect (views.view1, "focus-in-event",
|
||||
G_CALLBACK (focus_in), NULL);
|
||||
g_signal_connect (views.view1, "focus-out-event",
|
||||
G_CALLBACK (focus_out), NULL);
|
||||
g_signal_connect (views.view2, "focus-in-event",
|
||||
G_CALLBACK (focus_in), NULL);
|
||||
g_signal_connect (views.view2, "focus-out-event",
|
||||
G_CALLBACK (focus_out), NULL);
|
||||
g_signal_connect (views.view1, "keynav-failed", G_CALLBACK (keynav_failed), &views);
|
||||
g_signal_connect (views.view2, "keynav-failed", G_CALLBACK (keynav_failed), &views);
|
||||
g_signal_connect (views.view1, "notify::has-focus", G_CALLBACK (focus_changed), &views);
|
||||
g_signal_connect (views.view2, "notify::has-focus", G_CALLBACK (focus_changed), &views);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox), views.header1);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), views.view1);
|
||||
|
Loading…
Reference in New Issue
Block a user