3
# Copyright 2010 David D Lowe <daviddlowe.flimm@gmail.com>
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU Library General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
# ooo-thumbnailer-config
20
# Configure the thumbnailers for OpenOffice.org and Microsoft Office
24
# ooo-thumbnailer-config TYPE TIMEOUT UNOCONV_MAX_SIZE
27
# TYPE one of: all, ooo or microsoft
28
# TIMEOUT how many seconds allowed before timing out (-1 to
30
# UNOCONV_MAX_SIZE Microsoft Office files bigger than this size in
31
# bytes will not be converted with unoconv (-1 to
36
# Configure the thumbnailer for Microsoft Office files to use
37
# ooo-thumbnailer with a timeout of 3 seconds and a maximum size of 4MB
40
# ooo-thumbnailer-config microsoft 3 4000000
45
# command line parameters
50
if [ "${TYPE,,}" != ooo -a "$MAXSIZE" == "" ] || [ "$TIMEOUT" == "" ]; then
51
echo "Some arguments are missing" 1>&2
52
echo "Usage: ooo-thumbnailer-config TYPE TIMEOUT UNOCONV_MAX_SIZE" 1>&2
56
if [ "${TYPE,,}" -ne "all" ] && [ "${TYPE,,}" -ne "ooo" ] && [ "${TYPE,,}" -ne "microsoft" ]
58
echo "TYPE is not one of: all, ooo or microsoft" 1>&2
62
microsoft=( vnd.ms-powerpoint
63
vnd.openxmlformats-officedocument.presentationml.presentation
65
vnd.openxmlformats-officedocument.spreadsheetml.sheet
67
vnd.openxmlformats-officedocument.wordprocessingml.document
69
ooo=( vnd.oasis.opendocument.presentation-template
70
vnd.oasis.opendocument.presentation
71
vnd.oasis.opendocument.spreadsheet-template
72
vnd.oasis.opendocument.spreadsheet
73
vnd.oasis.opendocument.text-template
74
vnd.oasis.opendocument.text-master
75
vnd.oasis.opendocument.text
76
vnd.oasis.opendocument.graphics-template
77
vnd.oasis.opendocument.graphics
78
vnd.oasis.opendocument.chart
79
vnd.oasis.opendocument.image
80
vnd.oasis.opendocument.formula
81
vnd.sun.xml.impress.template
83
vnd.sun.xml.calc.template
85
vnd.sun.xml.writer.global
86
vnd.sun.xml.writer.template
88
vnd.sun.xml.draw.template
93
if [ "${TYPE,,}" == "ooo" ] || [ "${TYPE,,}" == "all" ]; then
96
gconftool-2 -s /desktop/gnome/thumbnailers/application@$i/enable --type bool true
98
if [ "$TIMEOUT" -gt 0 ]; then
99
command="timeout $TIMEOUT "
101
command="${command}ooo-thumbnailer %i %o %s"
102
gconftool-2 -s /desktop/gnome/thumbnailers/application@$i/command --type string "$command"
106
if [ "${TYPE,,}" == "microsoft" ] || [ "${TYPE,,}" == "all" ]; then
107
for i in "${microsoft[@]}"
109
gconftool-2 -s /desktop/gnome/thumbnailers/application@$i/enable --type bool true
111
if [ "$TIMEOUT" -gt 0 ]; then
112
command="timeout $TIMEOUT "
114
command="${command}ooo-thumbnailer"
115
if [ "$MAXSIZE" -gt 0 ]; then
116
command="$command -m $MAXSIZE"
118
command="$command %i %o %s"
119
gconftool-2 -s /desktop/gnome/thumbnailers/application@$i/command --type string "$command"