GNOME Bugzilla – Bug 768985
Error parsing CSS style
Last modified: 2016-10-20 09:46:59 UTC
After freshly built Logs using jhbuild, running Logs will show up the following errors. It seems there are two CSS style don't fit any more. Gtk-Message: Failed to load module "pk-gtk-module" Gtk-Message: Failed to load module "canberra-gtk-module" Gtk-Message: Failed to load module "pk-gtk-module" Gtk-Message: Failed to load module "canberra-gtk-module" (gnome-logs:22729): Gtk-WARNING **: GtkListBox with a model will ignore sort and filter functions (gnome-logs:22729): Gtk-WARNING **: GtkListBox with a model will ignore sort and filter functions ** (gnome-logs:22729): CRITICAL **: Error while parsing CSS style (line: 1, character: 26): not a number ** (gnome-logs:22729): CRITICAL **: Error while parsing CSS style (line: 1, character: 38): Using Pango syntax for the font: style property is deprecated; please use CSS syntax
I reproduced this bug in openSUSE Tumbleweed, which ships GNOME 3.22.
This is caused by on_monospace_font_name_changed in src/gl-application.c. > gtk_css_provider_load_from_data (provider, css_fragment, -1, NULL); This line of code parse css_fragment, which is ".event-monospace { font: Monospace 11; }" See this output: "Using Pango syntax for the font: style property is deprecated; please use CSS syntax". So CSS syntax should be used instead of Pango syntax for fonts.
Created attachment 337298 [details] [review] Patch for fixing CSS parsing error
The current fix will fail if the font's name isn't a single work, for instance: Source Code Pro. GTK+ has a function to convert Pango syntax into CSS syntax: https://git.gnome.org/browse/gtk+/tree/gtk/gtkfontbutton.c?id=31b77ae0b6e3d0bc04563678186e241505d05627#n1168 Making the API public was dismissed: https://bugzilla.gnome.org/show_bug.cgi?id=768527
(In reply to Garrett Regier from comment #4) > The current fix will fail if the font's name isn't a single work, for > instance: Source Code Pro. > > GTK+ has a function to convert Pango syntax into CSS syntax: > https://git.gnome.org/browse/gtk+/tree/gtk/gtkfontbutton. > c?id=31b77ae0b6e3d0bc04563678186e241505d05627#n1168 > > > Making the API public was dismissed: > https://bugzilla.gnome.org/show_bug.cgi?id=768527 Thanks for the information. It's really helpful!
Created attachment 337382 [details] [review] Patch for fixing CSS parsing error Patch with pango_font_description_to_css() from gtk+ added to gl-util.c as a helper function.
Created attachment 337384 [details] [review] Patch for fixing CSS parsing error Fix an issue of the previous patch
Review of attachment 337384 [details] [review]: ::: src/gl-util.c @@ +463,3 @@ + +gchar * +pango_font_description_to_css (PangoFontDescription *desc) If this code was copied from a different source, that should be mentioned, so that the function can be updated as necessary. Also, you should check that the licenses are compatible.
Created attachment 338087 [details] [review] Fix css style parsing error @David Yes. It's compatible with the license gtk+ uses.
Review of attachment 338087 [details] [review]: Looks good.
Comment on attachment 338087 [details] [review] Fix css style parsing error Pushed to master as commit bcf4307e2e22328c7f9d87df653a78c06f7f6a5a.