]> Pileus Git - ~andy/gtk/commitdiff
Use pango_layout_set_height() for calendar details (#506049).
authorMathias Hasselmann <hasselmm@src.gnome.org>
Tue, 22 Jan 2008 15:03:03 +0000 (15:03 +0000)
committerMathias Hasselmann <hasselmm@src.gnome.org>
Tue, 22 Jan 2008 15:03:03 +0000 (15:03 +0000)
* configure.in: Require 1.19.3 for pango_layout_set_height().
* gtk/gtkcalendar.c: Use pango_layout_set_height() for details.

svn path=/trunk/; revision=19392

ChangeLog
configure.in
gtk/gtkcalendar.c

index 89b77fefa3067029f30774950143000d6ade3f9d..572b38068b6d6042a0d7482cb3c42f8cce187785 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-22  Mathias Hasselmann  <mathias@openismus.com>
+
+       Use pango_layout_set_height() for calendar details (#506049).
+
+       * configure.in: Require 1.19.3 for pango_layout_set_height().
+       * gtk/gtkcalendar.c: Use pango_layout_set_height() for details.
+
 2008-01-18  Johan Dahlin  <johan@gnome.org>
 
        * gtk/gtk-builder-convert (get_property_node): New method
index 6b8de86813836714c39b45ac9bf3a8df305db97b..240dc3e2cb07ae958177a704d577da909d2b2553 100644 (file)
@@ -32,7 +32,7 @@ m4_define([gtk_binary_version], [2.10.0])
 
 # required versions of other packages
 m4_define([glib_required_version], [2.15.0])
-m4_define([pango_required_version], [1.17.3])
+m4_define([pango_required_version], [1.19.3])
 m4_define([atk_required_version], [1.13.0])
 m4_define([cairo_required_version], [1.2.0])
 
index 269125f1dbcfa349930b4cfc6b822e372be6a8ec..d47914df1fee975b50db8138ea6e8418ea633ec4 100644 (file)
@@ -2548,8 +2548,6 @@ calendar_paint_day (GtkCalendar *calendar,
 
   if (detail && show_details)
     {
-      gint i, n_lines;
-
       gchar *markup = g_strconcat ("<small>", detail, "</small>", NULL);
       pango_layout_set_markup (layout, markup, -1);
       g_free (markup);
@@ -2567,34 +2565,18 @@ calendar_paint_day (GtkCalendar *calendar,
             pango_attr_list_unref (colors);
         }
 
-      if (priv->detail_width_chars)
-        {
-          pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
-          pango_layout_set_width (layout, PANGO_SCALE * priv->min_day_width);
-        }
+      pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
+      pango_layout_set_width (layout, PANGO_SCALE * day_rect.width);
 
-      n_lines = pango_layout_get_line_count (layout);
-
-      if (priv->detail_height_rows &&
-          n_lines > priv->detail_height_rows)
+      if (priv->detail_height_rows)
         {
-          n_lines = priv->detail_height_rows;
-          overflow = TRUE;
+          gint dy = day_rect.height - (y_loc - day_rect.y);
+          pango_layout_set_height (layout, PANGO_SCALE * dy);
+          pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
         }
 
-      for (i = 0; i < n_lines; ++i)
-        {
-          PangoLayoutLine *line = pango_layout_get_line_readonly (layout, i);
-          pango_layout_line_get_pixel_extents (line, NULL, &logical_rect);
-
-          x_loc  = day_rect.x + (day_rect.width - logical_rect.width) / 2;
-          y_loc += PANGO_ASCENT (logical_rect);
-
-          cairo_move_to (cr, x_loc, y_loc);
-          pango_cairo_show_layout_line (cr, line);
-
-          y_loc += PANGO_DESCENT (logical_rect);
-        }
+      cairo_move_to (cr, day_rect.x, y_loc);
+      pango_cairo_show_layout (cr, layout);
     }
 
   if (GTK_WIDGET_HAS_FOCUS (calendar)