diff options
-rw-r--r-- | src/notebook.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/notebook.c b/src/notebook.c index a2d7f4b..f7f06a0 100644 --- a/src/notebook.c +++ b/src/notebook.c @@ -140,8 +140,10 @@ create_tab_tree_model_recurse(MqTabTree *node, GtkTreeStore *tree_store, for (; node; node = MQ_TAB_TREE(mq_tree_next(node))) { gtk_tree_store_append(tree_store, &tree_iter, parent_tree_iter); - gtk_tree_store_set(tree_store, &tree_iter, 0, - mq_tab_page_get_title(node->page), -1); + gtk_tree_store_set(tree_store, &tree_iter, + 0, mq_tree_position(node), + 1, mq_tab_page_get_title(node->page), + -1); create_tab_tree_model_recurse( MQ_TAB_TREE(mq_tree_first_child(node)), tree_store, &tree_iter); @@ -153,7 +155,7 @@ create_tab_tree_model(MqNotebook *notebook) { GtkTreeStore *tree_store; - tree_store = gtk_tree_store_new(1, G_TYPE_STRING); + tree_store = gtk_tree_store_new(2, G_TYPE_INT, G_TYPE_STRING); create_tab_tree_model_recurse( MQ_TAB_TREE(mq_tree_first_child(notebook->tree)), @@ -169,12 +171,14 @@ tab_tree_row_activated_cb(GtkTreeView G_GNUC_UNUSED *tree_view, { GtkTreeModel *tree_model; GtkTreeIter tree_iter; + gint position; 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); + gtk_tree_model_get(tree_model, &tree_iter, + 0, &position, 1, &title, -1); + g_print ("Row %d, \"%s\" activated\n", position, title); g_free(title); } @@ -208,7 +212,7 @@ create_tab_tree_view(MqNotebook *notebook) cell_renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), - -1, NULL, cell_renderer, "text", 0, NULL); + -1, NULL, cell_renderer, "text", 1, NULL); return tree_view; } |