From 174bb7f1fd1b1a4823905ca931eec67ab0fc9976 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 16 Jan 2007 18:48:47 +0000 Subject: [PATCH] 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] --- unix/gtkdlg.c | 18 +++++++++++------- windows/windlg.c | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 875512aa..0a870ca3 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -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); diff --git a/windows/windlg.c b/windows/windlg.c index 3a9d6e57..82351100 100644 --- a/windows/windlg.c +++ b/windows/windlg.c @@ -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;