From 04bafdebf0e7ea9844eac1796d4efe750fdc7e6a Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Sun, 3 Apr 2022 19:22:56 +0200 Subject: [PATCH] Redo icon handling in cmake Using globs for file copying prevents cmake from discovering newly added icons. Writing rules that explicitly use lists of icons will fix this as a new icon in the sources will have to be added to the list and will force reparsing by cmake. We have to maintain the lists anyway for our dist target so there's actually no extra work involved for the devs. --- data/pixmaps/CMakeLists.txt | 74 ++++++++++-------------- gnucash/gnome/gnc-plugin-page-register.c | 2 +- 2 files changed, 30 insertions(+), 46 deletions(-) diff --git a/data/pixmaps/CMakeLists.txt b/data/pixmaps/CMakeLists.txt index e44e9b465f..db331fb1b8 100644 --- a/data/pixmaps/CMakeLists.txt +++ b/data/pixmaps/CMakeLists.txt @@ -1,40 +1,4 @@ - -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash - PATTERN Makefile* EXCLUDE - PATTERN CMake* EXCLUDE - PATTERN CTest* EXCLUDE - PATTERN cmake* EXCLUDE - PATTERN hicolor EXCLUDE -) -file(COPY ${CMAKE_CURRENT_SOURCE_DIR} - DESTINATION ${DATADIR_BUILD}/gnucash - PATTERN Makefile* EXCLUDE - PATTERN CMake* EXCLUDE - PATTERN CTest* EXCLUDE - PATTERN cmake* EXCLUDE - PATTERN hicolor EXCLUDE -) -install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/hicolor DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash/icons - REGEX "hicolor/.*/apps/.*" EXCLUDE -) -file( - COPY ${CMAKE_CURRENT_SOURCE_DIR}/hicolor - DESTINATION ${DATADIR_BUILD}/gnucash/icons - REGEX "hicolor/.*/apps/.*" EXCLUDE -) - -install( - DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/hicolor DESTINATION ${CMAKE_INSTALL_DATADIR}/icons - REGEX "hicolor/.*/actions/.*" EXCLUDE -) -file( - COPY ${CMAKE_CURRENT_SOURCE_DIR}/hicolor - DESTINATION ${DATADIR_BUILD}/icons - REGEX "hicolor/.*/actions/.*" EXCLUDE -) - -set(gncpixmap_DATA +set(gnc_action_icons hicolor/16x16/actions/gnc-account.png hicolor/24x24/actions/gnc-account.png hicolor/16x16/actions/gnc-account-delete.png @@ -71,12 +35,9 @@ set(gncpixmap_DATA hicolor/24x24/actions/gnc-sx-new.png hicolor/16x16/actions/gnc-transfer.png hicolor/24x24/actions/gnc-transfer.png - gnucash-icon.ico - gnucash-icon-48x48.bmp - gnucash_splash.png ) -set(gncicon_DATA +set(gnc_app_icons hicolor/16x16/apps/gnucash-icon.png hicolor/22x22/apps/gnucash-icon.png hicolor/24x24/apps/gnucash-icon.png @@ -86,12 +47,35 @@ set(gncicon_DATA hicolor/96x96/apps/gnucash-icon.png hicolor/128x128/apps/gnucash-icon.png hicolor/256x256/apps/gnucash-icon.png + hicolor/scalable/apps/gnucash-icon.svg ) -set(gncscalableicon_DATA - hicolor/scalable/apps/gnucash-icon.svg +set(gnc_other_pixmaps +gnucash-icon.ico +gnucash-icon-48x48.bmp +gnucash_splash.png ) -set_local_dist(pixmaps_DIST_local CMakeLists.txt ${gncpixmap_DATA} - ${gncicon_DATA} ${gncscalableicon_DATA}) +install(FILES ${gnc_other_pixmaps} DESTINATION ${CMAKE_INSTALL_DATADIR}/gnucash/pixmaps) +file(COPY ${gnc_other_pixmaps} DESTINATION ${DATADIR_BUILD}/gnucash/pixmaps) + +set(dest_base_dir "gnucash/icons") + +function (copy_iconpaths_to_dest iconpaths dest_base_dir) + foreach(iconpath ${iconpaths}) + get_filename_component(dest_rel_dir ${iconpath} DIRECTORY) + set(dest_dir "${dest_base_dir}/${dest_rel_dir}") + install(FILES ${iconpath} DESTINATION "${CMAKE_INSTALL_DATADIR}/${dest_dir}") + file(COPY ${iconpath} DESTINATION "${DATADIR_BUILD}/${dest_dir}") + endforeach() +endfunction() + +copy_iconpaths_to_dest ("${gnc_action_icons}" "gnucash/icons") +copy_iconpaths_to_dest ("${gnc_app_icons}" "icons") + +#install(FILES ${gnc_app_icons} DESTINATION ${CMAKE_INSTALL_DATADIR}/icons) +#file(COPY ${gnc_app_icons} DESTINATION ${DATADIR_BUILD}/icons) + +set_local_dist(pixmaps_DIST_local CMakeLists.txt ${gnc_action_icons} + ${gnc_other_pixmaps} ${gnc_app_icons}) set(pixmaps_DIST ${pixmaps_DIST_local} PARENT_SCOPE) diff --git a/gnucash/gnome/gnc-plugin-page-register.c b/gnucash/gnome/gnc-plugin-page-register.c index ccdaeb4a35..9e20841f28 100644 --- a/gnucash/gnome/gnc-plugin-page-register.c +++ b/gnucash/gnome/gnc-plugin-page-register.c @@ -400,7 +400,7 @@ static GtkActionEntry gnc_plugin_page_register_actions [] = G_CALLBACK (gnc_plugin_page_register_cmd_paste_transaction) }, { - "DuplicateTransactionAction", "edit-copy", DUPLICATE_TRANSACTION_LABEL, "", + "DuplicateTransactionAction", "edit-copy-ours", DUPLICATE_TRANSACTION_LABEL, "", DUPLICATE_TRANSACTION_TIP, G_CALLBACK (gnc_plugin_page_register_cmd_duplicate_transaction) },