[nautilus/gnome-3-34] canvas-item, view-icon-item-ui: Don't hyphenate filenames
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-34] canvas-item, view-icon-item-ui: Don't hyphenate filenames
- Date: Mon, 14 Oct 2019 12:20:09 +0000 (UTC)
commit 9738d8561ed38a87b4d72db3e49653641edd9a09
Author: António Fernandes <antoniof gnome org>
Date: Wed Sep 4 21:45:05 2019 +0000
canvas-item, view-icon-item-ui: Don't hyphenate filenames
Pango 1.44 got the ability to automatically hyphenate on line breaks,
which is on by default, but can be set off by a new attribute.
As a result, we now hyphenate filenames, which is confusing, because
a filename may already include hyphens.
To restore the previous behavior, let's not insert hyphens when
breaking filenames in multiple lines.
Closes https://gitlab.gnome.org/GNOME/nautilus/issues/1177
(cherry picked from commit c73ad94a72f8e9a989b01858018de74182d17f0e)
src/nautilus-canvas-item.c | 6 ++++++
src/nautilus-view-icon-item-ui.c | 6 ++++++
2 files changed, 12 insertions(+)
---
diff --git a/src/nautilus-canvas-item.c b/src/nautilus-canvas-item.c
index 42181e8c4..4d33d119b 100644
--- a/src/nautilus-canvas-item.c
+++ b/src/nautilus-canvas-item.c
@@ -1381,12 +1381,14 @@ create_label_layout (NautilusCanvasItem *item,
GString *str;
char *zeroified_text;
const char *p;
+ PangoAttrList *attr_list;
canvas_item = EEL_CANVAS_ITEM (item);
container = NAUTILUS_CANVAS_CONTAINER (canvas_item->canvas);
context = gtk_widget_get_pango_context (GTK_WIDGET (canvas_item->canvas));
layout = pango_layout_new (context);
+ attr_list = pango_attr_list_new ();
zeroified_text = NULL;
@@ -1415,6 +1417,9 @@ create_label_layout (NautilusCanvasItem *item,
pango_layout_set_spacing (layout, LABEL_LINE_SPACING);
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
+ pango_attr_list_insert (attr_list, pango_attr_insert_hyphens_new (FALSE));
+ pango_layout_set_attributes (layout, attr_list);
+
/* Create a font description */
if (container->details->font)
{
@@ -1427,6 +1432,7 @@ create_label_layout (NautilusCanvasItem *item,
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
g_free (zeroified_text);
+ pango_attr_list_unref (attr_list);
return layout;
}
diff --git a/src/nautilus-view-icon-item-ui.c b/src/nautilus-view-icon-item-ui.c
index 805c68f89..d192e28fa 100644
--- a/src/nautilus-view-icon-item-ui.c
+++ b/src/nautilus-view-icon-item-ui.c
@@ -128,6 +128,7 @@ constructed (GObject *object)
GtkBox *container;
GtkBox *item_selection_background;
GtkLabel *label;
+ PangoAttrList *attr_list;
GtkStyleContext *style_context;
NautilusFile *file;
guint icon_size;
@@ -149,6 +150,9 @@ constructed (GObject *object)
label = GTK_LABEL (gtk_label_new (nautilus_file_get_display_name (file)));
gtk_widget_show (GTK_WIDGET (label));
+ attr_list = pango_attr_list_new ();
+ pango_attr_list_insert (attr_list, pango_attr_insert_hyphens_new (FALSE));
+ gtk_label_set_attributes (label, attr_list);
gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_MIDDLE);
gtk_label_set_line_wrap (label, TRUE);
gtk_label_set_line_wrap_mode (label, PANGO_WRAP_WORD_CHAR);
@@ -178,6 +182,8 @@ constructed (GObject *object)
(GCallback) on_view_item_size_changed, self);
g_signal_connect (self->model, "notify::file",
(GCallback) on_view_item_file_changed, self);
+
+ pango_attr_list_unref (attr_list);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]