blob: 0f1052b08c77abc62027b61f2202b1d4fdad82df [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001FILES_${PN} += "${datadir}/icons/hicolor"
2
3DEPENDS += "${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk-icon-utils-native"
4
5gtk_icon_cache_postinst() {
6if [ "x$D" != "x" ]; then
Patrick Williamsf1e5d692016-03-30 15:21:19 -05007 $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} \
8 mlprefix=${MLPREFIX} \
9 libdir_native=${libdir_native}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050010else
11
12 # Update the pixbuf loaders in case they haven't been registered yet
Patrick Williamsf1e5d692016-03-30 15:21:19 -050013 ${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
Patrick Williamsc124f4f2015-09-15 14:41:29 -050014
15 for icondir in /usr/share/icons/* ; do
16 if [ -d $icondir ] ; then
17 gtk-update-icon-cache -fqt $icondir
18 fi
19 done
20fi
21}
22
23gtk_icon_cache_postrm() {
24if [ "x$D" != "x" ]; then
Patrick Williamsf1e5d692016-03-30 15:21:19 -050025 $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} \
26 mlprefix=${MLPREFIX} \
27 libdir=${libdir}
Patrick Williamsc124f4f2015-09-15 14:41:29 -050028else
29 for icondir in /usr/share/icons/* ; do
30 if [ -d $icondir ] ; then
31 gtk-update-icon-cache -qt $icondir
32 fi
33 done
34fi
35}
36
37python populate_packages_append () {
38 packages = d.getVar('PACKAGES', True).split()
39 pkgdest = d.getVar('PKGDEST', True)
40
41 for pkg in packages:
42 icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir', True))
43 if not os.path.exists(icon_dir):
44 continue
45
46 bb.note("adding hicolor-icon-theme dependency to %s" % pkg)
47 rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme"
48 d.appendVar('RDEPENDS_%s' % pkg, rdepends)
49
50 bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)
51
52 postinst = d.getVar('pkg_postinst_%s' % pkg, True)
53 if not postinst:
54 postinst = '#!/bin/sh\n'
55 postinst += d.getVar('gtk_icon_cache_postinst', True)
56 d.setVar('pkg_postinst_%s' % pkg, postinst)
57
58 postrm = d.getVar('pkg_postrm_%s' % pkg, True)
59 if not postrm:
60 postrm = '#!/bin/sh\n'
61 postrm += d.getVar('gtk_icon_cache_postrm', True)
62 d.setVar('pkg_postrm_%s' % pkg, postrm)
63}
64