Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use MIME database XML file and install_fritzing.sh #3231

Merged
merged 5 commits into from
Jun 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 32 additions & 35 deletions install_fritzing.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/bin/sh
#
# this is a rough beginning of a linux install script for fritzing
# sets up document icons and file associations using mime types
# sets up document icons and file associations using MIME types
#
# first ensure fritzing is unpacked in its final destination
# and then run this script

APPLICATIONSDIR="${HOME}/.local/share/applications"
MIMEDIR="${HOME}/.local/share/mime"
PACKAGESDIR="${MIMEDIR}/packages"

APPDIR=$(dirname "$0")

Expand All @@ -12,7 +19,7 @@ then
touch ~/.mime.types
fi

# add mime types for fritzing file formats
# add MIME types for fritzing file formats
grep -q application/x-fritzing ~/.mime.types
if [ $? -eq 0 ]
then
Expand All @@ -29,43 +36,33 @@ fi

cd $APPDIR

# install fritzing into mime user directory
xdg-mime install --mode user 'icons/x-fritzing-fz.xml'
xdg-mime install --mode user 'icons/x-fritzing-fzz.xml'
xdg-mime install --mode user 'icons/x-fritzing-fzp.xml'
xdg-mime install --mode user 'icons/x-fritzing-fzpz.xml'
xdg-mime install --mode user 'icons/x-fritzing-fzb.xml'
xdg-mime install --mode user 'icons/x-fritzing-fzbz.xml'
xdg-mime install --mode user 'icons/x-fritzing-fzm.xml'
# install fritzing into user MIME packages directory
mkdir -p "${PACKAGESDIR}"
cp icons/fritzing.xml "${PACKAGESDIR}" || exit 1

# set the default application to fritzing.desktop
xdg-mime default 'fritzing.desktop' application/x-fritzing-fz
xdg-mime default 'fritzing.desktop' application/x-fritzing-fzz
xdg-mime default 'fritzing.desktop' application/x-fritzing-fzp
xdg-mime default 'fritzing.desktop' application/x-fritzing-fzpz
xdg-mime default 'fritzing.desktop' application/x-fritzing-fzb
xdg-mime default 'fritzing.desktop' application/x-fritzing-fzbz
xdg-mime default 'fritzing.desktop' application/x-fritzing-fzm
# install fritzing desktop entry for user (includes MIME associations)
desktop-file-edit --set-key=Exec --set-value="$(pwd)/Fritzing" fritzing.desktop
xdg-desktop-menu install --novendor --mode user fritzing.desktop

# install image-files into user mime system with specified size
# install image-files into user hicolor theme with specified size
# ~/.local/share/icons/hicolor/*size*
xdg-icon-resource install --mode user --context mimetypes --size 128 'icons/fz_icon128.png' application-x-fritzing-fz
xdg-icon-resource install --mode user --context mimetypes --size 256 'icons/fz_icon256.png' application-x-fritzing-fz
xdg-icon-resource install --mode user --context mimetypes --size 128 'icons/fzz_icon128.png' application-x-fritzing-fzz
xdg-icon-resource install --mode user --context mimetypes --size 256 'icons/fzz_icon256.png' application-x-fritzing-fzz
xdg-icon-resource install --mode user --context mimetypes --size 128 'icons/fzp_icon128.png' application-x-fritzing-fzp
xdg-icon-resource install --mode user --context mimetypes --size 256 'icons/fzp_icon256.png' application-x-fritzing-fzp
xdg-icon-resource install --mode user --context mimetypes --size 128 'icons/fzpz_icon128.png' application-x-fritzing-fzpz
xdg-icon-resource install --mode user --context mimetypes --size 256 'icons/fzpz_icon256.png' application-x-fritzing-fzpz
xdg-icon-resource install --mode user --context mimetypes --size 128 'icons/fzb_icon128.png' application-x-fritzing-fzb
xdg-icon-resource install --mode user --context mimetypes --size 256 'icons/fzb_icon256.png' application-x-fritzing-fzb
xdg-icon-resource install --mode user --context mimetypes --size 128 'icons/fzbz_icon128.png' application-x-fritzing-fzbz
xdg-icon-resource install --mode user --context mimetypes --size 256 'icons/fzbz_icon256.png' application-x-fritzing-fzbz
xdg-icon-resource install --mode user --context mimetypes --size 128 'icons/fzm_icon128.png' application-x-fritzing-fzm
xdg-icon-resource install --mode user --context mimetypes --size 256 'icons/fzm_icon256.png' application-x-fritzing-fzm
# /apps
xdg-icon-resource install --noupdate --novendor --mode user --context apps \
--size 256 icons/fritzing_icon.png fritzing
# /mimetypes
ICON_SIZES="128 256"
FILE_EXTENSIONS="fz fzz fzb fzbz fzp fzpz fzm"
for size in ${ICON_SIZES}; do
for extension in ${FILE_EXTENSIONS}; do
xdg-icon-resource install --noupdate --mode user --context mimetypes \
--size ${size} "icons/${extension}_icon${size}.png" \
"application-x-fritzing-${extension}"
done
done

# update user databases
update-desktop-database ~/.local/share/applications
update-mime-database ~/.local/share/mime
update-desktop-database "${APPLICATIONSDIR}"
update-mime-database "${MIMEDIR}"
xdg-icon-resource forceupdate --mode user

echo "installed fritzing system icons"
5 changes: 4 additions & 1 deletion phoenix.pro
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ unix {
desktop.path = $$DATADIR/applications
desktop.files += fritzing.desktop

mimedb.path = $$DATADIR/mime/packages
mimedb.files += resources/system_icons/linux/fritzing.xml

manpage.path = $$DATADIR/man/man1
manpage.files += Fritzing.1

Expand All @@ -139,7 +142,7 @@ unix {
syntax.path = $$PKGDATADIR/translations/syntax
syntax.files += translations/syntax/*.xml

INSTALLS += target desktop manpage icon parts sketches bins translations syntax help
INSTALLS += target desktop mimedb manpage icon parts sketches bins translations syntax help
}

ICON = resources/system_icons/macosx/fritzing_icon.icns
Expand Down
31 changes: 31 additions & 0 deletions resources/system_icons/linux/fritzing.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-fritzing-fzb">
<comment>Fritzing Parts Bin</comment>
<glob pattern="*.fzb"/>
</mime-type>
<mime-type type="application/x-fritzing-fzbz">
<comment>Fritzing Parts Bin Bundle</comment>
<glob pattern="*.fzbz"/>
</mime-type>
<mime-type type="application/x-fritzing-fzm">
<comment>Fritzing Module</comment>
<glob pattern="*.fzm"/>
</mime-type>
<mime-type type="application/x-fritzing-fzp">
<comment>Fritzing Part Definition</comment>
<glob pattern="*.fzp"/>
</mime-type>
<mime-type type="application/x-fritzing-fzpz">
<comment>Fritzing Part Bundle</comment>
<glob pattern="*.fzpz"/>
</mime-type>
<mime-type type="application/x-fritzing-fz">
<comment>Fritzing Sketch</comment>
<glob pattern="*.fz"/>
</mime-type>
<mime-type type="application/x-fritzing-fzz">
<comment>Fritzing Sketch Bundle</comment>
<glob pattern="*.fzz"/>
</mime-type>
</mime-info>
8 changes: 0 additions & 8 deletions resources/system_icons/linux/x-fritzing-fz.xml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/system_icons/linux/x-fritzing-fzb.xml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/system_icons/linux/x-fritzing-fzbz.xml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/system_icons/linux/x-fritzing-fzm.xml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/system_icons/linux/x-fritzing-fzp.xml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/system_icons/linux/x-fritzing-fzpz.xml

This file was deleted.

8 changes: 0 additions & 8 deletions resources/system_icons/linux/x-fritzing-fzz.xml

This file was deleted.