After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 768985 - Error parsing CSS style
Error parsing CSS style
Status: RESOLVED FIXED
Product: gnome-logs
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-logs maintainer(s)
gnome-logs maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-07-20 09:23 UTC by Jonathan Kang
Modified: 2016-10-20 09:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch for fixing CSS parsing error (1.47 KB, patch)
2016-10-10 08:54 UTC, Jonathan Kang
none Details | Review
Patch for fixing CSS parsing error (5.95 KB, patch)
2016-10-11 03:28 UTC, Jonathan Kang
none Details | Review
Patch for fixing CSS parsing error (6.25 KB, patch)
2016-10-11 07:12 UTC, Jonathan Kang
none Details | Review
Fix css style parsing error (6.34 KB, patch)
2016-10-20 09:22 UTC, Jonathan Kang
committed Details | Review

Description Jonathan Kang 2016-07-20 09:23:53 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
Comment 1 Jonathan Kang 2016-09-26 02:22:27 UTC
I reproduced this bug in openSUSE Tumbleweed, which ships GNOME 3.22.
Comment 2 Jonathan Kang 2016-09-27 08:01:41 UTC
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.
Comment 3 Jonathan Kang 2016-10-10 08:54:58 UTC
Created attachment 337298 [details] [review]
Patch for fixing CSS parsing error
Comment 4 Garrett Regier 2016-10-10 16:12:43 UTC
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
Comment 5 Jonathan Kang 2016-10-11 03:26:41 UTC
(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!
Comment 6 Jonathan Kang 2016-10-11 03:28:08 UTC
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.
Comment 7 Jonathan Kang 2016-10-11 07:12:32 UTC
Created attachment 337384 [details] [review]
Patch for fixing CSS parsing error

Fix an issue of the previous patch
Comment 8 David King 2016-10-20 08:51:17 UTC
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.
Comment 9 Jonathan Kang 2016-10-20 09:22:33 UTC
Created attachment 338087 [details] [review]
Fix css style parsing error

@David

Yes. It's compatible with the license gtk+ uses.
Comment 10 David King 2016-10-20 09:42:46 UTC
Review of attachment 338087 [details] [review]:

Looks good.
Comment 11 Jonathan Kang 2016-10-20 09:45:50 UTC
Comment on attachment 338087 [details] [review]
Fix css style parsing error

Pushed to master as commit bcf4307e2e22328c7f9d87df653a78c06f7f6a5a.