[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-buildsystem
Subject:    Re: Iconcache additions
From:       Rivo Laks <rivolaks () hot ! ee>
Date:       2007-07-21 9:21:48
Message-ID: 200707211221.48475.rivolaks () hot ! ee
[Download RAW message or body]

Ühel kenal päeval (laupäev 21 juuli 2007) kirjutas Alexander Neundorf:
> Hi Rivo,
>
> On Friday 20 July 2007 11:12, Rivo Laks wrote:
> > Hi
> >
> > The attached patch adds KDE4_ICONS_INSTALLED macro which updates mtime of
> > the hicolor icontheme directory, to make the icon cache update itself. It
> > also makes the KDE4_INSTALL_ICONS macro use it.
>
> So how does it have to be used ?
> install( FILES  preview.png DESTINATION
>            ${DATA_INSTALL_DIR}/dolphin/icons/hicolor/64x64/actions )
> kde4_update_iconcache(${ICON_INSTALL_DIR})

Yes, this one. The iconcache doesn't look at app dirs, only at the general 
icon dir (share/icons/...), so the latter has to be updated.

> For kde4_install_icons() it will look like this, right ?
> kde4_install_icons(${ICON_INSTALL_DIR})
> kde4_update_iconcache(${ICON_INSTALL_DIR})

The kde4_install_icons() calls kde4_update_iconcache() itself, so that's not 
really necessary.

Also, since we always want to update ${ICON_INSTALL_DIR}/hicolor, I changed 
the kde4_update_iconcache() to do that without taking any arguments. So now 
you just need to do
    kde4_update_iconcache()
after using install() to install icons. If you use kde4_install_icons() you 
needn't change anything.

> > On k-c-d it was suggested that this could be a generic FD.org macro, but
> > I'm not sure where to put it in that case. Should another file be created
> > in kdelibs/cmake/modules/? Or should it even go into cmake itself (in
> > that case I believe we also have to ship a kde version of it though)?
> >
> > As touch doesn't exist on windows, I create a temporary file in the theme
> > dir there and then delete it. It should work but I haven't tested it, so
> > if anyone could make sure it really does what it should, I'd appreciate
> > it.
> >
> > And finally, I'm open to renaming the macro if you have better ideas
> > (KDE4_UPDATE_ICONCACHE?) ;-)
>
> Yes, sounds better IMO (ok, I suggested it ;-)

Ok, changed :-)

> Does version for Windows (if it works under Windows) also work under UNIX ?
> If it does, I'd say there's no need to have two different versions.

It does. It is a bit hackish, but it's probably better than two versions 
indeed, so I've changed that as well.
Updated patch attached.

Rivo

PS: I'm subscribed so you needn't CC me :-)

["cmake-iconcache.diff" (text/x-diff)]

Index: FindKDE4Internal.cmake
===================================================================
--- FindKDE4Internal.cmake	(revision 690333)
+++ FindKDE4Internal.cmake	(working copy)
@@ -183,6 +183,10 @@
 #    KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); to be able to use xmlgui
 #    and other things in the test, that normally require installation
 #
+# KDE4_UPDATE_ICONCACHE()
+#    Notifies the icon cache that new icons have been installed by updating
+#    mtime of ${ICON_INSTALL_DIR}/hicolor directory.
+#
 # KDE4_INSTALL_ICONS( path theme)
 #    Installs all png and svgz files in the current directory to the icon
 #    directoy given in path, in the subdirectory for the given icon theme.
Index: KDE4Macros.cmake
===================================================================
--- KDE4Macros.cmake	(revision 690333)
+++ KDE4Macros.cmake	(working copy)
@@ -15,6 +15,7 @@
 # KDE4_ADD_TEST_EXECUTABLE
 # KDE4_ADD_EXECUTABLE
 # KDE4_ADD_WIDGET_FILES
+# KDE4_UPDATE_ICONCACHE
 # KDE4_INSTALL_ICONS
 # KDE4_REMOVE_OBSOLETE_CMAKE_FILES
 # KDE4_NO_ENABLE_FINAL
@@ -328,6 +329,14 @@
 endmacro (KDE4_CREATE_HTML_HANDBOOK)
 
 
+macro (KDE4_UPDATE_ICONCACHE)
+    # Update mtime of hicolor icon theme dir.
+    # We don't always have touch command (e.g. on Windows), so instead create
+    #  and delete a temporary file in the theme dir.
+    install(CODE "file(WRITE \"${ICON_INSTALL_DIR}/hicolor/temp.txt\" \"update\")")
+    install(CODE "file(REMOVE \"${ICON_INSTALL_DIR}/hicolor/temp.txt\")")
+endmacro (KDE4_UPDATE_ICONCACHE)
+
 # a "map" of short type names to the directories
 # unknown names should give empty results
 # KDE 3 compatibility
@@ -417,6 +426,8 @@
       endif( _theme_GROUP)
    endforeach (_current_ICON)
 
+   KDE4_UPDATE_ICONCACHE()
+
 endmacro (KDE4_INSTALL_ICONS)
 
 


_______________________________________________
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic