diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2017-07-29 23:08:01 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2017-07-29 23:08:01 +0200 |
| commit | e7a0bf680f3d805b190b89bfeb1f1f8a4c3ec982 (patch) | |
| tree | f0799a14f1a697850eb7c05edd484ffdb4038f08 /src/gui_gtk.cc | |
| parent | 53c474283e4e378185d86f57384bb5d8ae933df4 (diff) | |
Add basic "Jump to related" which jumps to request/response respectivly
Diffstat (limited to 'src/gui_gtk.cc')
| -rw-r--r-- | src/gui_gtk.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui_gtk.cc b/src/gui_gtk.cc index 7edd58c..7dd2d42 100644 --- a/src/gui_gtk.cc +++ b/src/gui_gtk.cc @@ -625,6 +625,8 @@ public: return listmodel_ ? list_model_get_model(listmodel_.get()) : nullptr; } + void select_row(size_t row) override; + void set_package(std::unique_ptr<AttributedText>&& text) override; AttributedText* package() const { @@ -1958,6 +1960,20 @@ void GtkGuiMain::show(GuiWindow* window) { gtk_window_present(wnd); } +void GtkGuiMain::select_row(size_t row) { + auto wnd = reinterpret_cast<MainAppWindow*>(window()); + if (wnd) { + auto path = gtk_tree_path_new(); + gtk_tree_path_append_index(path, row); + gtk_tree_selection_select_path( + gtk_tree_view_get_selection(GTK_TREE_VIEW(wnd->top_)), + path); + gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(wnd->top_), + path, nullptr, false, .0f, .0f); + gtk_tree_path_free(path); + } +} + void GtkGuiMain::set_package(std::unique_ptr<AttributedText>&& text) { package_.swap(text); auto wnd = reinterpret_cast<MainAppWindow*>(window()); |
