Remove ignored style properties from CSS
ClosedPublic

Authored by andrzej1_1 on Feb 14 2019, 9:32 AM.

Details

Summary

When I was running GTK3 application pavucontrol, I was getting warnings:

(pavucontrol:10863): Gtk-WARNING **: 10:09:55.669: Theme parsing error: gtk.css:127:35: The style property GtkButton:child-displacement-x is deprecated and shouldn't be used anymore. It will be removed in a future version                                                  

(pavucontrol:10863): Gtk-WARNING **: 10:09:55.669: Theme parsing error: gtk.css:128:35: The style property GtkButton:child-displacement-y is deprecated and shouldn't be used anymore. It will be removed in a future version                                                  

(pavucontrol:10863): Gtk-WARNING **: 10:09:55.669: Theme parsing error: gtk.css:129:34: The style property GtkCheckButton:indicator-size is deprecated and shouldn't be used anymore. It will be removed in a future version                                                   

(pavucontrol:10863): Gtk-WARNING **: 10:09:55.669: Theme parsing error: gtk.css:130:36: The style property GtkCheckMenuItem:indicator-size is deprecated and shouldn't be used anymore. It will be removed in a future version                                                 

(pavucontrol:10863): Gtk-WARNING **: 10:09:55.669: Theme parsing error: gtk.css:132:46: The style property GtkScrolledWindow:scrollbars-within-bevel is deprecated and shouldn't be used anymore. It will be removed in a future version                                       

(pavucontrol:10863): Gtk-WARNING **: 10:09:55.669: Theme parsing error: gtk.css:135:30: The style property GtkExpander:expander-size is
deprecated and shouldn't be used anymore. It will be removed in a future version                                                       

(pavucontrol:10863): Gtk-WARNING **: 10:09:55.669: Theme parsing error: gtk.css:142:29: The style property GtkStatusbar:shadow-type is deprecated and shouldn't be used anymore. It will be removed in a future version

This was annoying, so I decided to fix it. Firstly I thought it is a application problem, but then I discovered it is breeze-gtk issue. For example GTK3 documentation states that:

GtkStatusbar:shadow-type has been deprecated since version 3.20 and should not be used in newly-written code.

Use CSS properties to determine the appearance, the value of this style property is ignored.

So if some styles are ignored, I can remove them and get rid of part of warnings:

  1. I wrote python script for finding all deprecation messages in docs:
  2. I ran script and saved results to file
  3. I used it to find all ignored properties in CSS:
$ find-deprecated-styles.py > /tmp/gtk-deprecated.txt
$ cd breeze-gtk/src/gtk320/
$ cat /tmp/gtk-deprecated.txt | sed -n 's/^ \* \([^ ]*\).*the value of this style property is ignored.*$/\1/p' | tr : -  | while read style; do grep -Rn $style; done
widgets/_base.scss:40:  -GtkStatusbar-shadow-type: none;
widgets/_base.scss:12:  -GtkButton-child-displacement-x: 0;
widgets/_base.scss:13:  -GtkButton-child-displacement-y: 0;
widgets/_base.scss:16:  -GtkCheckMenuItem-indicator-size: 18;
widgets/_base.scss:24:  -GtkScrolledWindow-scrollbars-within-bevel: 0;

Then I just removed them.

Edit:
I checked and there was two more deprecated styles, which require a little work:

$ cat /tmp/gtk-deprecated.txt | sed -n 's/^ \* \([^ ]*\).*CSS.*$/\1/p' | tr : -  | while read style; do gre
p -Rn $style; done                                   
widgets/_base.scss:24:  -GtkExpander-expander-size: 16;  
widgets/_base.scss:12:  -GtkCheckButton-indicator-size: 18;

According to documentation (1, 2) min-width and min-height should be used instead of them. I managed to do so with help of following URLs:

Diff Detail

Repository
R98 Breeze for Gtk
Lint
Lint Skipped
Unit
Unit Tests Skipped
andrzej1_1 created this revision.Feb 14 2019, 9:32 AM
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 14 2019, 9:32 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
andrzej1_1 requested review of this revision.Feb 14 2019, 9:32 AM
andrzej1_1 removed a project: Plasma.
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 14 2019, 1:55 PM

Nice catch. Upon testing, I noticed two remaining warnings from Pavucontrol:

$  (arcpatch-D18999) pavucontrol 

(pavucontrol:7385): Gtk-WARNING **: 09:18:56.255: Theme parsing error: gtk.css:68:34: The style property GtkCheckButton:indicator-size is deprecated and shouldn't be used anymore. It will be removed in a future version

(pavucontrol:7385): Gtk-WARNING **: 09:18:56.256: Theme parsing error: gtk.css:72:30: The style property GtkExpander:expander-size is deprecated and shouldn't be used anymore. It will be removed in a future version

Can you fix those too?

andrzej1_1 retitled this revision from Remove ignore style properties from CSS to Remove ignored style properties from CSS.Feb 14 2019, 9:39 PM

@ngraham This fix was prepared for totally ignored style properties only. For example GtkCheckButton:indicator-size cannot be just removed:

GtkCheckButton:indicator-size has been deprecated since version 3.20 and should not be used in newly-written code.

Use CSS min-width and min-height on the indicator node.

This will require adding CSS and I am not familiar with GTK. But I think I will be able to work it out as well, so give me some time and I will let you know.

ngraham accepted this revision.Feb 14 2019, 10:47 PM

Oh ok. If you want to do that in separate patch, let me know and I'll land this one for you.

...on that subject, can you give me your full name and email address so I can land the patch with the correct authorship information?

This revision is now accepted and ready to land.Feb 14 2019, 10:47 PM
andrzej1_1 edited the summary of this revision. (Show Details)

Include fixes for -GtkExpander-expander-size and -GtkCheckButton-indicator-size

@ngraham done; I updated revison. My full name is Andrzej Broński and my email: andrzej1_1@o2.pl.

With this latest version, I still see one warning:

$ pavucontrol 

(pavucontrol:6494): Gtk-WARNING **: 09:45:33.717: Theme parsing error: gtk.css:71:30: The style property GtkExpander:expander-size is deprecated and shouldn't be used anymore. It will be removed in a future version

And indeed, that property is still there in the source:

$ grep -ri gtkexpander-expander-size src/
src/gtk318/widgets/_base.scss:  -GtkExpander-expander-size: 16;
src/gtk320/widgets/_base.scss:  -GtkExpander-expander-size: 16;

Do you mind doing one more? :)

andrzej1_1 updated this revision to Diff 51773.EditedFeb 15 2019, 4:59 PM

@ngraham Sorry, I made some mistake when generating patch. Now everything should be correct.

ngraham accepted this revision.Feb 15 2019, 5:07 PM

Thanks, fixed now. Will land this. Thanks again for the contribution!

This revision was automatically updated to reflect the committed changes.