mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 14:31:10 +00:00
treeview: Stop using set_focus_child
Do this with an event controller on the buttons instead.
This commit is contained in:
parent
fe7dcf6eec
commit
fda4546de5
@ -603,8 +603,6 @@ static void gtk_tree_view_size_allocate (GtkWidget *widget,
|
||||
static void gtk_tree_view_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot);
|
||||
|
||||
static void gtk_tree_view_set_focus_child (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
static gboolean gtk_tree_view_key_controller_key_pressed (GtkEventControllerKey *key,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
@ -994,7 +992,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
|
||||
/* GtkContainer signals */
|
||||
container_class->remove = gtk_tree_view_remove;
|
||||
container_class->forall = gtk_tree_view_forall;
|
||||
container_class->set_focus_child = gtk_tree_view_set_focus_child;
|
||||
|
||||
class->move_cursor = gtk_tree_view_real_move_cursor;
|
||||
class->select_all = gtk_tree_view_real_select_all;
|
||||
@ -8018,26 +8015,6 @@ gtk_tree_view_style_updated (GtkWidget *widget)
|
||||
priv->expander_size = -1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_tree_view_set_focus_child (GtkContainer *container,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GtkTreeView *tree_view = GTK_TREE_VIEW (container);
|
||||
GList *list;
|
||||
|
||||
for (list = tree_view->priv->columns; list; list = list->next)
|
||||
{
|
||||
if (gtk_tree_view_column_get_button (GTK_TREE_VIEW_COLUMN (list->data)) == child)
|
||||
{
|
||||
_gtk_tree_view_set_focus_column (tree_view, GTK_TREE_VIEW_COLUMN (list->data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GTK_CONTAINER_CLASS (gtk_tree_view_parent_class)->set_focus_child (container, child);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_view_real_move_cursor (GtkTreeView *tree_view,
|
||||
GtkMovementStep step,
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkgesturedrag.h"
|
||||
#include "gtkeventcontrollerkey.h"
|
||||
|
||||
#include "a11y/gtktreeviewaccessibleprivate.h"
|
||||
|
||||
@ -811,6 +812,13 @@ gtk_tree_view_column_cell_layout_get_area (GtkCellLayout *cell_layout)
|
||||
return priv->cell_area;
|
||||
}
|
||||
|
||||
static void
|
||||
focus_in (GtkEventControllerKey *controller,
|
||||
GtkTreeViewColumn *column)
|
||||
{
|
||||
_gtk_tree_view_set_focus_column (GTK_TREE_VIEW (column->priv->tree_view), column);
|
||||
}
|
||||
|
||||
/* Button handling code
|
||||
*/
|
||||
static void
|
||||
@ -838,6 +846,10 @@ gtk_tree_view_column_create_button (GtkTreeViewColumn *tree_column)
|
||||
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
|
||||
gtk_widget_add_controller (priv->button, controller);
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "focus-in", G_CALLBACK (focus_in), tree_column);
|
||||
gtk_widget_add_controller (priv->button, controller);
|
||||
|
||||
priv->frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (priv->frame), GTK_SHADOW_NONE);
|
||||
gtk_widget_set_hexpand (priv->frame, TRUE);
|
||||
|
Loading…
Reference in New Issue
Block a user