Skip to content

Commit 3f704fe

Browse files
Sidebar: fix focus delegation to TreeView (#1711)
1 parent 49367f3 commit 3f704fe

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/Widgets/Sidebar.vala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public class Code.Sidebar : Gtk.Grid {
4545
construct {
4646
orientation = Gtk.Orientation.VERTICAL;
4747
get_style_context ().add_class (Gtk.STYLE_CLASS_SIDEBAR);
48-
can_focus = true;
4948

5049
choose_project_button = new Code.ChooseProjectButton () {
5150
hexpand = true,
@@ -198,10 +197,8 @@ public class Code.Sidebar : Gtk.Grid {
198197
}
199198

200199
public void focus_sidebar () {
201-
if (stack.visible_child != null) {
202-
stack.visible_child.grab_focus ();
203-
} else {
204-
grab_focus ();
200+
if (stack.visible_child is Code.Widgets.SourceList) {
201+
((Code.Widgets.SourceList) stack.visible_child).grab_focus ();
205202
}
206203
}
207204
}

src/Widgets/SourceList/SourceList.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2937,5 +2937,9 @@ public class SourceList : Gtk.ScrolledWindow {
29372937

29382938
return null;
29392939
}
2940+
2941+
public new void grab_focus () {
2942+
tree.grab_focus ();
2943+
}
29402944
}
29412945
}

0 commit comments

Comments
 (0)