mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-17 19:18:06 -05:00
Fix the jarring change of window size on expanding the SSH branch of
the configuration tree. [originally from svn r7968]
This commit is contained in:
parent
bfa9859f2a
commit
ceb2a9b862
@ -2412,6 +2412,9 @@ struct selparam {
|
|||||||
GtkWidget *panel;
|
GtkWidget *panel;
|
||||||
#if !GTK_CHECK_VERSION(2,0,0)
|
#if !GTK_CHECK_VERSION(2,0,0)
|
||||||
GtkWidget *treeitem;
|
GtkWidget *treeitem;
|
||||||
|
#else
|
||||||
|
int depth;
|
||||||
|
GtkTreePath *treepath;
|
||||||
#endif
|
#endif
|
||||||
struct Shortcuts shortcuts;
|
struct Shortcuts shortcuts;
|
||||||
};
|
};
|
||||||
@ -2991,16 +2994,19 @@ int do_config_box(const char *title, Config *cfg, int midsession,
|
|||||||
treeiterlevels[j] = treeiter;
|
treeiterlevels[j] = treeiter;
|
||||||
|
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
GtkTreePath *path;
|
selparams[nselparams].treepath =
|
||||||
|
gtk_tree_model_get_path(GTK_TREE_MODEL(treestore),
|
||||||
path = gtk_tree_model_get_path(GTK_TREE_MODEL(treestore),
|
&treeiterlevels[j-1]);
|
||||||
&treeiterlevels[j-1]);
|
/*
|
||||||
if (j < 2)
|
* We are going to collapse all tree branches
|
||||||
gtk_tree_view_expand_row(GTK_TREE_VIEW(tree), path,
|
* at depth greater than 2, but not _yet_; see
|
||||||
FALSE);
|
* the comment at the call to
|
||||||
else
|
* gtk_tree_view_collapse_row below.
|
||||||
gtk_tree_view_collapse_row(GTK_TREE_VIEW(tree), path);
|
*/
|
||||||
gtk_tree_path_free(path);
|
gtk_tree_view_expand_row(GTK_TREE_VIEW(tree),
|
||||||
|
selparams[nselparams].treepath,
|
||||||
|
FALSE);
|
||||||
|
selparams[nselparams].depth = j;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
treeitem = gtk_tree_item_new_with_label(c);
|
treeitem = gtk_tree_item_new_with_label(c);
|
||||||
@ -3044,6 +3050,35 @@ int do_config_box(const char *title, Config *cfg, int midsession,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if GTK_CHECK_VERSION(2,0,0)
|
||||||
|
{
|
||||||
|
GtkRequisition req;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We want our tree view to come up with all branches at
|
||||||
|
* depth 2 or more collapsed. However, if we start off
|
||||||
|
* with those branches collapsed, then the tree view's
|
||||||
|
* size request will be calculated based on the width of
|
||||||
|
* the collapsed tree. So instead we start with them all
|
||||||
|
* expanded; then we ask for the current size request,
|
||||||
|
* collapse the relevant rows, and force the width to the
|
||||||
|
* value we just computed. This arranges that the tree
|
||||||
|
* view is wide enough to have all branches expanded
|
||||||
|
* safely.
|
||||||
|
*/
|
||||||
|
|
||||||
|
gtk_widget_size_request(tree, &req);
|
||||||
|
|
||||||
|
for (i = 0; i < nselparams; i++)
|
||||||
|
if (selparams[i].depth >= 2)
|
||||||
|
gtk_tree_view_collapse_row(GTK_TREE_VIEW(tree),
|
||||||
|
selparams[i].treepath);
|
||||||
|
|
||||||
|
gtk_widget_set_size_request(tree, req.width, -1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if GTK_CHECK_VERSION(2,0,0)
|
#if GTK_CHECK_VERSION(2,0,0)
|
||||||
g_signal_connect(G_OBJECT(treeselection), "changed",
|
g_signal_connect(G_OBJECT(treeselection), "changed",
|
||||||
G_CALLBACK(treeselection_changed), selparams);
|
G_CALLBACK(treeselection_changed), selparams);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user