diff options
-rw-r--r-- | src/notebook.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/notebook.c b/src/notebook.c index 56f6a0d..a2d7f4b 100644 --- a/src/notebook.c +++ b/src/notebook.c @@ -167,25 +167,17 @@ tab_tree_row_activated_cb(GtkTreeView G_GNUC_UNUSED *tree_view, GtkTreePath *tree_path, GtkTreeViewColumn G_GNUC_UNUSED *tree_view_column, MqNotebook *notebook) { - gint *indices; - gint depth; - - indices = gtk_tree_path_get_indices_with_depth(tree_path, &depth); - /* - * FIXME: gtk_tree_path_get_indices_with_depth() sometimes returns two - * indices, both always 0. Steps to reproduce: - * - * 1. Open a new tab (i.e. a child of another tab) - * 2. Show the tab tree menu - * 3. Activate the row representing the new (child) tab - * - * Obviously this seems to be a recursion issue. - */ - g_print("depth = %d\n", depth); - for (gint i = 0; i < depth; ++i) - g_print("indices[%d] = %d\n", i, indices[i]); - g_assert(depth == 1); - mq_notebook_set_current_page(notebook, indices[0]); + GtkTreeModel *tree_model; + GtkTreeIter tree_iter; + gchar *title; + + tree_model = gtk_tree_view_get_model(tree_view); + if (gtk_tree_model_get_iter(tree_model, &tree_iter, tree_path)) { + gtk_tree_model_get(tree_model, &tree_iter, 0, &title, -1); + g_print ("Row \"%s\" activated\n", title); + g_free(title); + } + gtk_widget_hide(notebook->tab_tree_popover); } |