diff options
-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), |