summaryrefslogtreecommitdiff
path: root/src/caja-sidebar-title.c
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2018-06-18 19:55:54 +0200
committerPablo Barciela <[email protected]>2018-06-18 19:55:54 +0200
commiteafef859551698a62714177adfedb04672b2c030 (patch)
treef81af0047585cf4a27e94e1819b12d5529ed3da1 /src/caja-sidebar-title.c
parenta797afc41638ca9dedd432eee2f2c53e00411926 (diff)
downloadcaja-eafef859551698a62714177adfedb04672b2c030.tar.bz2
caja-eafef859551698a62714177adfedb04672b2c030.tar.xz
caja-sidebar-title: Fix: images broken in sidebar
Fixes https://github.com/mate-desktop/caja/pull/1004#issuecomment-398140812
Diffstat (limited to 'src/caja-sidebar-title.c')
-rw-r--r--src/caja-sidebar-title.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/src/caja-sidebar-title.c b/src/caja-sidebar-title.c
index 1907b370..e13c8549 100644
--- a/src/caja-sidebar-title.c
+++ b/src/caja-sidebar-title.c
@@ -422,6 +422,35 @@ update_icon (CajaSidebarTitle *sidebar_title)
}
static void
+override_title_font (GtkWidget *widget,
+ const gchar *font)
+{
+ gchar *css;
+ GtkCssProvider *provider;
+ gchar *tempsize;
+
+ provider = gtk_css_provider_new ();
+ tempsize = g_strdup (font);
+
+ g_strreverse (tempsize);
+ g_strcanon (tempsize, "1234567890", '\0');
+ g_strreverse (tempsize);
+
+ gchar tempfont [strlen (font)];
+ strcpy (tempfont, font);
+ tempfont [strlen (font) - strlen (tempsize)] = 0;
+
+ css = g_strdup_printf ("label { font-family: %s; font-size: %spt; }", tempfont, tempsize);
+ gtk_css_provider_load_from_data (provider, css, -1, NULL);
+ g_free (css);
+
+ gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+}
+
+static void
update_title_font (CajaSidebarTitle *sidebar_title)
{
int available_width, width;
@@ -480,11 +509,7 @@ update_title_font (CajaSidebarTitle *sidebar_title)
pango_font_description_set_size (title_font, max_fit_font_size * PANGO_SCALE);
pango_font_description_set_weight (title_font, PANGO_WEIGHT_BOLD);
- PangoAttrList *attrs = pango_attr_list_new ();
- PangoAttribute *font_desc_attr = pango_attr_font_desc_new (title_font);
- pango_attr_list_insert (attrs, font_desc_attr);
- gtk_label_set_attributes (GTK_LABEL (sidebar_title->details->title_label), attrs);
- pango_attr_list_unref (attrs);
+ override_title_font (sidebar_title->details->title_label, pango_font_description_to_string (title_font));
pango_font_description_free (title_font);
}