blob: 12358e3aedc02f31bb6c5769b2abeb52691343a1 [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
7 $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \
8 base_libdir=${base_libdir}
9else
10
11 # Update the pixbuf loaders in case they haven't been registered yet
12 GDK_PIXBUF_MODULEDIR=${libdir}/gdk-pixbuf-2.0/2.10.0/loaders gdk-pixbuf-query-loaders --update-cache
13
14 for icondir in /usr/share/icons/* ; do
15 if [ -d $icondir ] ; then
16 gtk-update-icon-cache -fqt $icondir
17 fi
18 done
19fi
20}
21
22gtk_icon_cache_postrm() {
23if [ "x$D" != "x" ]; then
24 $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} mlprefix=${MLPREFIX} libdir=${libdir} \
25 base_libdir=${base_libdir}
26else
27 for icondir in /usr/share/icons/* ; do
28 if [ -d $icondir ] ; then
29 gtk-update-icon-cache -qt $icondir
30 fi
31 done
32fi
33}
34
35python populate_packages_append () {
36 packages = d.getVar('PACKAGES', True).split()
37 pkgdest = d.getVar('PKGDEST', True)
38
39 for pkg in packages:
40 icon_dir = '%s/%s/%s/icons' % (pkgdest, pkg, d.getVar('datadir', True))
41 if not os.path.exists(icon_dir):
42 continue
43
44 bb.note("adding hicolor-icon-theme dependency to %s" % pkg)
45 rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme"
46 d.appendVar('RDEPENDS_%s' % pkg, rdepends)
47
48 bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg)
49
50 postinst = d.getVar('pkg_postinst_%s' % pkg, True)
51 if not postinst:
52 postinst = '#!/bin/sh\n'
53 postinst += d.getVar('gtk_icon_cache_postinst', True)
54 d.setVar('pkg_postinst_%s' % pkg, postinst)
55
56 postrm = d.getVar('pkg_postrm_%s' % pkg, True)
57 if not postrm:
58 postrm = '#!/bin/sh\n'
59 postrm += d.getVar('gtk_icon_cache_postrm', True)
60 d.setVar('pkg_postrm_%s' % pkg, postrm)
61}
62