summaryrefslogtreecommitdiffstats
path: root/src/notebook.c
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-24 03:33:48 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-24 03:33:48 (EDT)
commit9dd67ec67462ab207be7fcee9f49a53de077be22 (patch)
tree9a71b7cabb550b01d35f06a99c7d81492d8a75ea /src/notebook.c
parente896b5da1446fe57362a4522c26efbe89b4662a9 (diff)
downloadmarquee-9dd67ec67462ab207be7fcee9f49a53de077be22.zip
marquee-9dd67ec67462ab207be7fcee9f49a53de077be22.tar.gz
marquee-9dd67ec67462ab207be7fcee9f49a53de077be22.tar.bz2
[WIP] MqNotebook: Rewrite tab tree row activation callback
Just prints the tab title without changing to the tab.
Diffstat (limited to 'src/notebook.c')
-rw-r--r--src/notebook.c30
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);
}