+ gtk_cell_renderer_get_padding (cell, &xpad, NULL);
+
+ layout = get_layout (celltext, widget, NULL, 0);
+
+ /* Fetch the length of the complete unwrapped text */
+ pango_layout_set_width (layout, -1);
+ pango_layout_get_extents (layout, NULL, &rect);
+ text_width = rect.width;
+
+ /* Fetch the average size of a charachter */
+ context = pango_layout_get_context (layout);
+ metrics = pango_context_get_metrics (context,
+ pango_context_get_font_description (context),
+ pango_context_get_language (context));
+
+ char_width = pango_font_metrics_get_approximate_char_width (metrics);
+
+ pango_font_metrics_unref (metrics);
+ g_object_unref (layout);
+
+ /* enforce minimum width for ellipsized labels at ~3 chars */
+ if (priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE)
+ ellipsize_chars = 3;
+ else
+ ellipsize_chars = 0;
+
+ if ((priv->ellipsize_set && priv->ellipsize != PANGO_ELLIPSIZE_NONE) || priv->width_chars > 0)
+ min_width = xpad * 2 +
+ MIN (PANGO_PIXELS_CEIL (text_width),
+ (PANGO_PIXELS (char_width) * MAX (priv->width_chars, ellipsize_chars)));
+ /* If no width-chars set, minimum for wrapping text will be the wrap-width */
+ else if (priv->wrap_width > -1)
+ min_width = xpad * 2 + rect.x + MIN (PANGO_PIXELS_CEIL (text_width), priv->wrap_width);
+ else
+ min_width = xpad * 2 + rect.x + PANGO_PIXELS_CEIL (text_width);
+
+ if (priv->width_chars > 0)
+ nat_width = xpad * 2 +
+ MAX ((PANGO_PIXELS (char_width) * priv->width_chars), PANGO_PIXELS_CEIL (text_width));
+ else
+ nat_width = xpad * 2 + PANGO_PIXELS_CEIL (text_width);
+
+ nat_width = MAX (nat_width, min_width);
+
+ if (priv->max_width_chars > 0)