From cb5bdb86460d333e42adf05482eed879632a813f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20St=C3=B6sel?= Date: Tue, 23 Nov 2010 23:22:47 +0100 Subject: [PATCH] Resize History List based on the requested size --- extensions/history-list.vala | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/extensions/history-list.vala b/extensions/history-list.vala index f52b753f..89dd35d0 100644 --- a/extensions/history-list.vala +++ b/extensions/history-list.vala @@ -57,7 +57,6 @@ private class TabWindow : HistoryWindow { this.add (hbox); var sw = new Gtk.ScrolledWindow (null, null); - sw.set_size_request (320, 20); sw.set_policy (PolicyType.NEVER , PolicyType.AUTOMATIC); sw.set_shadow_type (ShadowType.ETCHED_IN); hbox.pack_start (sw, true, true, 0); @@ -81,7 +80,6 @@ private class TabWindow : HistoryWindow { TabTreeCells.TREE_CELL_POINTER, view); } - this.set_default_size (320, list.len > 10 ? 232 : (int) list.len * 23 + 2); this.treeview = new Gtk.TreeView.with_model (store); this.treeview.set_fixed_height_mode (true); sw.add (treeview); @@ -96,6 +94,17 @@ private class TabWindow : HistoryWindow { TabTreeCells.TREE_CELL_STRING, "Title", new CellRendererText (), "text", 1); + Requisition requisition; + int height; + int max_lines = 10; + this.treeview.size_request (out requisition); + if ((int)list.len > max_lines) { + height = requisition.height / (int)list.len * max_lines + 2; + } else { + height = requisition.height + 2; + } + sw.set_size_request (320, height); + this.show_all (); } public override void make_update () { -- 2.39.5