summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-24 04:26:41 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-24 04:26:41 (EDT)
commitd79413597539863361033c032f8697896231a7fc (patch)
tree05ba16a23cda994d3dd841028b313cd528ab98fe
parent377c54a6b934c8c1c5a66abdeccb18324cb1f2a1 (diff)
downloadmarquee-d79413597539863361033c032f8697896231a7fc.zip
marquee-d79413597539863361033c032f8697896231a7fc.tar.gz
marquee-d79413597539863361033c032f8697896231a7fc.tar.bz2
MqNotebook: Restructure tab tree view creation code a little
Add blank lines for clarity and improve organization.
-rw-r--r--src/notebook.c12
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);