on xenial help sign in
Implemented a quick hack to get some gicons working, and fallback to base icons for annotated ones. Proper global solution needs to be implemented.
063b956Pawel Stolowski
Dash/GenericLensView.qml+26−1
@@ -22,6 +22,31 @@ import "../Components/ListItems" as ListItems
22LensView {
22LensView {
23 id: lensView
23 id: lensView
24
24
25+ //FIXME: a quick hack to get icons out of gicons and fallback to
26+ //base icon for annotated icons. Doesn't correctly handle all icons.
27+ //Proper global solution needed.
28+ function from_gicon(name) {
29+ var icon_name = name;
30+ var annotated_re = /^. UnityProtocolAnnotatedIcon/;
31+ if (annotated_re.test(name)) {
32+ var base_icon_re = /'base-icon':.+?'(.+?)'/;
33+ var base_icon = name.toString().match(base_icon_re);
34+ icon_name = base_icon[1];
35+ }
36+ else {
37+ var themed_re = /^. GThemedIcon\s*([^\s]+)\s*/;
38+ var themed = name.match(themed_re);
39+ if (themed) {
40+ return "image://gicon/" + themed[1];
41+ }
42+ }
43+ var remote_re = /^http/;
44+ if (remote_re.test(icon_name)) {
45+ return icon_name;
46+ }
47+ return "image://gicon/" + icon_name;
48+ }
49+
25 onIsCurrentChanged: {
50 onIsCurrentChanged: {
26 pageHeader.resetSearch();
51 pageHeader.resetSearch();
27 }
52 }
@@ -74,7 +99,7 @@ LensView {
74 text: column_5 ? column_5 : "" // FIXME: this shouldn't be necessary
99 text: column_5 ? column_5 : "" // FIXME: this shouldn't be necessary
75 imageWidth: units.gu(11)
100 imageWidth: units.gu(11)
76 imageHeight: units.gu(16)
101 imageHeight: units.gu(16)
77− source: column_1 ? column_1 : "" // FIXME: ditto
102+ source: column_1 ? from_gicon(column_1) : "" // FIXME: ditto
78 }
103 }
79 }
104 }
80 }
105 }