aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2009-07-10 20:03:52 +0800
committerBenjamin Otte <otte@gnome.org>2009-07-13 02:11:43 +0800
commit1e8489797a2a5e8d21364e81d8719c3fc800feee (patch)
treee395762fac9e682d981c73fe992b2fc5cdc5ebdd
parenta6f2b6193825f06ce9eb9de69f9ef253df9ed56d (diff)
downloadgsoc2013-epiphany-1e8489797a2a5e8d21364e81d8719c3fc800feee.tar
gsoc2013-epiphany-1e8489797a2a5e8d21364e81d8719c3fc800feee.tar.gz
gsoc2013-epiphany-1e8489797a2a5e8d21364e81d8719c3fc800feee.tar.bz2
gsoc2013-epiphany-1e8489797a2a5e8d21364e81d8719c3fc800feee.tar.lz
gsoc2013-epiphany-1e8489797a2a5e8d21364e81d8719c3fc800feee.tar.xz
gsoc2013-epiphany-1e8489797a2a5e8d21364e81d8719c3fc800feee.tar.zst
gsoc2013-epiphany-1e8489797a2a5e8d21364e81d8719c3fc800feee.zip
Performance: Set a fixed width on autosized cell renderer
The text cell renderer in use by the url autocompletion is the only renderer that expands. As the width of the entry completion is known in advance (as big as the entry you are completing on), we can set a fixed width. Since the height of the cell renderer is hardcoded, too, the complete size of the cell renderer is known in advance and Gtk skips layouting the text to compute the size. This is a noticable performance improvement, expecially when the completion contains lots of visible entries.
-rw-r--r--lib/widgets/ephy-location-entry.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index 5fdd4f0bb..8a0bd5390 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -1225,7 +1225,17 @@ ephy_location_entry_set_completion (EphyLocationEntry *entry,
cell, TRUE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (completion),
cell, "text", text_col);
+ /*
+ * As the width of the entry completion is known in advance
+ * (as big as the entry you are completing on), we can set
+ * any fixed width (the 1 is just this random number here).
+ * Since the height is known too, we avoid computing the actual
+ * sizes of the cells, which takes a lot of CPU time and does
+ * not get used anyway.
+ */
+ gtk_cell_renderer_set_fixed_size (cell, 1, -1);
gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (cell), 2);
+
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (completion),
cell, textcell_data_func,
entry,