[gnome-control-center] Fit three columns of search results



commit 2d145a6fa4b21a5b558597ab9b6dde460a41a4f6
Author: Jon McCann <jmccann redhat com>
Date:   Tue Apr 10 18:04:38 2012 -0400

    Fit three columns of search results
    
    And center labels vertically that have no search matching text.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673869

 shell/shell-search-renderer.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/shell/shell-search-renderer.c b/shell/shell-search-renderer.c
index 6032af8..c72f0bb 100644
--- a/shell/shell-search-renderer.c
+++ b/shell/shell-search-renderer.c
@@ -215,7 +215,7 @@ get_size (GtkCellRenderer *cell,
 
   shell_search_renderer_set_layout (SHELL_SEARCH_RENDERER (cell), widget);
 
-  pango_layout_set_width (priv->layout, PANGO_SCALE * 180);
+  pango_layout_set_width (priv->layout, PANGO_SCALE * 164);
   pango_layout_get_pixel_extents (priv->layout, NULL, &rect);
 
   if (width) *width = rect.width;
@@ -281,6 +281,8 @@ shell_search_renderer_render (GtkCellRenderer      *cell,
   ShellSearchRendererPrivate *priv = SHELL_SEARCH_RENDERER (cell)->priv;
   PangoRectangle rect;
   GtkStyleContext *context;
+  gint layout_height;
+  gint vcenter_offset;
 
   context = gtk_widget_get_style_context (widget);
 
@@ -288,11 +290,14 @@ shell_search_renderer_render (GtkCellRenderer      *cell,
 
   pango_layout_get_pixel_extents (priv->layout, NULL, &rect);
 
+  pango_layout_get_pixel_size (priv->layout, NULL, &layout_height);
+  vcenter_offset = (cell_area->height - layout_height) / 2;
+
   cairo_save (cr);
 
   gtk_render_layout (context, cr,
                      cell_area->x,
-                     cell_area->y,
+                     cell_area->y + vcenter_offset,
                      priv->layout);
 
   cairo_restore (cr);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]