diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-09-28 16:07:03 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-09-28 16:07:03 (EDT) |
commit | 3839db6ba17258c4c931ccfff2838a5ebd7b54fb (patch) | |
tree | c499be6f05f8876aa1d0c082d1e44cc77a74c406 | |
parent | c6e38616022a6e2bf80e4b5026bf66eee8238211 (diff) | |
download | marquee-3839db6ba17258c4c931ccfff2838a5ebd7b54fb.zip marquee-3839db6ba17258c4c931ccfff2838a5ebd7b54fb.tar.gz marquee-3839db6ba17258c4c931ccfff2838a5ebd7b54fb.tar.bz2 |
MqTab: Set current tab on tree row activation
-rw-r--r-- | src/tab.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -168,6 +168,20 @@ create_tree_model(MqTab *tab) return GTK_TREE_MODEL(tree_store); } +static void +row_activated_cb(GtkTreeView __attribute__((unused)) *tree_view, + GtkTreePath *tree_path, + GtkTreeViewColumn __attribute__((unused)) *tree_view_column, + MqTab *tab) +{ + gint *indices; + gint depth; + + indices = gtk_tree_path_get_indices_with_depth(tree_path, &depth); + g_assert(depth == 1); + mq_window_set_current_tab(tab->window, indices[0] + 1); +} + static GtkWidget * create_tab_list(MqTab *tab) { @@ -188,6 +202,8 @@ create_tab_list(MqTab *tab) gtk_tree_view_expand_all(GTK_TREE_VIEW(tree_view)); gtk_tree_view_set_reorderable(GTK_TREE_VIEW(tree_view), TRUE); gtk_tree_view_set_enable_tree_lines(GTK_TREE_VIEW(tree_view), TRUE); + g_signal_connect(tree_view, "row-activated", + G_CALLBACK(row_activated_cb), tab); cell_renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), |