Fold up the `SSH' branch of the treeview by default; it's getting

quite big and tends to hide the existence of the `Serial' config
panel.

This is implemented by folding up every branch of depth 2 or more,
which with any luck might turn out to be general enough to carry
over unchanged if other branches start expanding. Then again, we may
have to fiddle with it again when that time comes; who knows?

[originally from svn r7117]
This commit is contained in:
Simon Tatham 2007-01-16 18:48:47 +00:00
Родитель c018e993a3
Коммит 174bb7f1fd
2 изменённых файлов: 12 добавлений и 8 удалений

Просмотреть файл

@ -2081,14 +2081,8 @@ int do_config_box(const char *title, Config *cfg, int midsession,
shortcut_add(&scs, label, 'g', SHORTCUT_TREE, tree);
gtk_tree_set_view_mode(GTK_TREE(tree), GTK_TREE_VIEW_ITEM);
gtk_tree_set_selection_mode(GTK_TREE(tree), GTK_SELECTION_BROWSE);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(treescroll),
tree);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(treescroll),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_signal_connect(GTK_OBJECT(tree), "focus",
GTK_SIGNAL_FUNC(tree_focus), &dp);
gtk_widget_show(tree);
gtk_widget_show(treescroll);
gtk_box_pack_start(GTK_BOX(vbox), treescroll, TRUE, TRUE, 0);
panels = gtk_notebook_new();
@ -2141,7 +2135,10 @@ int do_config_box(const char *title, Config *cfg, int midsession,
gtk_tree_item_set_subtree
(treeitemlevels[j-1],
GTK_WIDGET(treelevels[j-1]));
gtk_tree_item_expand(treeitemlevels[j-1]);
if (j < 2)
gtk_tree_item_expand(treeitemlevels[j-1]);
else
gtk_tree_item_collapse(treeitemlevels[j-1]);
}
gtk_tree_append(treelevels[j-1], treeitem);
} else {
@ -2226,6 +2223,13 @@ int do_config_box(const char *title, Config *cfg, int midsession,
set_window_icon(window, cfg_icon, n_cfg_icon);
}
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(treescroll),
tree);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(treescroll),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_widget_show(tree);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_widget_show(window);

Просмотреть файл

@ -322,7 +322,7 @@ static HTREEITEM treeview_insert(struct treeview_faff *faff,
newitem = TreeView_InsertItem(faff->treeview, &ins);
if (level > 0)
TreeView_Expand(faff->treeview, faff->lastat[level - 1],
TVE_EXPAND);
(level > 1 ? TVE_COLLAPSE : TVE_EXPAND));
faff->lastat[level] = newitem;
for (i = level + 1; i < 4; i++)
faff->lastat[i] = NULL;