on xenial help sign in
Support annotated icons in the ApplicationsFilterGrid.qml.
6018edeMichał Sawicz
Components/IconUtil.js+5−5
@@ -26,17 +26,17 @@ function from_gicon(name) {
26 var base_icon_re = /'base-icon':.+?'(.+?)'/;
26 var base_icon_re = /'base-icon':.+?'(.+?)'/;
27 var base_icon = name.toString().match(base_icon_re);
27 var base_icon = name.toString().match(base_icon_re);
28 icon_name = base_icon[1];
28 icon_name = base_icon[1];
29− }
30− else {
29+ } else {
31 var themed_re = /^. GThemedIcon\s*([^\s]+)\s*/;
30 var themed_re = /^. GThemedIcon\s*([^\s]+)\s*/;
32 var themed = name.match(themed_re);
31 var themed = name.match(themed_re);
33 if (themed) {
32 if (themed) {
34 return "image://gicon/" + themed[1];
33 return "image://gicon/" + themed[1];
35 }
34 }
36 }
35 }
37− var remote_re = /^http/;
36+ var name_re = /^[a-z-]+$/;
38− if (remote_re.test(icon_name)) {
37+ if (name_re.test(icon_name)) {
38+ return "image://gicon/" + icon_name;
39+ } else {
39 return icon_name;
40 return icon_name;
40 }
41 }
41− return "image://gicon/" + icon_name;
42}
42}
Dash/Apps/ApplicationsFilterGrid.qml+2−1
@@ -17,6 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import "../../Components"
18import "../../Components"
19import "../../Applications"
19import "../../Applications"
20+import "../../Components/IconUtil.js" as IconUtil
20
21
21FilterGrid {
22FilterGrid {
22 id: filterGrid
23 id: filterGrid
@@ -50,7 +51,7 @@ FilterGrid {
50 text: model.column_5 ? model.column_5 : application.name // FIXME: this is temporary
51 text: model.column_5 ? model.column_5 : application.name // FIXME: this is temporary
51 imageWidth: units.gu(8)
52 imageWidth: units.gu(8)
52 imageHeight: units.gu(7.5)
53 imageHeight: units.gu(7.5)
53− source: icon.indexOf("/") == -1 ? "image://gicon/" + icon : icon
54+ source: IconUtil.from_gicon(icon)
54 onClicked: filterGrid.clicked(index, application.desktopFile);
55 onClicked: filterGrid.clicked(index, application.desktopFile);
55 }
56 }
56}
57}