diff options
-rw-r--r-- | src/notebook.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/notebook.c b/src/notebook.c index 126732a..b99adba 100644 --- a/src/notebook.c +++ b/src/notebook.c @@ -198,12 +198,9 @@ create_tab_tree_view(MqNotebook *notebook) GtkCellRenderer *cell_renderer; tree_model = create_tab_tree_model(notebook, &select_tree_iter); + tree_view = gtk_tree_view_new_with_model(tree_model); gtk_tree_view_expand_all(GTK_TREE_VIEW(tree_view)); - tree_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)); - gtk_tree_selection_set_mode(tree_selection, GTK_SELECTION_BROWSE); - gtk_tree_selection_select_iter(tree_selection, select_tree_iter); - gtk_tree_iter_free(select_tree_iter); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), FALSE); gtk_tree_view_set_activate_on_single_click(GTK_TREE_VIEW(tree_view), TRUE); @@ -212,6 +209,13 @@ create_tab_tree_view(MqNotebook *notebook) g_signal_connect(tree_view, "row-activated", G_CALLBACK(tab_tree_row_activated_cb), notebook); + tree_selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree_view)); + gtk_tree_selection_set_mode(tree_selection, GTK_SELECTION_BROWSE); + /* gtk_tree_view_expand_all() must be called before + * gtk_tree_selection_select_iter(). */ + gtk_tree_selection_select_iter(tree_selection, select_tree_iter); + gtk_tree_iter_free(select_tree_iter); + cell_renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree_view), -1, NULL, cell_renderer, "text", 1, NULL); |