Linux: Add Mimetype support for maps

This allows to open map files from the filemanager by clicking at them.

2nd, hidden *.desktop file needed to associate the mimetype with the wesnoth command
icons in mimetype/ are used as file icon
icons in apps/ are shown when the user want to change the default program for the mimetype
(In Dolphin this place can be reached after opening the file properties)
This commit is contained in:
Severin Glöckner 2019-10-09 02:32:49 +02:00
parent 091a5e302c
commit 6bee4e751c
9 changed files with 36 additions and 2 deletions

View file

@ -595,8 +595,10 @@ endif(ENABLE_CAMPAIGN_SERVER AND NOT ENABLE_GAME)
# Install desktop file so wesnoth appears in the application start menu with an icon
#
if(ENABLE_DESKTOP_ENTRY AND ENABLE_GAME)
install(FILES packaging/org.wesnoth.Wesnoth.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications )
install(DIRECTORY packaging/icons/hicolor DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons )
install(FILES packaging/org.wesnoth.Wesnoth.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications )
install(FILES packaging/org.wesnoth.Wesnoth_Editor.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications )
install(FILES packaging/org.wesnoth.Wesnoth.xml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/mime/packages )
endif(ENABLE_DESKTOP_ENTRY AND ENABLE_GAME)
if(ENABLE_APPDATA_FILE AND ENABLE_GAME)

View file

@ -73,6 +73,7 @@ opts.AddVariables(
PathVariable('datadirname', 'sets the name of data directory', "wesnoth$version_suffix", PathVariable.PathAccept),
PathVariable('desktopdir', 'sets the desktop entry directory to a non-default location', "$datarootdir/applications", PathVariable.PathAccept),
PathVariable('icondir', 'sets the icons directory to a non-default location', "$datarootdir/icons", PathVariable.PathAccept),
PathVariable('mimedir', 'sets the mimetype directory to a non-default location', "$datarootdir/mime/packages", PathVariable.PathAccept),
PathVariable('appdatadir', 'sets the appdata directory to a non-default location', "$datarootdir/metainfo", PathVariable.PathAccept),
BoolVariable('internal_data', 'Set to put data in Mac OS X application fork', False),
PathVariable('localedirname', 'sets the locale data directory to a non-default location', "translations", PathVariable.PathAccept),
@ -745,6 +746,8 @@ InstallManpages(env, "wesnoth")
if have_client_prereqs and have_X and env["desktop_entry"]:
env.InstallData("icondir", "wesnoth", "packaging/icons")
env.InstallData("desktopdir", "wesnoth", "packaging/org.wesnoth.Wesnoth.desktop")
env.InstallData("desktopdir", "wesnoth", "packaging/org.wesnoth.Wesnoth_Editor.desktop")
env.InstallData("mimedir", "wesnoth", "packaging/org.wesnoth.Wesnoth.xml")
if have_client_prereqs and "linux" in sys.platform and env["appdata_file"]:
env.InstallData("appdatadir", "wesnoth", "packaging/org.wesnoth.Wesnoth.appdata.xml")

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View file

@ -93,4 +93,4 @@ Name[sr@ijekavian]=Уређивач мапа
Name[sr@ijekavianlatin]=Uređivač mapa
Name[sr@latin]=Uređivač mapa
Name[tr]=Harita Düzenleyici
Exec=sh -c "wesnoth -e >/dev/null 2>&1"
Exec=sh -c "wesnoth -e >/dev/null 2>&1"

View file

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-wesnoth-map">
<sub-class-of type="text/plain"/>
<comment>Wesnoth Map</comment>
<comment xml:lang="de">Wesnoth Karte</comment>
<glob pattern="*.map"/>
<icon name="wesnoth-map"/>
</mime-type>
<mime-type type="application/x-wesnoth-map">
<sub-class-of type="text/plain"/>
<comment>Wesnoth Map</comment>
<comment xml:lang="de">Wesnoth Karte</comment>
<glob pattern="*.mask"/>
<icon name="wesnoth-map"/>
</mime-type>
</mime-info>

View file

@ -0,0 +1,12 @@
[Desktop Entry]
NoDisplay=True
Version=1.0
Type=Application
Name=Battle for Wesnoth (Map Editor)
GenericName=Map editor of a strategy game
GenericName[de]=Karteneditor eines Strategiespiels
Comment=Map Editor of a turn-based strategy game
Comment[de]=Karteneditor eines rundenbasierten Strategiespiels
Icon=wesnoth_editor-icon
Exec=sh -c "wesnoth -e -l %u >/dev/null 2>&1"
MimeType=application/x-wesnoth-map;