summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-icon-canvas-item.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-private/caja-icon-canvas-item.c')
-rw-r--r--libcaja-private/caja-icon-canvas-item.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index 7ba5f0ac..7ab2f705 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -60,6 +60,14 @@
#define MAX_TEXT_WIDTH_BESIDE 90
#define MAX_TEXT_WIDTH_BESIDE_TOP_TO_BOTTOM 150
+#ifndef PANGO_CHECK_VERSION
+#define PANGO_CHECK_VERSION(major, minor, micro) \
+ (PANGO_VERSION_MAJOR > (major) || \
+ (PANGO_VERSION_MAJOR == (major) && PANGO_VERSION_MINOR > (minor)) || \
+ (PANGO_VERSION_MAJOR == (major) && PANGO_VERSION_MINOR == (minor) && \
+ PANGO_VERSION_MICRO >= (micro)))
+#endif
+
/* special text height handling
* each item has three text height variables:
* + text_height: actual height of the displayed (i.e. on-screen) PangoLayout.
@@ -1973,12 +1981,18 @@ create_label_layout (CajaIconCanvasItem *item,
CajaIconContainer *container;
EelCanvasItem *canvas_item;
char *zeroified_text;
+ #if PANGO_CHECK_VERSION (1, 44, 0)
+ PangoAttrList *attr_list;
+ #endif
canvas_item = EEL_CANVAS_ITEM (item);
container = CAJA_ICON_CONTAINER (canvas_item->canvas);
context = gtk_widget_get_pango_context (GTK_WIDGET (canvas_item->canvas));
layout = pango_layout_new (context);
+ #if PANGO_CHECK_VERSION (1, 44, 0)
+ attr_list = pango_attr_list_new ();
+ #endif
zeroified_text = NULL;
@@ -2028,6 +2042,11 @@ create_label_layout (CajaIconCanvasItem *item,
pango_layout_set_spacing (layout, LABEL_LINE_SPACING);
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
+ #if PANGO_CHECK_VERSION (1, 44, 0)
+ pango_attr_list_insert (attr_list, pango_attr_insert_hyphens_new (FALSE));
+ pango_layout_set_attributes (layout, attr_list);
+ #endif
+
/* Create a font description */
if (container->details->font)
{
@@ -2043,6 +2062,9 @@ create_label_layout (CajaIconCanvasItem *item,
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
g_free (zeroified_text);
+ #if PANGO_CHECK_VERSION (1, 44, 0)
+ pango_attr_list_unref (attr_list);
+ #endif
return layout;
}