Cherrypick from master 2004-02-17 08:53:12 UTC twb 'enable building with automake 1.8.x':
m4/Makefile.am
m4/README
m4/aclocal-include.m4
m4/aspell.m4
m4/check-type.m4
m4/gnupg-check-typedef.m4
m4/missing/gdk-pixbuf.m4
m4/missing/gettext.m4
m4/missing/gpgme.m4
m4/missing/imlib.m4
m4/openssl.m4
m4/spamassassin.m4
src/folderutils.c
src/folderutils.h
src/pixmaps/linewrapcurrent.xpm
src/prefs_ext_prog.c
src/prefs_themes.c
tools/textviewer.sh
--- /dev/null
+MACROS = \
+ aclocal-include.m4 \
+ check-type.m4 \
+ gnupg-check-typedef.m4 \
+ aspell.m4 \
+ openssl.m4 \
+ spamassassin.m4
+
+EXTRA_DIST = $(MACROS) \
+ missing/gdk-pixbuf.m4 \
+ missing/gettext.m4 \
+ missing/gpgme.m4 \
+ missing/imlib.m4
--- /dev/null
+If you encountered errors like:
+
+ aclocal: configure.in: ??: macro `AM_SOMETHING' not found in library
+
+when executing autogen.sh, copy the corresponding m4 files in the missing/
+directory into here (or install the development packages).
--- /dev/null
+# aclocal-include.m4
+#
+# This macro adds the name macrodir to the set of directories
+# that `aclocal' searches for macros.
+
+dnl SYLPHEED_ACLOCAL_INCLUDE(macrodir)
+AC_DEFUN([SYLPHEED_ACLOCAL_INCLUDE],
+[
+ test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
+
+ for k in $1 ; do ACLOCAL="$ACLOCAL -I $k" ; done
+])
--- /dev/null
+dnl Autoconf macros for libaspell
+dnl $Id$
+
+# Configure paths for ASPELL
+# Shamelessly stolen from the one of GPGME by Werner Koch
+# Melvin Hadasht 2001-09-17, 2002
+
+dnl AM_PATH_ASPELL([MINIMUM-VERSION,
+dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+dnl Test for aspell, and define ASPELL_CFLAGS, ASPELL_LIBS and ASPELL_PATH
+dnl
+AC_DEFUN([AM_PATH_ASPELL],
+[dnl
+dnl Get the cflags and libraries from the aspell-config script
+dnl
+ AC_ARG_WITH(aspell-prefix,
+ [ --with-aspell-prefix=PFX Prefix where aspell is installed (optional)],
+ aspell_prefix="$withval", aspell_prefix="")
+ AC_ARG_ENABLE(aspell-test,
+ [ --disable-aspell-test Do not try to compile and run a test GNU/aspell program],
+ , enable_aspelltest=yes)
+ AC_ARG_WITH(aspell-libs,
+ [ --with-aspell-libs=LIBS Where GNU/aspell library reside (/usr/local/lib)],
+ aspell_libs="$withval", aspell_libs="")
+ AC_ARG_WITH(aspell-includes,
+ [ --with-aspell-includes=INCLUDES Where GNU/aspell headers reside (/usr/local/include)],
+ aspell_includes="$withval", aspell_includes="")
+
+ if test x$aspell_prefix != x ; then
+ if test x${ASPELL+set} != xset ; then
+ ASPELL=$aspell_prefix/bin/aspell
+ fi
+ if test x$aspell_includes = x ; then
+ aspell_includes=$aspell_prefix/include
+ fi
+ if test x$aspell_libs = x ; then
+ aspell_libs=$aspell_prefix/lib
+ fi
+ aspell_path=$aspell_prefix/lib/aspell
+ fi
+ if test x$aspell_includes = x ; then
+ aspell_includes=/usr/local/include
+ fi
+ if test x$aspell_libs = x ; then
+ aspell_libs=/usr/local/lib
+ fi
+ if test x$aspell_path = x ; then
+ aspell_path=/usr/local/lib/aspell
+ fi
+ if test "x$enable_aspelltest" != "xyes" ; then
+ echo "*** Disabling GNU/aspell tests upon user request"
+ ASPELL_CFLAGS="-I$aspell_includes"
+ ASPELL_LIBS="-L$aspell_libs -laspell"
+ AC_DEFINE_UNQUOTED(ASPELL_PATH, "${aspell_path}/", Define ASPELL's default directory)
+ ifelse([$2], , :, [$2])
+ else
+ AC_PATH_PROG(ASPELL, aspell, no)
+ min_aspell_version=ifelse([$1], ,.50,$1)
+ AC_MSG_CHECKING(for GNU/aspell - version >= $min_aspell_version)
+ no_aspell=""
+ if test "$ASPELL" = "no" ; then
+ echo "*** The aspell executable could not be found"
+ echo "*** If aspell was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the ASPELL environment variable to the"
+ echo "*** full path to aspell or configure with --with-aspell-prefix=PREFIX."
+ ASPELL_CFLAGS=""
+ ASPELL_LIBS=""
+ ASPELL_PATH=""
+ no_aspell=yes
+ ifelse([$3], , :, [$3])
+ else
+ ASPELL_CFLAGS="-I$aspell_includes"
+ ASPELL_LIBS="-L$aspell_libs -laspell"
+ aspell_version=`$ASPELL version|sed -e "s/\(@(#) International Ispell Version 3.1.20 (but really Aspell \)\(.*\))/\2/"`
+ rm -f conf.aspelltest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int
+main ()
+{
+ system ("touch conf.aspelltest");
+ if(strcmp("$aspell_version","$min_aspell_version")<0){
+ return 1;
+ }
+ return 0;
+}
+ ],, no_aspell=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ rm -f conf.aspelltest
+ if test "x$no_aspell" = x ; then
+ AC_MSG_RESULT(yes)
+ AC_MSG_CHECKING(for GNU/aspell dictionaries location)
+ aspell_path="`$ASPELL config dict-dir`"
+ AC_DEFINE_UNQUOTED(ASPELL_PATH, "${aspell_path}/", Define ASPELL's default directory)
+ AC_MSG_RESULT($aspell_path)
+ AC_MSG_CHECKING(if GNU/aspell is correctly installed)
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $ASPELL_CFLAGS"
+ LIBS="$LIBS $ASPELL_LIBS"
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <aspell.h>
+
+int
+main()
+{
+ AspellConfig * aspellconfig = new_aspell_config();
+ return 0;
+}
+ ],, aspell_failure=yes,)
+ rm -f conftest.c
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ if test "x$aspell_failure" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ echo "*** The GNU/aspell test program did not succeed. This usually means that "
+ echo "*** the headers and the libraries could not be found. Check config.log"
+ echo "*** for detailed error message and add the relevant options"
+ echo "*** --with-aspell-prefix, --with-aspell-includes or --with-aspell-libs"
+ echo "*** to the configure command."
+ echo "*** This can also mean that the library was not found at runtime. In that case"
+ echo "*** add its path to LD_LIBRARY_PATH environment variable or in /etc/ld.so.conf"
+ ASPELL_CFLAGS=""
+ ASPELL_LIBS=""
+ ASPELL_PATH=""
+ ifelse([$3], , :, [$3])
+ fi
+ else
+ AC_MSG_RESULT(no)
+ ASPELL_CFLAGS=""
+ ASPELL_LIBS=""
+ ASPELL_PATH=""
+ ifelse([$3], , :, [$3])
+ fi
+ fi
+ fi
+ AC_SUBST(ASPELL_CFLAGS)
+ AC_SUBST(ASPELL_LIBS)
+ AC_SUBST(ASPELL_PATH)
+])
+
--- /dev/null
+dnl SYLPHEED_CHECK_TYPE(TYPE, DEFAULT [, INCLUDES, COMMENT])
+dnl
+dnl Like AC_CHECK_TYPE, but in addition to `sys/types.h', `stdlib.h' and
+dnl `stddef.h' checks files included by INCLUDES, which should be a
+dnl series of #include statements. If TYPE is not defined, define it
+dnl to DEFAULT.
+dnl
+AC_DEFUN([SYLPHEED_CHECK_TYPE],
+[AC_REQUIRE([AC_HEADER_STDC])dnl
+AC_MSG_CHECKING(for $1)
+AC_CACHE_VAL(sylpheed_cv_type_$1,
+[AC_TRY_COMPILE([
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+$3
+], [
+#undef $1
+int a = sizeof($1);
+], sylpheed_cv_type_$1=yes, sylpheed_cv_type_$1=no)])dnl
+AC_MSG_RESULT($sylpheed_cv_type_$1)
+if test $sylpheed_cv_type_$1 = no; then
+ AC_DEFINE($1, $2, $4)
+fi
+])
--- /dev/null
+dnl GNUPG_CHECK_TYPEDEF(TYPE, HAVE_NAME [, COMMENT])
+dnl Check whether a typedef exists and create a #define $2 if it exists
+dnl
+AC_DEFUN([GNUPG_CHECK_TYPEDEF],
+ [ AC_MSG_CHECKING(for $1 typedef)
+ AC_CACHE_VAL(gnupg_cv_typedef_$1,
+ [AC_TRY_COMPILE([#include <stdlib.h>
+ #include <sys/types.h>], [
+ #undef $1
+ int a = sizeof($1);
+ ], gnupg_cv_typedef_$1=yes, gnupg_cv_typedef_$1=no )])
+ AC_MSG_RESULT($gnupg_cv_typedef_$1)
+ if test "$gnupg_cv_typedef_$1" = yes; then
+ AC_DEFINE($2, 1, $3)
+ fi
+ ])
+
--- /dev/null
+# Configure paths for gdk-pixbuf
+# Elliot Lee 2000-01-10
+# stolen from Raph Levien 98-11-18
+# stolen from Manish Singh 98-9-30
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_GDK_PIXBUF([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for GDK_PIXBUF, and define GDK_PIXBUF_CFLAGS and GDK_PIXBUF_LIBS
+dnl
+AC_DEFUN([AM_PATH_GDK_PIXBUF],
+[dnl
+dnl Get the cflags and libraries from the gdk-pixbuf-config script
+dnl
+AC_ARG_WITH(gdk-pixbuf-prefix,[ --with-gdk-pixbuf-prefix=PFX Prefix where GDK_PIXBUF is installed (optional)],
+ gdk_pixbuf_prefix="$withval", gdk_pixbuf_prefix="")
+AC_ARG_WITH(gdk-pixbuf-exec-prefix,[ --with-gdk-pixbuf-exec-prefix=PFX Exec prefix where GDK_PIXBUF is installed (optional)],
+ gdk_pixbuf_exec_prefix="$withval", gdk_pixbuf_exec_prefix="")
+AC_ARG_ENABLE(gdk_pixbuftest, [ --disable-gdk_pixbuftest Do not try to compile and run a test GDK_PIXBUF program],
+ , enable_gdk_pixbuftest=yes)
+
+ if test x$gdk_pixbuf_exec_prefix != x ; then
+ gdk_pixbuf_args="$gdk_pixbuf_args --exec-prefix=$gdk_pixbuf_exec_prefix"
+ if test x${GDK_PIXBUF_CONFIG+set} = xset ; then
+ GDK_PIXBUF_CONFIG=$gdk_pixbuf_exec_prefix/gdk-pixbuf-config
+ fi
+ fi
+ if test x$gdk_pixbuf_prefix != x ; then
+ gdk_pixbuf_args="$gdk_pixbuf_args --prefix=$gdk_pixbuf_prefix"
+ if test x${GDK_PIXBUF_CONFIG+set} = xset ; then
+ GDK_PIXBUF_CONFIG=$gdk_pixbuf_prefix/bin/gdk-pixbuf-config
+ fi
+ fi
+
+ AC_PATH_PROG(GDK_PIXBUF_CONFIG, gdk-pixbuf-config, no)
+ min_gdk_pixbuf_version=ifelse([$1], ,0.2.5,$1)
+ AC_MSG_CHECKING(for GDK_PIXBUF - version >= $min_gdk_pixbuf_version)
+ no_gdk_pixbuf=""
+ if test "$GDK_PIXBUF_CONFIG" = "no" ; then
+ no_gdk_pixbuf=yes
+ else
+ GDK_PIXBUF_CFLAGS=`$GDK_PIXBUF_CONFIG $gdk_pixbufconf_args --cflags`
+ GDK_PIXBUF_LIBS=`$GDK_PIXBUF_CONFIG $gdk_pixbufconf_args --libs`
+
+ gdk_pixbuf_major_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ gdk_pixbuf_minor_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ gdk_pixbuf_micro_version=`$GDK_PIXBUF_CONFIG $gdk_pixbuf_config_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_gdk_pixbuftest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS"
+ LIBS="$LIBS $GDK_PIXBUF_LIBS"
+dnl
+dnl Now check if the installed GDK_PIXBUF is sufficiently new. (Also sanity
+dnl checks the results of gdk-pixbuf-config to some extent
+dnl
+ rm -f conf.gdk_pixbuftest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+char*
+my_strdup (char *str)
+{
+ char *new_str;
+
+ if (str)
+ {
+ new_str = malloc ((strlen (str) + 1) * sizeof(char));
+ strcpy (new_str, str);
+ }
+ else
+ new_str = NULL;
+
+ return new_str;
+}
+
+int main ()
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ system ("touch conf.gdk_pixbuftest");
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = my_strdup("$min_gdk_pixbuf_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
+ printf("%s, bad version string\n", "$min_gdk_pixbuf_version");
+ exit(1);
+ }
+
+ if (($gdk_pixbuf_major_version > major) ||
+ (($gdk_pixbuf_major_version == major) && ($gdk_pixbuf_minor_version > minor)) ||
+ (($gdk_pixbuf_major_version == major) && ($gdk_pixbuf_minor_version == minor) && ($gdk_pixbuf_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** 'gdk-pixbuf-config --version' returned %d.%d.%d, but the minimum version\n", $gdk_pixbuf_major_version, $gdk_pixbuf_minor_version, $gdk_pixbuf_micro_version);
+ printf("*** of GDK_PIXBUF required is %d.%d.%d. If gdk-pixbuf-config is correct, then it is\n", major, minor, micro);
+ printf("*** best to upgrade to the required version.\n");
+ printf("*** If gdk-pixbuf-config was wrong, set the environment variable GDK_PIXBUF_CONFIG\n");
+ printf("*** to point to the correct copy of gdk-pixbuf-config, and remove the file\n");
+ printf("*** config.cache before re-running configure\n");
+ return 1;
+ }
+}
+
+],, no_gdk_pixbuf=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_gdk_pixbuf" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$GDK_PIXBUF_CONFIG" = "no" ; then
+ echo "*** The gdk-pixbuf-config script installed by GDK_PIXBUF could not be found"
+ echo "*** If GDK_PIXBUF was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the GDK_PIXBUF_CONFIG environment variable to the"
+ echo "*** full path to gdk-pixbuf-config."
+ else
+ if test -f conf.gdk_pixbuftest ; then
+ :
+ else
+ echo "*** Could not run GDK_PIXBUF test program, checking why..."
+ CFLAGS="$CFLAGS $GDK_PIXBUF_CFLAGS"
+ LIBS="$LIBS $GDK_PIXBUF_LIBS"
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+], [ return 0; ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding GDK_PIXBUF or finding the wrong"
+ echo "*** version of GDK_PIXBUF. If it is not finding GDK_PIXBUF, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means GDK_PIXBUF was incorrectly installed"
+ echo "*** or that you have moved GDK_PIXBUF since it was installed. In the latter case, you"
+ echo "*** may want to edit the gdk-pixbuf-config script: $GDK_PIXBUF_CONFIG" ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GDK_PIXBUF_CFLAGS=""
+ GDK_PIXBUF_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GDK_PIXBUF_CFLAGS)
+ AC_SUBST(GDK_PIXBUF_LIBS)
+ rm -f conf.gdk_pixbuftest
+])
--- /dev/null
+# gettext.m4 serial 20 (gettext-0.12)
+dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+dnl
+dnl This file can can be used in projects which are not available under
+dnl the GNU General Public License or the GNU Library General Public
+dnl License but which still want to provide support for the GNU gettext
+dnl functionality.
+dnl Please note that the actual code of the GNU gettext library is covered
+dnl by the GNU Library General Public License, and the rest of the GNU
+dnl gettext package package is covered by the GNU General Public License.
+dnl They are *not* in the public domain.
+
+dnl Authors:
+dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
+
+dnl Macro to add for using GNU gettext.
+
+dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
+dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
+dnl default (if it is not specified or empty) is 'no-libtool'.
+dnl INTLSYMBOL should be 'external' for packages with no intl directory,
+dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
+dnl If INTLSYMBOL is 'use-libtool', then a libtool library
+dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
+dnl depending on --{enable,disable}-{shared,static} and on the presence of
+dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
+dnl $(top_builddir)/intl/libintl.a will be created.
+dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
+dnl implementations (in libc or libintl) without the ngettext() function
+dnl will be ignored. If NEEDSYMBOL is specified and is
+dnl 'need-formatstring-macros', then GNU gettext implementations that don't
+dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
+dnl INTLDIR is used to find the intl libraries. If empty,
+dnl the value `$(top_builddir)/intl/' is used.
+dnl
+dnl The result of the configuration is one of three cases:
+dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
+dnl and used.
+dnl Catalog format: GNU --> install in $(datadir)
+dnl Catalog extension: .mo after installation, .gmo in source tree
+dnl 2) GNU gettext has been found in the system's C library.
+dnl Catalog format: GNU --> install in $(datadir)
+dnl Catalog extension: .mo after installation, .gmo in source tree
+dnl 3) No internationalization, always use English msgid.
+dnl Catalog format: none
+dnl Catalog extension: none
+dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
+dnl The use of .gmo is historical (it was needed to avoid overwriting the
+dnl GNU format catalogs when building on a platform with an X/Open gettext),
+dnl but we keep it in order not to force irrelevant filename changes on the
+dnl maintainers.
+dnl
+AC_DEFUN([AM_GNU_GETTEXT],
+[
+ dnl Argument checking.
+ ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
+ [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
+])])])])])
+ ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
+ [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
+])])])])
+ define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
+ define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
+
+ AC_REQUIRE([AM_PO_SUBDIRS])dnl
+ ifelse(gt_included_intl, yes, [
+ AC_REQUIRE([AM_INTL_SUBDIR])dnl
+ ])
+
+ dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+ AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+ AC_REQUIRE([AC_LIB_RPATH])
+
+ dnl Sometimes libintl requires libiconv, so first search for libiconv.
+ dnl Ideally we would do this search only after the
+ dnl if test "$USE_NLS" = "yes"; then
+ dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+ dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
+ dnl the configure script would need to contain the same shell code
+ dnl again, outside any 'if'. There are two solutions:
+ dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
+ dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
+ dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
+ dnl documented, we avoid it.
+ ifelse(gt_included_intl, yes, , [
+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+ ])
+
+ dnl Set USE_NLS.
+ AM_NLS
+
+ ifelse(gt_included_intl, yes, [
+ BUILD_INCLUDED_LIBINTL=no
+ USE_INCLUDED_LIBINTL=no
+ ])
+ LIBINTL=
+ LTLIBINTL=
+ POSUB=
+
+ dnl If we use NLS figure out what method
+ if test "$USE_NLS" = "yes"; then
+ gt_use_preinstalled_gnugettext=no
+ ifelse(gt_included_intl, yes, [
+ AC_MSG_CHECKING([whether included gettext is requested])
+ AC_ARG_WITH(included-gettext,
+ [ --with-included-gettext use the GNU gettext library included here],
+ nls_cv_force_use_gnu_gettext=$withval,
+ nls_cv_force_use_gnu_gettext=no)
+ AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+ ])
+ dnl User does not insist on using GNU NLS library. Figure out what
+ dnl to use. If GNU gettext is available we use this. Else we have
+ dnl to fall back to GNU NLS library.
+
+ dnl Add a version number to the cache macros.
+ define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
+ define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
+ define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
+
+ AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
+ [AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern int *_nl_domain_bindings;],
+ [bindtextdomain ("", "");
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
+ gt_cv_func_gnugettext_libc=yes,
+ gt_cv_func_gnugettext_libc=no)])
+
+ if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+ dnl Sometimes libintl requires libiconv, so first search for libiconv.
+ ifelse(gt_included_intl, yes, , [
+ AM_ICONV_LINK
+ ])
+ dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
+ dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
+ dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
+ dnl even if libiconv doesn't exist.
+ AC_LIB_LINKFLAGS_BODY([intl])
+ AC_CACHE_CHECK([for GNU gettext in libintl],
+ gt_cv_func_gnugettext_libintl,
+ [gt_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $INCINTL"
+ gt_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBINTL"
+ dnl Now see whether libintl exists and does not depend on libiconv.
+ AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias ();],
+ [bindtextdomain ("", "");
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
+ gt_cv_func_gnugettext_libintl=yes,
+ gt_cv_func_gnugettext_libintl=no)
+ dnl Now see whether libintl exists and depends on libiconv.
+ if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
+ LIBS="$LIBS $LIBICONV"
+ AC_TRY_LINK([#include <libintl.h>
+]ifelse([$2], [need-formatstring-macros],
+[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+#endif
+changequote(,)dnl
+typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+changequote([,])dnl
+], [])[extern int _nl_msg_cat_cntr;
+extern
+#ifdef __cplusplus
+"C"
+#endif
+const char *_nl_expand_alias ();],
+ [bindtextdomain ("", "");
+return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
+ [LIBINTL="$LIBINTL $LIBICONV"
+ LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+ gt_cv_func_gnugettext_libintl=yes
+ ])
+ fi
+ CPPFLAGS="$gt_save_CPPFLAGS"
+ LIBS="$gt_save_LIBS"])
+ fi
+
+ dnl If an already present or preinstalled GNU gettext() is found,
+ dnl use it. But if this macro is used in GNU gettext, and GNU
+ dnl gettext is already preinstalled in libintl, we update this
+ dnl libintl. (Cf. the install rule in intl/Makefile.in.)
+ if test "$gt_cv_func_gnugettext_libc" = "yes" \
+ || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
+ && test "$PACKAGE" != gettext-runtime \
+ && test "$PACKAGE" != gettext-tools; }; then
+ gt_use_preinstalled_gnugettext=yes
+ else
+ dnl Reset the values set by searching for libintl.
+ LIBINTL=
+ LTLIBINTL=
+ INCINTL=
+ fi
+
+ ifelse(gt_included_intl, yes, [
+ if test "$gt_use_preinstalled_gnugettext" != "yes"; then
+ dnl GNU gettext is not found in the C library.
+ dnl Fall back on included GNU gettext library.
+ nls_cv_use_gnu_gettext=yes
+ fi
+ fi
+
+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Mark actions used to generate GNU NLS library.
+ BUILD_INCLUDED_LIBINTL=yes
+ USE_INCLUDED_LIBINTL=yes
+ LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
+ LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
+ LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
+ fi
+
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Mark actions to use GNU gettext tools.
+ CATOBJEXT=.gmo
+ fi
+ ])
+
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+ AC_DEFINE(ENABLE_NLS, 1,
+ [Define to 1 if translation of program messages to the user's native language
+ is requested.])
+ else
+ USE_NLS=no
+ fi
+ fi
+
+ AC_MSG_CHECKING([whether to use NLS])
+ AC_MSG_RESULT([$USE_NLS])
+ if test "$USE_NLS" = "yes"; then
+ AC_MSG_CHECKING([where the gettext function comes from])
+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+ gt_source="external libintl"
+ else
+ gt_source="libc"
+ fi
+ else
+ gt_source="included intl directory"
+ fi
+ AC_MSG_RESULT([$gt_source])
+ fi
+
+ if test "$USE_NLS" = "yes"; then
+
+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+ if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
+ AC_MSG_CHECKING([how to link with libintl])
+ AC_MSG_RESULT([$LIBINTL])
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
+ fi
+
+ dnl For backward compatibility. Some packages may be using this.
+ AC_DEFINE(HAVE_GETTEXT, 1,
+ [Define if the GNU gettext() function is already present or preinstalled.])
+ AC_DEFINE(HAVE_DCGETTEXT, 1,
+ [Define if the GNU dcgettext() function is already present or preinstalled.])
+ fi
+
+ dnl We need to process the po/ directory.
+ POSUB=po
+ fi
+
+ ifelse(gt_included_intl, yes, [
+ dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
+ dnl to 'yes' because some of the testsuite requires it.
+ if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
+ BUILD_INCLUDED_LIBINTL=yes
+ fi
+
+ dnl Make all variables we use known to autoconf.
+ AC_SUBST(BUILD_INCLUDED_LIBINTL)
+ AC_SUBST(USE_INCLUDED_LIBINTL)
+ AC_SUBST(CATOBJEXT)
+
+ dnl For backward compatibility. Some configure.ins may be using this.
+ nls_cv_header_intl=
+ nls_cv_header_libgt=
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ DATADIRNAME=share
+ AC_SUBST(DATADIRNAME)
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ INSTOBJEXT=.mo
+ AC_SUBST(INSTOBJEXT)
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ GENCAT=gencat
+ AC_SUBST(GENCAT)
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ if test "$USE_INCLUDED_LIBINTL" = yes; then
+ INTLOBJS="\$(GETTOBJS)"
+ fi
+ AC_SUBST(INTLOBJS)
+
+ dnl Enable libtool support if the surrounding package wishes it.
+ INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
+ AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
+ ])
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ INTLLIBS="$LIBINTL"
+ AC_SUBST(INTLLIBS)
+
+ dnl Make all documented variables known to autoconf.
+ AC_SUBST(LIBINTL)
+ AC_SUBST(LTLIBINTL)
+ AC_SUBST(POSUB)
+])
+
+
+dnl Checks for all prerequisites of the intl subdirectory,
+dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
+dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
+AC_DEFUN([AM_INTL_SUBDIR],
+[
+ AC_REQUIRE([AC_PROG_INSTALL])dnl
+ AC_REQUIRE([AM_MKINSTALLDIRS])dnl
+ AC_REQUIRE([AC_PROG_CC])dnl
+ AC_REQUIRE([AC_CANONICAL_HOST])dnl
+ AC_REQUIRE([AC_PROG_RANLIB])dnl
+ AC_REQUIRE([AC_ISC_POSIX])dnl
+ AC_REQUIRE([AC_HEADER_STDC])dnl
+ AC_REQUIRE([AC_C_CONST])dnl
+ AC_REQUIRE([AC_C_INLINE])dnl
+ AC_REQUIRE([AC_TYPE_OFF_T])dnl
+ AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+ AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+ AC_REQUIRE([AC_FUNC_MMAP])dnl
+ AC_REQUIRE([jm_GLIBC21])dnl
+ AC_REQUIRE([gt_INTDIV0])dnl
+ AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
+ AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
+ AC_REQUIRE([gt_INTTYPES_PRI])dnl
+
+ AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
+stdlib.h string.h unistd.h sys/param.h])
+ AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
+geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
+strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
+__fsetlocking])
+
+ AM_ICONV
+ AM_LANGINFO_CODESET
+ if test $ac_cv_header_locale_h = yes; then
+ AM_LC_MESSAGES
+ fi
+
+ dnl intl/plural.c is generated from intl/plural.y. It requires bison,
+ dnl because plural.y uses bison specific features. It requires at least
+ dnl bison-1.26 because earlier versions generate a plural.c that doesn't
+ dnl compile.
+ dnl bison is only needed for the maintainer (who touches plural.y). But in
+ dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
+ dnl the rule in general Makefile. Now, some people carelessly touch the
+ dnl files or have a broken "make" program, hence the plural.c rule will
+ dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
+ dnl present or too old.
+ AC_CHECK_PROGS([INTLBISON], [bison])
+ if test -z "$INTLBISON"; then
+ ac_verc_fail=yes
+ else
+ dnl Found it, now check the version.
+ AC_MSG_CHECKING([version of bison])
+changequote(<<,>>)dnl
+ ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+ case $ac_prog_version in
+ '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+ 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
+changequote([,])dnl
+ ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+ *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+ esac
+ AC_MSG_RESULT([$ac_prog_version])
+ fi
+ if test $ac_verc_fail = yes; then
+ INTLBISON=:
+ fi
+])
+
+
+dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
+AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
--- /dev/null
+dnl Autoconf macros for libgpgme
+dnl $Id$
+
+# Configure paths for GPGME
+# Shamelessly stolen from the one of XDELTA by Owen Taylor
+# Werner Koch 2000-11-17
+
+dnl AM_PATH_GPGME([MINIMUM-VERSION,
+dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+dnl Test for gpgme, and define GPGME_CFLAGS and GPGME_LIBS
+dnl
+AC_DEFUN([AM_PATH_GPGME],
+[dnl
+dnl Get the cflags and libraries from the gpgme-config script
+dnl
+ AC_ARG_WITH(gpgme-prefix,
+ [ --with-gpgme-prefix=PFX Prefix where gpgme is installed (optional)],
+ gpgme_config_prefix="$withval", gpgme_config_prefix="")
+ AC_ARG_ENABLE(gpgmetest,
+ [ --disable-gpgmetest Do not try to compile and run a test gpgme program],
+ , enable_gpgmetest=yes)
+
+ if test x$gpgme_config_prefix != x ; then
+ gpgme_config_args="$gpgme_config_args --prefix=$gpgme_config_prefix"
+ if test x${GPGME_CONFIG+set} != xset ; then
+ GPGME_CONFIG=$gpgme_config_prefix/bin/gpgme-config
+ fi
+ fi
+
+ AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
+ min_gpgme_version=ifelse([$1], ,1.0.0,$1)
+ AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
+ no_gpgme=""
+ if test "$GPGME_CONFIG" = "no" ; then
+ no_gpgme=yes
+ else
+ GPGME_CFLAGS=`$GPGME_CONFIG $gpgme_config_args --cflags`
+ GPGME_LIBS=`$GPGME_CONFIG $gpgme_config_args --libs`
+ gpgme_config_version=`$GPGME_CONFIG $gpgme_config_args --version`
+ if test "x$enable_gpgmetest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GPGME_CFLAGS"
+ LIBS="$LIBS $GPGME_LIBS"
+dnl
+dnl Now check if the installed gpgme is sufficiently new. Also sanity
+dnl checks the results of gpgme-config to some extent
+dnl
+ rm -f conf.gpgmetest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gpgme.h>
+
+int
+main ()
+{
+ system ("touch conf.gpgmetest");
+
+ if( strcmp( gpgme_check_version(NULL), "$gpgme_config_version" ) )
+ {
+ printf("\n"
+"*** 'gpgme-config --version' returned %s, but GPGME (%s) was found!\n",
+ "$gpgme_config_version", gpgme_check_version(NULL) );
+ printf(
+"*** If gpgme-config was correct, then it is best to remove the old\n"
+"*** version of GPGME. You may also be able to fix the error\n"
+"*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"
+"*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"
+"*** required on your system.\n"
+"*** If gpgme-config was wrong, set the environment variable GPGME_CONFIG\n"
+"*** to point to the correct copy of gpgme-config, \n"
+"*** and remove the file config.cache before re-running configure\n"
+ );
+ }
+ else if ( strcmp(gpgme_check_version(NULL), GPGME_VERSION ) )
+ {
+ printf("\n*** GPGME header file (version %s) does not match\n",
+ GPGME_VERSION);
+ printf("*** library (version %s)\n", gpgme_check_version(NULL) );
+ }
+ else
+ {
+ if ( gpgme_check_version( "$min_gpgme_version" ) )
+ return 0;
+ printf("no\n"
+"*** An old version of GPGME (%s) was found.\n", gpgme_check_version(NULL) );
+ printf(
+"*** You need a version of GPGME newer than %s.\n", "$min_gpgme_version" );
+ printf(
+"*** The latest version of GPGME is always available at\n"
+"*** ftp://ftp.gnupg.org/pub/gcrypt/alpha/gpgme/\n"
+"*** \n"
+"*** If you have already installed a sufficiently new version, this error\n"
+"*** probably means that the wrong copy of the gpgme-config shell script is\n"
+"*** being found. The easiest way to fix this is to remove the old version\n"
+"*** of GPGME, but you can also set the GPGME_CONFIG environment to point to\n"
+"*** the correct copy of gpgme-config. (In this case, you will have to\n"
+"*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"
+"*** so that the correct libraries are found at run-time).\n"
+ );
+ }
+ return 1;
+}
+],, no_gpgme=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_gpgme" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ if test -f conf.gpgmetest ; then
+ :
+ else
+ AC_MSG_RESULT(no)
+ fi
+ if test "$GPGME_CONFIG" = "no" ; then
+ echo "*** The gpgme-config script installed by GPGME could not be found"
+ echo "*** If GPGME was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the GPGME_CONFIG environment variable to the"
+ echo "*** full path to gpgme-config."
+ else
+ if test -f conf.gpgmetest ; then
+ :
+ else
+ echo "*** Could not run gpgme test program, checking why..."
+ CFLAGS="$CFLAGS $GPGME_CFLAGS"
+ LIBS="$LIBS $GPGME_LIBS"
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <gpgme.h>
+], [ gpgme_check_version(NULL); return 0 ],
+ [
+echo "*** The test program compiled, but did not run. This usually means"
+echo "*** that the run-time linker is not finding GPGME or finding the wrong"
+echo "*** version of GPGME. If it is not finding GPGME, you'll need to set your"
+echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+echo "*** to the installed location Also, make sure you have run ldconfig if"
+echo "*** that is required on your system"
+echo "***"
+echo "*** If you have an old version installed, it is best to remove it,"
+echo "*** although you may also be able to get things to work by"
+echo "*** modifying LD_LIBRARY_PATH"
+echo "***"
+ ],
+ [
+echo "*** The test program failed to compile or link. See the file config.log"
+echo "*** for the exact error that occured. This usually means GPGME was"
+echo "*** incorrectly installed or that you have moved GPGME since it was"
+echo "*** installed. In the latter case, you may want to edit the"
+echo "*** gpgme-config script: $GPGME_CONFIG"
+ ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ GPGME_CFLAGS=""
+ GPGME_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GPGME_CFLAGS)
+ AC_SUBST(GPGME_LIBS)
+ rm -f conf.gpgmetest
+])
+
--- /dev/null
+# Configure paths for IMLIB
+# Frank Belew 98-8-31
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_IMLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for IMLIB, and define IMLIB_CFLAGS and IMLIB_LIBS
+dnl
+AC_DEFUN([AM_PATH_IMLIB],
+[dnl
+dnl Get the cflags and libraries from the imlib-config script
+dnl
+AC_ARG_WITH(imlib-prefix,[ --with-imlib-prefix=PFX Prefix where IMLIB is installed (optional)],
+ imlib_prefix="$withval", imlib_prefix="")
+AC_ARG_WITH(imlib-exec-prefix,[ --with-imlib-exec-prefix=PFX Exec prefix where IMLIB is installed (optional)],
+ imlib_exec_prefix="$withval", imlib_exec_prefix="")
+AC_ARG_ENABLE(imlibtest, [ --disable-imlibtest Do not try to compile and run a test IMLIB program],
+ , enable_imlibtest=yes)
+
+ if test x$imlib_exec_prefix != x ; then
+ imlib_args="$imlib_args --exec-prefix=$imlib_exec_prefix"
+ if test x${IMLIB_CONFIG+set} != xset ; then
+ IMLIB_CONFIG=$imlib_exec_prefix/bin/imlib-config
+ fi
+ fi
+ if test x$imlib_prefix != x ; then
+ imlib_args="$imlib_args --prefix=$imlib_prefix"
+ if test x${IMLIB_CONFIG+set} != xset ; then
+ IMLIB_CONFIG=$imlib_prefix/bin/imlib-config
+ fi
+ fi
+
+ AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no)
+ min_imlib_version=ifelse([$1], ,1.8.2,$1)
+ AC_MSG_CHECKING(for IMLIB - version >= $min_imlib_version)
+ no_imlib=""
+ if test "$IMLIB_CONFIG" = "no" ; then
+ no_imlib=yes
+ else
+ IMLIB_CFLAGS=`$IMLIB_CONFIG $imlibconf_args --cflags`
+ IMLIB_LIBS=`$IMLIB_CONFIG $imlibconf_args --libs`
+
+ imlib_major_version=`$IMLIB_CONFIG $imlib_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ imlib_minor_version=`$IMLIB_CONFIG $imlib_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ imlib_micro_version=`$IMLIB_CONFIG $imlib_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+ if test "x$enable_imlibtest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $IMLIB_CFLAGS"
+ LIBS="$LIBS $IMLIB_LIBS"
+dnl
+dnl Now check if the installed IMLIB is sufficiently new. (Also sanity
+dnl checks the results of imlib-config to some extent
+dnl
+ rm -f conf.imlibtest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <Imlib.h>
+
+char*
+my_strdup (char *str)
+{
+ char *new_str;
+
+ if (str)
+ {
+ new_str = malloc ((strlen (str) + 1) * sizeof(char));
+ strcpy (new_str, str);
+ }
+ else
+ new_str = NULL;
+
+ return new_str;
+}
+
+int main ()
+{
+ int major, minor, micro;
+ char *tmp_version;
+
+ system ("touch conf.imlibtest");
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = my_strdup("$min_imlib_version");
+ if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
+ printf("%s, bad version string\n", "$min_imlib_version");
+ exit(1);
+ }
+
+ if (($imlib_major_version > major) ||
+ (($imlib_major_version == major) && ($imlib_minor_version > minor)) ||
+ (($imlib_major_version == major) && ($imlib_minor_version == minor) &&
+ ($imlib_micro_version >= micro)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** 'imlib-config --version' returned %d.%d, but the minimum version\n", $imlib_major_version, $imlib_minor_version);
+ printf("*** of IMLIB required is %d.%d. If imlib-config is correct, then it is\n", major, minor);
+ printf("*** best to upgrade to the required version.\n");
+ printf("*** If imlib-config was wrong, set the environment variable IMLIB_CONFIG\n");
+ printf("*** to point to the correct copy of imlib-config, and remove the file\n");
+ printf("*** config.cache before re-running configure\n");
+ return 1;
+ }
+}
+
+],, no_imlib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_imlib" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$IMLIB_CONFIG" = "no" ; then
+ echo "*** The imlib-config script installed by IMLIB could not be found"
+ echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the IMLIB_CONFIG environment variable to the"
+ echo "*** full path to imlib-config."
+ else
+ if test -f conf.imlibtest ; then
+ :
+ else
+ echo "*** Could not run IMLIB test program, checking why..."
+ CFLAGS="$CFLAGS $IMLIB_CFLAGS"
+ LIBS="$LIBS $IMLIB_LIBS"
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <Imlib.h>
+], [ return 0; ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding IMLIB or finding the wrong"
+ echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means IMLIB was incorrectly installed"
+ echo "*** or that you have moved IMLIB since it was installed. In the latter case, you"
+ echo "*** may want to edit the imlib-config script: $IMLIB_CONFIG" ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ IMLIB_CFLAGS=""
+ IMLIB_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(IMLIB_CFLAGS)
+ AC_SUBST(IMLIB_LIBS)
+ rm -f conf.imlibtest
+])
+
+# Check for gdk-imlib
+AC_DEFUN(AM_PATH_GDK_IMLIB,
+[dnl
+dnl Get the cflags and libraries from the imlib-config script
+dnl
+AC_ARG_WITH(imlib-prefix,[ --with-imlib-prefix=PFX Prefix where IMLIB is installed (optional)],
+ imlib_prefix="$withval", imlib_prefix="")
+AC_ARG_WITH(imlib-exec-prefix,[ --with-imlib-exec-prefix=PFX Exec prefix where IMLIB is installed (optional)],
+ imlib_exec_prefix="$withval", imlib_exec_prefix="")
+AC_ARG_ENABLE(imlibtest, [ --disable-imlibtest Do not try to compile and run a test IMLIB program],
+ , enable_imlibtest=yes)
+
+ if test x$imlib_exec_prefix != x ; then
+ imlib_args="$imlib_args --exec-prefix=$imlib_exec_prefix"
+ if test x${IMLIB_CONFIG+set} != xset ; then
+ IMLIB_CONFIG=$imlib_exec_prefix/bin/imlib-config
+ fi
+ fi
+ if test x$imlib_prefix != x ; then
+ imlib_args="$imlib_args --prefix=$imlib_prefix"
+ if test x${IMLIB_CONFIG+set} != xset ; then
+ IMLIB_CONFIG=$imlib_prefix/bin/imlib-config
+ fi
+ fi
+
+ AC_PATH_PROG(IMLIB_CONFIG, imlib-config, no)
+ min_imlib_version=ifelse([$1], ,1.8.2,$1)
+ AC_MSG_CHECKING(for IMLIB - version >= $min_imlib_version)
+ no_imlib=""
+ if test "$IMLIB_CONFIG" = "no" ; then
+ no_imlib=yes
+ else
+ GDK_IMLIB_CFLAGS=`$IMLIB_CONFIG $imlibconf_args --cflags-gdk`
+ GDK_IMLIB_LIBS=`$IMLIB_CONFIG $imlibconf_args --libs-gdk`
+
+ imlib_major_version=`$IMLIB_CONFIG $imlib_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ imlib_minor_version=`$IMLIB_CONFIG $imlib_args --version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ if test "x$enable_imlibtest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS"
+ LIBS="$LIBS $GDK_IMLIB_LIBS"
+dnl
+dnl Now check if the installed IMLIB is sufficiently new. (Also sanity
+dnl checks the results of imlib-config to some extent
+dnl
+ rm -f conf.imlibtest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <gdk_imlib.h>
+
+int main ()
+{
+ int major, minor;
+ char *tmp_version;
+
+ system ("touch conf.gdkimlibtest");
+
+ /* HP/UX 9 (%@#!) writes to sscanf strings */
+ tmp_version = g_strdup("$min_imlib_version");
+ if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) {
+ printf("%s, bad version string\n", "$min_imlib_version");
+ exit(1);
+ }
+
+ if (($imlib_major_version > major) ||
+ (($imlib_major_version == major) && ($imlib_minor_version >= minor)))
+ {
+ return 0;
+ }
+ else
+ {
+ printf("\n*** 'imlib-config --version' returned %d.%d, but the minimum version\n", $imlib_major_version, $imlib_minor_version);
+ printf("*** of IMLIB required is %d.%d. If imlib-config is correct, then it is\n", major, minor);
+ printf("*** best to upgrade to the required version.\n");
+ printf("*** If imlib-config was wrong, set the environment variable IMLIB_CONFIG\n");
+ printf("*** to point to the correct copy of imlib-config, and remove the file\n");
+ printf("*** config.cache before re-running configure\n");
+ return 1;
+ }
+}
+
+],, no_imlib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ if test "x$no_imlib" = x ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$2], , :, [$2])
+ else
+ AC_MSG_RESULT(no)
+ if test "$IMLIB_CONFIG" = "no" ; then
+ echo "*** The imlib-config script installed by IMLIB could not be found"
+ echo "*** If IMLIB was installed in PREFIX, make sure PREFIX/bin is in"
+ echo "*** your path, or set the IMLIB_CONFIG environment variable to the"
+ echo "*** full path to imlib-config."
+ else
+ if test -f conf.gdkimlibtest ; then
+ :
+ else
+ echo "*** Could not run IMLIB test program, checking why..."
+ CFLAGS="$CFLAGS $GDK_IMLIB_CFLAGS"
+ LIBS="$LIBS $GDK_IMLIB_LIBS"
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <gdk_imlib.h>
+], [ return 0; ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding IMLIB or finding the wrong"
+ echo "*** version of IMLIB. If it is not finding IMLIB, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means IMLIB was incorrectly installed"
+ echo "*** or that you have moved IMLIB since it was installed. In the latter case, you"
+ echo "*** may want to edit the imlib-config script: $IMLIB_CONFIG" ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ fi
+ IMLIB_CFLAGS=""
+ IMLIB_LIBS=""
+ ifelse([$3], , :, [$3])
+ fi
+ AC_SUBST(GDK_IMLIB_CFLAGS)
+ AC_SUBST(GDK_IMLIB_LIBS)
+ rm -f conf.gdkimlibtest
+])
--- /dev/null
+dnl ******************************
+dnl OpenSSL
+dnl ******************************
+
+AC_DEFUN([AM_PATH_OPENSSL],
+[dnl
+ USE_OPENSSL=0
+
+ AC_ARG_ENABLE(openssl, [ --enable-openssl Attempt to use OpenSSL for SSL support.],
+ [ac_cv_enable_openssl=$enableval], [ac_cv_enable_openssl=no])
+
+ dnl detect OpenSSL
+ if test "x${ac_cv_enable_openssl}" != "xno"; then
+ AC_ARG_WITH(openssl-includes, [ --with-openssl-includes=PREFIX Location of OpenSSL includes.],
+ with_openssl_includes="$withval", with_openssl_includes="/usr/include")
+ have_openssl_includes="no"
+ if test "x${with_openssl_includes}" != "xno"; then
+ CPPFLAGS_save="$CPPFLAGS"
+
+ AC_MSG_CHECKING(for OpenSSL includes)
+ AC_MSG_RESULT("")
+
+ CPPFLAGS="$CPPFLAGS -I$with_openssl_includes"
+ AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h, [ openssl_includes="yes" ])
+ CPPFLAGS="$CPPFLAGS_save"
+
+ if test "x{$openssl_includes}" != "xno" -a "x{$openssl_includes}" != "x"; then
+ have_openssl_includes="yes"
+ OPENSSL_CFLAGS="-I$with_openssl_includes"
+ else
+ OPENSSL_CFLAGS=""
+ fi
+ else
+ AC_MSG_CHECKING(for OpenSSL includes)
+ AC_MSG_RESULT(no)
+ fi
+
+ AC_ARG_WITH(openssl-libs, [ --with-openssl-libs=PREFIX Location of OpenSSL libs.],
+ with_openssl_libs="$withval")
+ if test "x${with_openssl_libs}" != "xno" -a "x${have_openssl_includes}" != "xno"; then
+ case $with_openssl_libs in
+ ""|-L*) ;;
+ *) with_openssl_libs="-L$with_openssl_libs" ;;
+ esac
+
+ AC_CHECK_LIB(dl, dlopen, DL_LIBS="-ldl", DL_LIBS="")
+ AC_CACHE_CHECK([for OpenSSL libraries], openssl_libs,
+ [
+ LIBS_save="$LIBS"
+ LIBS="$LIBS $with_openssl_libs -lssl -lcrypto $DL_LIBS"
+ AC_TRY_LINK_FUNC(SSL_read, openssl_libs="yes", openssl_libs="no")
+ LIBS="$LIBS_save"
+ ])
+ if test "x${openssl_libs}" != "xno"; then
+ AC_DEFINE(USE_OPENSSL, 1, [Define if you use OpenSSL to support SSL])
+ USE_OPENSSL=1
+ msg_ssl="yes (OpenSSL)"
+ OPENSSL_LIBS="$with_openssl_libs -lssl -lcrypto $DL_LIBS"
+ else
+ OPENSSL_CFLAGS=""
+ OPENSSL_LIBS=""
+ fi
+ else
+ AC_MSG_CHECKING(for OpenSSL libraries)
+ AC_MSG_RESULT(no)
+ fi
+ else
+ OPENSSL_CFLAGS=""
+ OPENSSL_LIBS=""
+ ac_cv_enable_openssl="no"
+ fi
+
+ AC_SUBST(OPENSSL_CFLAGS)
+ AC_SUBST(OPENSSL_LIBS)
+])
\ No newline at end of file
--- /dev/null
+dnl check for libspamc required includes
+
+AC_DEFUN([AC_SPAMASSASSIN],
+[dnl
+
+AC_CHECK_HEADERS(sys/time.h syslog.h unistd.h errno.h sys/errno.h)
+AC_CHECK_HEADERS(time.h sysexits.h sys/socket.h netdb.h netinet/in.h)
+AC_CHECK_HEADERS(openssl/crypto.h)
+
+AC_CACHE_CHECK([for SHUT_RD],
+ shutrd, [
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/socket.h>],
+ [printf ("%d", SHUT_RD); return 0;],
+ [shutrd=yes],
+ [shutrd=no]),
+ ])
+if test $shutrd = yes ; then
+ AC_DEFINE(HAVE_SHUT_RD, 1, HAVE_SHUT_RD)
+fi
+
+dnl ----------------------------------------------------------------------
+
+AC_CHECK_FUNCS(socket strdup strtod strtol snprintf shutdown)
+
+dnl ----------------------------------------------------------------------
+
+AC_CACHE_CHECK([for h_errno],
+ herrno, [
+ AC_TRY_COMPILE([#include <netdb.h>],
+ [printf ("%d", h_errno); return 0;],
+ [herrno=yes],
+ [herrno=no]),
+ ])
+if test $herrno = yes ; then
+ AC_DEFINE(HAVE_H_ERRNO, 1, HAVE_H_ERRNO)
+fi
+
+dnl ----------------------------------------------------------------------
+
+dnl ----------------------------------------------------------------------
+
+AC_CACHE_CHECK([for in_addr_t],
+ inaddrt, [
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <netinet/in.h>],
+ [in_addr_t foo; return 0;],
+ [inaddrt=yes],
+ [inaddrt=no]),
+ ])
+if test $inaddrt = no ; then
+ AC_CHECK_TYPE(in_addr_t, unsigned long)
+fi
+
+dnl ----------------------------------------------------------------------
+
+AC_CACHE_CHECK([for INADDR_NONE],
+ haveinaddrnone, [
+ AC_TRY_COMPILE([#include <sys/types.h>
+#include <netinet/in.h>],
+ [in_addr_t foo = INADDR_NONE; return 0;],
+ [haveinaddrnone=yes],
+ [haveinaddrnone=no]),
+ ])
+if test $haveinaddrnone = yes ; then
+ AC_DEFINE(HAVE_INADDR_NONE, 1, HAVE_INADDR_NONE)
+fi
+
+dnl ----------------------------------------------------------------------
+
+AC_CACHE_CHECK([for EX__MAX],
+ haveexmax, [
+ AC_TRY_COMPILE([#ifdef HAVE_SYSEXITS_H
+#include <sysexits.h>
+#endif
+#include <errno.h>],
+ [int foo = EX__MAX; return 0;],
+ [haveexmax=yes],
+ [haveexmax=no]),
+ ])
+if test $haveexmax = yes ; then
+ AC_DEFINE(HAVE_EX__MAX, 1, HAVE_EX__MAX)
+fi
+
+if test "$USE_OPENSSL" -ne 0; then
+ AC_DEFINE(SPAMC_SSL, 1, Compile libspamc with OpenSSL support)
+fi
+
+])
\ No newline at end of file
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2004 Hiroyuki Yamamoto & The Sylpheed-Claws Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+
+#include "utils.h"
+#include "prefs_common.h"
+#include "folderutils.h"
+
+void folderutils_delete_duplicates(FolderItem *item)
+{
+ GHashTable *table;
+ GSList *msglist, *cur, *duplist = NULL;
+
+ debug_print("Deleting duplicated messages...\n");
+
+ msglist = folder_item_get_msg_list(item);
+ if (msglist == NULL)
+ return;
+ table = g_hash_table_new(g_str_hash, g_str_equal);
+
+ for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
+ MsgInfo *msginfo = (MsgInfo *) cur->data;
+ MsgInfo *msginfo_dup = NULL;
+
+ if (!msginfo || !msginfo->msgid || !*msginfo->msgid)
+ continue;
+
+ msginfo_dup = g_hash_table_lookup(table, msginfo->msgid);
+ if (msginfo_dup == NULL)
+ g_hash_table_insert(table, msginfo->msgid, msginfo);
+ else {
+ if ((MSG_IS_UNREAD(msginfo->flags) && !MSG_IS_UNREAD(msginfo_dup->flags)) ||
+ (MSG_IS_UNREAD(msginfo->flags) == MSG_IS_UNREAD(msginfo_dup->flags))) {
+ duplist = g_slist_append(duplist, msginfo);
+ } else {
+ duplist = g_slist_append(duplist, msginfo_dup);
+ g_hash_table_insert(table, msginfo->msgid, msginfo);
+ }
+ }
+ }
+
+ if (duplist) {
+ if (prefs_common.immediate_exec) {
+ FolderItem *trash = item->folder->trash;
+
+ if (item->stype == F_TRASH || trash == NULL)
+ folder_item_remove_msgs(item, duplist);
+ else
+ folder_item_move_msgs(trash, duplist);
+ } else {
+ for (cur = duplist; cur != NULL; cur = g_slist_next(cur)) {
+ MsgInfo *msginfo = (MsgInfo *) cur->data;
+
+ procmsg_msginfo_set_to_folder(msginfo, NULL);
+ procmsg_msginfo_unset_flags(msginfo, MSG_MARKED, MSG_MOVE | MSG_COPY);
+ procmsg_msginfo_set_flags(msginfo, MSG_DELETED, 0);
+ }
+ }
+ }
+ g_slist_free(duplist);
+
+ g_hash_table_destroy(table);
+
+ for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
+ MsgInfo *msginfo = (MsgInfo *) cur->data;
+
+ procmsg_msginfo_free(msginfo);
+ }
+ g_slist_free(msglist);
+
+
+ debug_print("done.\n");
+}
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2004 Hiroyuki Yamamoto & The Sylpheed-Claws Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef FOLDERUTILS_H
+#define FOLDERUTILS_H 1
+
+#include "folder.h"
+
+void folderutils_delete_duplicates(FolderItem *item);
+
+#endif /* FOLDERUTILS_H */
--- /dev/null
+/* XPM */
+static char * linewrapcurrent_xpm[] = {
+"24 24 2 1",
+" c None",
+". c #000000",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" ................. ",
+" ",
+" ................. ",
+" ",
+" ............. ",
+" ",
+" ..... ",
+" ",
+" ............ . ",
+" . . ",
+" ............ .... ",
+" . ",
+" ..... ",
+" ",
+" ",
+" ",
+" ",
+" "};
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2004 Hiroyuki Yamamoto & the Sylpheed-Claws team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "defs.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "intl.h"
+#include "utils.h"
+#include "prefs_common.h"
+#include "prefs_gtk.h"
+
+#include "gtk/gtkutils.h"
+#include "gtk/prefswindow.h"
+
+#include "manage_window.h"
+
+typedef struct _ExtProgPage
+{
+ PrefsPage page;
+
+ GtkWidget *window; /* do not modify */
+
+ GtkWidget *uri_label;
+ GtkWidget *uri_combo;
+ GtkWidget *uri_entry;
+
+ GtkWidget *printcmd_label;
+ GtkWidget *printcmd_entry;
+
+ GtkWidget *exteditor_label;
+ GtkWidget *exteditor_combo;
+ GtkWidget *exteditor_entry;
+
+ GtkWidget *image_viewer_label;
+ GtkWidget *image_viewer_entry;
+
+ GtkWidget *audio_player_label;
+ GtkWidget *audio_player_entry;
+} ExtProgPage;
+
+void prefs_ext_prog_create_widget(PrefsPage *_page, GtkWindow *window,
+ gpointer data)
+{
+ ExtProgPage *prefs_ext_prog = (ExtProgPage *) _page;
+
+ GtkWidget *table;
+ GtkWidget *vbox;
+ GtkWidget *hint_label;
+ GtkWidget *table2;
+ GtkWidget *uri_label;
+ GtkWidget *uri_combo;
+ GtkWidget *uri_entry;
+ GtkWidget *printcmd_label;
+ GtkWidget *printcmd_entry;
+ GtkWidget *exteditor_label;
+ GtkWidget *exteditor_combo;
+ GtkWidget *exteditor_entry;
+ GtkWidget *image_viewer_label;
+ GtkWidget *image_viewer_entry;
+ GtkWidget *audio_player_label;
+ GtkWidget *audio_player_entry;
+
+ table = gtk_table_new(2, 1, FALSE);
+ gtk_widget_show(table);
+ gtk_container_set_border_width(GTK_CONTAINER(table), 8);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 4);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 8);
+
+ vbox = gtk_vbox_new(TRUE, 0);
+ gtk_widget_show(vbox);
+
+ gtk_table_attach(GTK_TABLE (table), vbox, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_SHRINK),
+ (GtkAttachOptions) (0), 0, 0);
+
+ hint_label = gtk_label_new(_("%s will be replaced with file name / URI"));
+ gtk_widget_show(hint_label);
+ gtk_box_pack_start(GTK_BOX (vbox),
+ hint_label, FALSE, FALSE, 4);
+ gtk_label_set_justify(GTK_LABEL (hint_label), GTK_JUSTIFY_LEFT);
+
+ table2 = gtk_table_new(5, 2, FALSE);
+ gtk_widget_show(table2);
+ gtk_container_set_border_width(GTK_CONTAINER(table2), 8);
+ gtk_table_set_row_spacings(GTK_TABLE(table2), 4);
+ gtk_table_set_col_spacings(GTK_TABLE(table2), 8);
+
+ gtk_table_attach(GTK_TABLE (table), table2, 0, 1, 1, 2,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+
+ uri_label = gtk_label_new (_("Web browser"));
+ gtk_widget_show(uri_label);
+
+ gtk_table_attach(GTK_TABLE (table2), uri_label, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 2);
+ gtk_label_set_justify(GTK_LABEL (hint_label), GTK_JUSTIFY_RIGHT);
+ gtk_misc_set_alignment(GTK_MISC (hint_label), 1, 0.5);
+
+ uri_combo = gtk_combo_new ();
+ gtk_widget_show (uri_combo);
+ gtk_table_attach (GTK_TABLE (table2), uri_combo, 1, 2, 0, 1,
+ GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtkut_combo_set_items (GTK_COMBO (uri_combo),
+ DEFAULT_BROWSER_CMD,
+ "galeon --new-tab '%s'",
+ "galeon '%s'",
+ "mozilla -remote 'openurl(%s,new-window)'",
+ "netscape -remote 'openURL(%s, new-window)'",
+ "netscape '%s'",
+ "gnome-moz-remote --newwin '%s'",
+ "kfmclient openURL '%s'",
+ "opera -newwindow '%s'",
+ "kterm -e w3m '%s'",
+ "kterm -e lynx '%s'",
+ NULL);
+ uri_entry = GTK_COMBO (uri_combo)->entry;
+ gtk_entry_set_text(GTK_ENTRY(uri_entry), prefs_common.uri_cmd ? prefs_common.uri_cmd : "");
+
+ printcmd_label = gtk_label_new (_("Print command"));
+ gtk_widget_show(printcmd_label);
+
+ gtk_table_attach(GTK_TABLE (table2), printcmd_label, 0, 1, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 2);
+ gtk_label_set_justify(GTK_LABEL (hint_label), GTK_JUSTIFY_RIGHT);
+ gtk_misc_set_alignment(GTK_MISC (hint_label), 1, 0.5);
+
+ printcmd_entry = gtk_entry_new ();
+ gtk_widget_show (printcmd_entry);
+ gtk_table_attach(GTK_TABLE (table2), printcmd_entry, 1, 2, 1, 2,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_entry_set_text(GTK_ENTRY(printcmd_entry), prefs_common.print_cmd ? prefs_common.print_cmd : "");
+
+ exteditor_label = gtk_label_new (_("Text editor"));
+ gtk_widget_show(exteditor_label);
+
+ gtk_table_attach(GTK_TABLE (table2), exteditor_label, 0, 1, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 2);
+ gtk_label_set_justify(GTK_LABEL (exteditor_label), GTK_JUSTIFY_RIGHT);
+ gtk_misc_set_alignment(GTK_MISC (exteditor_label), 1, 0.5);
+
+ exteditor_combo = gtk_combo_new ();
+ gtk_widget_show (exteditor_combo);
+ gtk_table_attach (GTK_TABLE (table2), exteditor_combo, 1, 2, 2, 3,
+ GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtkut_combo_set_items (GTK_COMBO (exteditor_combo),
+ "gedit %s",
+ "kedit %s",
+ "nedit %s",
+ "mgedit --no-fork %s",
+ "emacs %s",
+ "xemacs %s",
+ "kterm -e jed %s",
+ "kterm -e vi %s",
+ NULL);
+ exteditor_entry = GTK_COMBO (exteditor_combo)->entry;
+ gtk_entry_set_text(GTK_ENTRY(exteditor_entry),
+ prefs_common.ext_editor_cmd ? prefs_common.ext_editor_cmd : "");
+
+ image_viewer_label = gtk_label_new (_("Image viewer"));
+ gtk_widget_show(image_viewer_label);
+
+ gtk_table_attach(GTK_TABLE (table2), image_viewer_label, 0, 1, 3, 4,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 2);
+ gtk_label_set_justify(GTK_LABEL (image_viewer_label), GTK_JUSTIFY_RIGHT);
+ gtk_misc_set_alignment(GTK_MISC (image_viewer_label), 1, 0.5);
+
+ image_viewer_entry = gtk_entry_new ();
+ gtk_widget_show(image_viewer_entry);
+
+ gtk_table_attach(GTK_TABLE (table2), image_viewer_entry, 1, 2, 3, 4,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_entry_set_text(GTK_ENTRY(image_viewer_entry),
+ prefs_common.mime_image_viewer ? prefs_common.mime_image_viewer : "");
+
+ audio_player_label = gtk_label_new (_("Audio player"));
+ gtk_widget_show(audio_player_label);
+
+ gtk_table_attach(GTK_TABLE (table2), audio_player_label, 0, 1, 4, 5,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 2);
+ gtk_label_set_justify(GTK_LABEL (audio_player_label), GTK_JUSTIFY_RIGHT);
+ gtk_misc_set_alignment(GTK_MISC (audio_player_label), 1, 0.5);
+
+ audio_player_entry = gtk_entry_new ();
+ gtk_widget_show(audio_player_entry);
+
+ gtk_table_attach(GTK_TABLE (table2), audio_player_entry, 1, 2, 4, 5,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_entry_set_text(GTK_ENTRY(audio_player_entry),
+ prefs_common.mime_audio_player ? prefs_common.mime_audio_player : "");
+
+ prefs_ext_prog->window = GTK_WIDGET(window);
+ prefs_ext_prog->uri_entry = uri_entry;
+ prefs_ext_prog->printcmd_entry = printcmd_entry;
+ prefs_ext_prog->exteditor_entry = exteditor_entry;
+ prefs_ext_prog->image_viewer_entry = image_viewer_entry;
+ prefs_ext_prog->audio_player_entry = audio_player_entry;
+
+ prefs_ext_prog->page.widget = table;
+}
+
+void prefs_ext_prog_save(PrefsPage *_page)
+{
+ ExtProgPage *ext_prog = (ExtProgPage *) _page;
+
+ prefs_common.uri_cmd = gtk_editable_get_chars
+ (GTK_EDITABLE(ext_prog->uri_entry), 0, -1);
+ prefs_common.print_cmd = gtk_editable_get_chars
+ (GTK_EDITABLE(ext_prog->printcmd_entry), 0, -1);
+ prefs_common.ext_editor_cmd = gtk_editable_get_chars
+ (GTK_EDITABLE(ext_prog->exteditor_entry), 0, -1);
+ prefs_common.mime_image_viewer = gtk_editable_get_chars
+ (GTK_EDITABLE(ext_prog->image_viewer_entry), 0, -1);
+ prefs_common.mime_audio_player = gtk_editable_get_chars
+ (GTK_EDITABLE(ext_prog->audio_player_entry), 0, -1);
+}
+
+static void prefs_ext_prog_destroy_widget(PrefsPage *_page)
+{
+ /* ExtProgPage *ext_prog = (ExtProgPage *) _page; */
+
+}
+
+ExtProgPage *prefs_ext_prog;
+
+void prefs_ext_prog_init(void)
+{
+ ExtProgPage *page;
+
+ page = g_new0(ExtProgPage, 1);
+ page->page.path = _("Message View/External Programs");
+ page->page.create_widget = prefs_ext_prog_create_widget;
+ page->page.destroy_widget = prefs_ext_prog_destroy_widget;
+ page->page.save_page = prefs_ext_prog_save;
+ page->page.weight = 45.0;
+ prefs_gtk_register_page((PrefsPage *) page);
+ prefs_ext_prog = page;
+}
+
+void prefs_ext_prog_done(void)
+{
+ prefs_gtk_unregister_page((PrefsPage *) prefs_ext_prog);
+ g_free(prefs_ext_prog);
+}
--- /dev/null
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 2003 Hiroyuki Yamamoto & the Sylpheed-Claws team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "defs.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "intl.h"
+#include "utils.h"
+#include "prefs_common.h"
+#include "prefs_gtk.h"
+
+#include "gtk/gtkutils.h"
+#include "gtk/prefswindow.h"
+#include "gtk/filesel.h"
+
+#include "stock_pixmap.h"
+#include "mainwindow.h"
+#include "compose.h"
+#include "alertpanel.h"
+
+#define IS_CURRENT_THEME(path) (strcmp(prefs_common.pixmap_theme_path, path) == 0)
+#define IS_INTERNAL_THEME(path) (strcmp(DEFAULT_PIXMAP_THEME, path) == 0)
+#define IS_SYSTEM_THEME(path) (prefs_themes_is_system_theme(path))
+
+#define PREVIEW_ICONS 7
+
+typedef struct _ThemesPage
+{
+ PrefsPage page;
+
+ GtkWidget *window; /* do not modify */
+
+ GtkWidget *op_menu;
+ GtkWidget *btn_install;
+ GtkWidget *btn_more;
+ GtkWidget *global;
+
+ GtkWidget *name;
+ GtkWidget *author;
+ GtkWidget *url;
+ GtkWidget *status;
+
+ GtkWidget *icons[PREVIEW_ICONS];
+
+ GtkWidget *btn_use;
+ GtkWidget *btn_remove;
+
+ GdkPixmap *pixmaps[PREVIEW_ICONS];
+ GdkBitmap *masks[PREVIEW_ICONS];
+
+ /* gchar *theme_path; */
+} ThemesPage;
+
+typedef struct _ThemeInfo
+{
+ gchar *name;
+ gchar *author;
+ gchar *url;
+ gchar *status;
+} ThemeInfo;
+
+typedef struct _ThemeName
+{
+ gchar *name;
+ GList *item;
+} ThemeName;
+
+typedef struct _ThemesData
+{
+ GList *themes;
+ GList *names;
+ gchar *displayed;
+ ThemesPage *page;
+} ThemesData;
+
+typedef void (*FileFunc) (const gchar *filename, gpointer data);
+
+typedef struct _DirInfo {
+ gint bytes;
+ gint files;
+ gint pixms;
+} DirInfo;
+
+typedef struct _CopyInfo {
+ gchar *dest;
+ gchar *status;
+} CopyInfo;
+
+static ThemesData *prefs_themes_data;
+
+StockPixmap prefs_themes_icons[PREVIEW_ICONS] = {
+ STOCK_PIXMAP_MAIL,
+ STOCK_PIXMAP_MAIL_RECEIVE,
+ STOCK_PIXMAP_DOWN_ARROW,
+ STOCK_PIXMAP_MAIL_SEND_QUEUE,
+ STOCK_PIXMAP_BOOK,
+ STOCK_PIXMAP_MIME_TEXT_HTML,
+ STOCK_PIXMAP_PRIVACY_PASSED
+};
+
+
+
+static void prefs_themes_btn_use_clicked_cb (GtkWidget *widget, gpointer data);
+static void prefs_themes_btn_remove_clicked_cb (GtkWidget *widget, gpointer data);
+static void prefs_themes_btn_install_clicked_cb (GtkWidget *widget, gpointer data);
+static void prefs_themes_btn_more_clicked_cb (GtkWidget *widget, gpointer data);
+static void prefs_themes_menu_item_activated_cb (GtkWidget *widget, gpointer data);
+
+static void prefs_themes_update_buttons (const ThemesData *tdata);
+static void prefs_themes_display_global_stats (const ThemesData *tdata);
+static void prefs_themes_get_theme_info (ThemesData *tdata);
+static void prefs_themes_display_theme_info (ThemesData *tdata, const ThemeInfo *info);
+static void prefs_themes_get_themes_and_names (ThemesData *tdata);
+static void prefs_themes_free_names (ThemesData *tdata);
+
+static void prefs_themes_set_themes_menu (GtkOptionMenu *opmenu, const ThemesData *tdata);
+
+static gchar *prefs_themes_get_theme_stats (const gchar *dirname);
+static gboolean prefs_themes_is_system_theme (const gchar *dirname);
+
+static void prefs_themes_create_widget (PrefsPage *page, GtkWindow *window, gpointer data);
+static void prefs_themes_destroy_widget (PrefsPage *page);
+static void prefs_themes_save (PrefsPage *page);
+
+static void prefs_themes_foreach_file (const gchar *dirname, const FileFunc func, gpointer data);
+static void prefs_themes_file_stats (const gchar *filename, gpointer data);
+static void prefs_themes_file_remove (const gchar *filename, gpointer data);
+static void prefs_themes_file_install (const gchar *filename, gpointer data);
+
+
+
+static void prefs_themes_file_stats(const gchar *filename, gpointer data)
+{
+ struct stat s;
+ DirInfo *di = (DirInfo *)data;
+ gint len;
+
+ if (0 == stat(filename, &s) && 0 != S_ISREG(s.st_mode)) {
+ di->bytes += s.st_size;
+ di->files++;
+ len = strlen(filename);
+ if (len > 4) {
+ if (filename[len - 1] == 'm' && filename[len - 2] == 'p' &&
+ filename[len - 3] == 'x' && filename[len - 4] == '.')
+ di->pixms++;
+ }
+ }
+}
+
+static void prefs_themes_file_remove(const gchar *filename, gpointer data)
+{
+ gchar **status = (gchar **)data;
+ gchar *name;
+
+ if ((*status) != NULL)
+ return;
+
+ name = g_basename(filename);
+ if (TRUE == is_dir_exist(filename)) {
+ if (!((name[0] == '.') || (name[0] == '.' && name[1] == '.')))
+ g_warning("prefs_themes_file_remove(): subdir in theme dir skipped.\n");
+ }
+ else if (0 != unlink(filename)) {
+ (*status) = g_strdup(filename);
+ }
+}
+
+static void prefs_themes_file_install(const gchar *filename, gpointer data)
+{
+ CopyInfo *ci = (CopyInfo *)data;
+ gchar *name;
+
+ if (ci->status != NULL)
+ return;
+
+ name = g_basename(filename);
+ if (TRUE == is_dir_exist(filename)) {
+ if (!((name[0] == '.') || (name[0] == '.' && name[1] == '.')))
+ g_warning("prefs_themes_file_install(): subdir in theme dir skipped.\n");
+ }
+ else {
+ gchar *fulldest;
+
+ fulldest = g_strconcat(ci->dest, G_DIR_SEPARATOR_S, name, NULL);
+
+ if (0 != copy_file(filename, fulldest, FALSE)) {
+ ci->status = g_strdup(filename);
+ }
+ g_free(fulldest);
+ }
+}
+
+static void prefs_themes_foreach_file(const gchar *dirname, const FileFunc func, gpointer data)
+{
+ struct dirent *d;
+ DIR *dp;
+
+ g_return_if_fail(dirname != NULL);
+ g_return_if_fail(func != NULL);
+
+ if ((dp = opendir(dirname)) == NULL) {
+ debug_print("directory %s not found", dirname);
+ return;
+ }
+
+ while ((d = readdir(dp)) != NULL) {
+ gchar *entry;
+ gchar *fullentry;
+
+ entry = d->d_name;
+ fullentry = g_strconcat(dirname, G_DIR_SEPARATOR_S, entry, NULL);
+
+ (*func)(fullentry, data);
+
+ g_free(fullentry);
+ }
+}
+
+static gboolean prefs_themes_is_system_theme(const gchar *dirname)
+{
+ gint len;
+
+ g_return_val_if_fail(dirname != NULL, FALSE);
+
+ len = strlen(PACKAGE_DATA_DIR);
+ if (strlen(dirname) > len && 0 == strncmp(dirname, PACKAGE_DATA_DIR, len))
+ return TRUE;
+
+ return FALSE;
+}
+
+static void prefs_themes_set_themes_menu(GtkOptionMenu *opmenu, const ThemesData *tdata)
+{
+ GList *themes = tdata->names;
+ GtkWidget *menu;
+ GtkWidget *item;
+ gint i = 0, active = 0;
+
+ g_return_if_fail(opmenu != NULL);
+
+ gtk_option_menu_remove_menu(opmenu);
+
+ menu = gtk_menu_new ();
+ while (themes != NULL) {
+ ThemeName *tname = (ThemeName *)(themes->data);
+ gchar *tpath = (gchar *)(tname->item->data);
+
+ item = gtk_menu_item_new_with_label(tname->name);
+ gtk_widget_show(item);
+ gtk_signal_connect(GTK_OBJECT(item), "activate",
+ GTK_SIGNAL_FUNC(prefs_themes_menu_item_activated_cb),
+ tname->item->data);
+ gtk_menu_append(GTK_MENU(menu), item);
+
+ if (tdata->displayed != NULL && tdata->displayed == tpath)
+ active = i;
+
+ themes = g_list_next(themes);
+ ++i;
+ }
+
+ gtk_menu_set_active(GTK_MENU(menu), active);
+ gtk_option_menu_set_menu (opmenu, menu);
+}
+
+static void prefs_themes_get_themes_and_names(ThemesData *tdata)
+{
+ GList *tpaths;
+
+ g_return_if_fail(tdata != NULL);
+
+ if (tdata->themes != NULL)
+ stock_pixmap_themes_list_free(tdata->themes);
+ if (tdata->names != NULL)
+ prefs_themes_free_names(tdata);
+
+ tdata->themes = stock_pixmap_themes_list_new();
+
+ tpaths = tdata->themes;
+ while (tpaths != NULL) {
+ ThemeName *name = g_new0(ThemeName, 1);
+ gchar *sname = g_basename((gchar *)(tpaths->data));
+
+ if (IS_INTERNAL_THEME(sname))
+ name->name = g_strdup(_("Default internal theme"));
+ else
+ name->name = g_strdup(sname);
+ name->item = tpaths;
+
+ tdata->names = g_list_append(tdata->names, name);
+ tpaths = g_list_next(tpaths);
+ }
+}
+
+void prefs_themes_init(void)
+{
+ ThemesData *tdata;
+ ThemesPage *page;
+ GList *tpaths;
+
+ debug_print("Creating prefereces for themes...\n");
+
+ tdata = g_new0(ThemesData, 1);
+ prefs_themes_data = tdata;
+
+ prefs_themes_get_themes_and_names(tdata);
+
+ page = g_new0(ThemesPage, 1);
+
+ page->page.path = _("Display/Themes");
+ page->page.create_widget = prefs_themes_create_widget;
+ page->page.destroy_widget = prefs_themes_destroy_widget;
+ page->page.save_page = prefs_themes_save;
+ page->page.weight = 15.0;
+ prefs_gtk_register_page((PrefsPage *) page);
+
+ tdata->page = page;
+
+ tpaths = g_list_first(tdata->themes);
+ tdata->displayed = (gchar *)(tpaths->data);
+}
+
+static void prefs_themes_free_names(ThemesData *tdata)
+{
+ GList *names;
+
+ names = tdata->names;
+ while (names != NULL) {
+ ThemeName *tn = (ThemeName *)(names->data);
+
+ tn->item = NULL;
+ g_free(tn->name);
+ g_free(tn);
+
+ names = g_list_next(names);
+ }
+ g_list_free(names);
+ tdata->names = NULL;
+}
+
+void prefs_themes_done(void)
+{
+ ThemesData *tdata = prefs_themes_data;
+ GList *n;
+
+ debug_print("Finished prefereces for themes.\n");
+
+ stock_pixmap_themes_list_free(tdata->themes);
+ prefs_themes_free_names(tdata);
+ g_free(tdata->page);
+ g_free(tdata);
+}
+
+static void prefs_themes_btn_use_clicked_cb(GtkWidget *widget, gpointer data)
+{
+ ThemesData *tdata = prefs_themes_data;
+ gchar *theme_str;
+
+ theme_str = tdata->displayed;
+
+ if (prefs_common.pixmap_theme_path != NULL)
+ g_free(prefs_common.pixmap_theme_path);
+
+ prefs_common.pixmap_theme_path = g_strdup(theme_str);
+
+ main_window_reflect_prefs_all_real(TRUE);
+ compose_reflect_prefs_pixmap_theme();
+
+ prefs_themes_update_buttons(tdata);
+}
+
+static void prefs_themes_btn_remove_clicked_cb(GtkWidget *widget, gpointer data)
+{
+ ThemesData *tdata = prefs_themes_data;
+ gchar *theme_str;
+ gchar *alert_title = NULL;
+ AlertValue val = 0;
+
+ theme_str = tdata->displayed;
+
+ if (IS_SYSTEM_THEME(theme_str)) {
+ if (getuid() != 0) {
+ alertpanel_error(_("Only root can remove system themes"));
+ return;
+ }
+ alert_title = g_strdup_printf(_("Remove system theme '%s'"),
+ g_basename(theme_str));
+ }
+ if (NULL == alert_title) {
+ alert_title = g_strdup_printf(_("Remove theme '%s'"),
+ g_basename(theme_str));
+ }
+ val = alertpanel(alert_title,
+ _("Are you sure you want to remove this theme?"),
+ _("No"), _("Yes"), _("Cancel"));
+ g_free(alert_title);
+ if (G_ALERTALTERNATE == val) {
+ gchar *status = NULL;
+
+ prefs_themes_foreach_file(theme_str, prefs_themes_file_remove, &status);
+ if (0 != rmdir(theme_str)) {
+ if (status != NULL) {
+ alertpanel_error(_("File %s failed\nwhile removing theme."), status);
+ g_free(status);
+ }
+ else
+ alertpanel_error(_("Removing theme directory failed."));
+ }
+ else {
+ alertpanel_notice(_("Theme removed succesfully"));
+ /* update interface back to first theme */
+ prefs_themes_get_themes_and_names(tdata);
+ prefs_themes_set_themes_menu(GTK_OPTION_MENU(tdata->page->op_menu), tdata);
+ prefs_themes_display_global_stats(tdata);
+ tdata->displayed = (gchar *)((g_list_first(tdata->themes))->data);
+ prefs_themes_get_theme_info(tdata);
+ }
+ }
+}
+
+static void prefs_themes_btn_install_clicked_cb(GtkWidget *widget, gpointer data)
+{
+ struct stat s;
+ gchar *filename, *source;
+ gchar *themeinfo, *themename;
+ gchar *alert_title = NULL;
+ CopyInfo *cinfo;
+ AlertValue val = 0;
+ ThemesData *tdata = prefs_themes_data;
+
+ filename = filesel_select_file(_("Select theme folder"), NULL);
+ if (filename == NULL)
+ return;
+
+ cinfo = g_new0(CopyInfo, 1);
+ source = g_dirname(filename);
+ themename = g_basename(source);
+ debug_print("Installing '%s' theme from %s\n", themename, filename);
+
+ themeinfo = g_strconcat(source, G_DIR_SEPARATOR_S, THEMEINFO_FILE, NULL);
+ alert_title = g_strdup_printf(_("Install theme '%s'"), themename);
+ if (file_exist(themeinfo, FALSE) == FALSE) {
+ val = alertpanel(alert_title,
+ _("This folder doesn't seem to be a theme folder.\nInstall anyway?"),
+ _("Yes"), _("No"), _("Cancel"));
+ if (G_ALERTDEFAULT != val)
+ goto end_inst;
+ }
+ if (getuid() == 0) {
+ val = alertpanel(alert_title,
+ _("Do you want to install theme for system's all users?"),
+ _("Yes"), _("No"), _("Cancel"));
+ switch (val) {
+ case G_ALERTDEFAULT:
+ cinfo->dest = g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S,
+ PIXMAP_THEME_DIR, G_DIR_SEPARATOR_S,
+ themename, NULL);
+ break;
+ case G_ALERTALTERNATE:
+ break;
+ default:
+ goto end_inst;
+ }
+ }
+ g_free(alert_title);
+ if (cinfo->dest == NULL) {
+ cinfo->dest = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, RC_DIR,
+ G_DIR_SEPARATOR_S, PIXMAP_THEME_DIR, G_DIR_SEPARATOR_S,
+ themename, NULL);
+ }
+ if (TRUE == is_dir_exist(cinfo->dest)) {
+ alertpanel_error(_("A theme with the same name is\nalready installed in this location"));
+ goto end_inst;
+ }
+ if (0 != make_dir_hier(cinfo->dest)) {
+ alertpanel_error(_("Couldn't create destination directory"));
+ goto end_inst;
+ }
+ prefs_themes_foreach_file(source, prefs_themes_file_install, cinfo);
+ if (cinfo->status == NULL) {
+ GList *insted;
+
+ /* update interface to show newly installed theme */
+ prefs_themes_get_themes_and_names(tdata);
+ insted = g_list_find_custom(tdata->themes,
+ (gpointer)(cinfo->dest),
+ (GCompareFunc)strcmp2);
+ if (NULL != insted) {
+ alertpanel_notice(_("Theme installed succesfully"));
+ tdata->displayed = (gchar *)(insted->data);
+ prefs_themes_set_themes_menu(GTK_OPTION_MENU(tdata->page->op_menu), tdata);
+ prefs_themes_display_global_stats(tdata);
+ prefs_themes_get_theme_info(tdata);
+ }
+ else
+ alertpanel_error(_("Failed installing theme"));
+ }
+ else
+ alertpanel_error(_("File %s failed\nwhile installing theme."), cinfo->status);
+end_inst:
+ if (cinfo->dest != NULL) g_free(cinfo->dest);
+ g_free(source);
+ g_free(themeinfo);
+ g_free(cinfo);
+}
+
+static void prefs_themes_btn_more_clicked_cb(GtkWidget *widget, gpointer data)
+{
+ open_uri(CLAWS_THEMES_URI, prefs_common.uri_cmd);
+}
+
+static void prefs_themes_menu_item_activated_cb(GtkWidget *widget, gpointer data)
+{
+ ThemesData *tdata = prefs_themes_data;
+ gchar *path = (gchar *)data;
+
+ g_return_if_fail(path != NULL);
+
+ tdata->displayed = path;
+ prefs_themes_get_theme_info(tdata);
+}
+
+static void prefs_themes_update_buttons(const ThemesData *tdata)
+{
+ ThemesPage *theme = tdata->page;
+ gboolean can_rem, can_use;
+
+ can_use = !IS_CURRENT_THEME(tdata->displayed);
+ can_rem = can_use && !IS_INTERNAL_THEME(tdata->displayed);
+
+ if (theme->btn_use != NULL)
+ gtk_widget_set_sensitive(theme->btn_use, can_use);
+ if (theme->btn_remove != NULL)
+ gtk_widget_set_sensitive(theme->btn_remove, can_rem);
+}
+
+static void prefs_themes_display_theme_info(ThemesData *tdata, const ThemeInfo *info)
+{
+ ThemesPage *theme = tdata->page;
+ gchar *save_prefs_path;
+ gint i;
+
+ gtk_label_set_text(GTK_LABEL(theme->name), info->name);
+ gtk_label_set_text(GTK_LABEL(theme->author), info->author);
+ gtk_label_set_text(GTK_LABEL(theme->url), info->url);
+ gtk_label_set_text(GTK_LABEL(theme->status), info->status);
+
+ save_prefs_path = prefs_common.pixmap_theme_path;
+ prefs_common.pixmap_theme_path = tdata->displayed;
+ for (i = 0; i < PREVIEW_ICONS; ++i) {
+ stock_pixmap_gdk(theme->window, prefs_themes_icons[i],
+ &(theme->pixmaps[i]), &(theme->masks[i]));
+ gtk_pixmap_set(GTK_PIXMAP(theme->icons[i]),
+ theme->pixmaps[i], theme->masks[i]);
+ }
+ prefs_common.pixmap_theme_path = save_prefs_path;
+
+ prefs_themes_update_buttons(tdata);
+}
+
+static void prefs_themes_display_global_stats(const ThemesData *tdata)
+{
+ ThemesPage *theme = tdata->page;
+ GList *tnames = tdata->names;
+ gchar *gstats;
+ gint sys = 0;
+ gint usr = 0;
+ gint all = 0;
+
+ while (tnames != NULL) {
+ ThemeName *tname = (ThemeName *)(tnames->data);
+ gchar *tpath = (gchar *)(tname->item->data);
+
+ if (IS_SYSTEM_THEME(tpath))
+ ++sys;
+ else if (!IS_INTERNAL_THEME(tpath))
+ ++usr;
+ ++all;
+ tnames = g_list_next(tnames);
+ }
+
+ gstats = g_strdup_printf(_("%d themes available (%d user, %d system, 1 internal)"),
+ all, usr, sys);
+ gtk_label_set_text(GTK_LABEL(theme->global), gstats);
+ g_free(gstats);
+}
+
+#define INFOFILE_LINE_LEN 80
+
+#define FGETS_INFOFILE_LINE() \
+ line[0] = '\0'; \
+ fgets(line, INFOFILE_LINE_LEN, finfo); \
+ if ((len = strlen(line)) > 0) { \
+ if (line[len - 1] == '\n') line[len - 1] = '\0'; \
+ } \
+ else { \
+ strcpy(line, _("Unknown")); \
+ }
+
+static void prefs_themes_get_theme_info(ThemesData *tdata)
+{
+ FILE *finfo;
+ gchar *sinfo;
+ gchar *path;
+ gchar line[INFOFILE_LINE_LEN];
+ gint len;
+ ThemeInfo *info;
+ ThemesPage *theme = tdata->page;
+
+ g_return_if_fail(theme != NULL);
+ path = tdata->displayed;
+ g_return_if_fail(path != NULL);
+
+ debug_print("Getting theme info for %s\n", path);
+
+ info = g_new0(ThemeInfo, 1);
+
+ if (IS_INTERNAL_THEME(path)) {
+ info->name = g_strdup(_("Default internal theme"));
+ info->author = g_strdup(_("The Sylpheed Claws Team"));
+ info->url = g_strdup(HOMEPAGE_URI);
+ info->status = g_strdup_printf(_("Internal theme has %d icons"), N_STOCK_PIXMAPS);
+ }
+ else {
+ sinfo = g_strconcat(path, G_DIR_SEPARATOR_S, THEMEINFO_FILE, NULL);
+ finfo = fopen(sinfo, "r");
+ if (finfo == NULL) {
+ info->name = g_strdup(_("No info file available for this theme"));
+ info->author = g_strdup(_("Unknown"));
+ info->url = g_strdup(_("Unknown"));
+ }
+ else {
+ FGETS_INFOFILE_LINE()
+ info->name = g_strdup(line);
+ FGETS_INFOFILE_LINE()
+ info->author = g_strdup(line);
+ FGETS_INFOFILE_LINE()
+ info->url = g_strdup(line);
+
+ fclose(finfo);
+ }
+ g_free(sinfo);
+
+ info->status = prefs_themes_get_theme_stats(path);
+ if (info->status == NULL) {
+ info->status = g_strdup(_("Error: can't get theme status"));
+ }
+ }
+
+ prefs_themes_display_theme_info(tdata, info);
+
+ g_free(info->name);
+ g_free(info->author);
+ g_free(info->url);
+ g_free(info->status);
+
+ g_free(info);
+}
+
+#undef FGETS_INFOFILE_LINE
+
+static gchar *prefs_themes_get_theme_stats(const gchar *dirname)
+{
+ gchar *stats;
+ DirInfo *dinfo;
+
+ dinfo = g_new0(DirInfo, 1);
+
+ prefs_themes_foreach_file(dirname, prefs_themes_file_stats, dinfo);
+ stats = g_strdup_printf(_("%d files (%d icons), size is %s"),
+ dinfo->files, dinfo->pixms, to_human_readable(dinfo->bytes));
+
+ g_free(dinfo);
+ return stats;
+}
+
+/* BEGIN GLADE CODE */
+/* This is a dummy pixmap we use when a pixmap can't be found. */
+static char *dummy_pixmap_xpm[] = {
+ /* columns rows colors chars-per-pixel */
+ "1 1 1 1",
+ " c None",
+ /* pixels */
+ " "
+};
+
+/* This is an internally used function to create pixmaps. */
+static GtkWidget* create_dummy_pixmap(GtkWidget *widget)
+{
+ GdkColormap *colormap;
+ GdkPixmap *gdkpixmap;
+ GdkBitmap *mask;
+ GtkWidget *pixmap;
+
+ colormap = gtk_widget_get_colormap (widget);
+ gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask,
+ NULL, dummy_pixmap_xpm);
+ if (gdkpixmap == NULL)
+ g_error ("Couldn't create replacement pixmap.");
+ pixmap = gtk_pixmap_new (gdkpixmap, mask);
+ gdk_pixmap_unref (gdkpixmap);
+ gdk_bitmap_unref (mask);
+ return pixmap;
+}
+/* END GLADE CODE */
+
+/* glade generates some calls to a create_pixmap support function
+ * we don't really need. */
+#define create_pixmap(widget,filename) create_dummy_pixmap(widget)
+
+static void prefs_themes_create_widget(PrefsPage *page, GtkWindow *window, gpointer data)
+{
+ ThemesPage *prefs_themes = (ThemesPage *)page;
+ ThemesData *tdata = prefs_themes_data;
+ gchar *buf;
+ gint i;
+ /* from gtk/about.c */
+ GtkStyle *style;
+ GdkColormap *cmap;
+ GdkColor uri_color[2] = {{0, 0, 0, 0xffff}, {0, 0xffff, 0, 0}};
+ gboolean success[2];
+
+ /* BEGIN GLADE EDITED CODE */
+ GtkWidget *vbox1;
+ GtkWidget *frame1;
+ GtkWidget *vbox2;
+ GtkWidget *hbox3;
+ GtkWidget *menu_themes;
+ GtkWidget *menu_themes_menu;
+ GtkWidget *glade_menuitem;
+ GtkWidget *btn_install;
+ GtkWidget *btn_more;
+ GtkWidget *label_global_status;
+ GtkWidget *frame_info;
+ GtkWidget *table1;
+ GtkWidget *label1;
+ GtkWidget *label2;
+ GtkWidget *label3;
+ GtkWidget *label_name;
+ GtkWidget *label_author;
+ GtkWidget *label_url;
+ GtkWidget *label4;
+ GtkWidget *label_status;
+ GtkWidget *frame_preview;
+ GtkWidget *hbox1;
+ GtkWidget *icon_1;
+ GtkWidget *icon_2;
+ GtkWidget *icon_3;
+ GtkWidget *icon_4;
+ GtkWidget *icon_5;
+ GtkWidget *icon_6;
+ GtkWidget *icon_7;
+ GtkWidget *frame_buttons;
+ GtkWidget *hbuttonbox1;
+ GtkWidget *btn_use;
+ GtkWidget *btn_remove;
+
+ vbox1 = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox1);
+
+ frame1 = gtk_frame_new (_("Selector"));
+ gtk_widget_show (frame1);
+ gtk_box_pack_start (GTK_BOX (vbox1), frame1, TRUE, TRUE, 0);
+
+ vbox2 = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox2);
+ gtk_container_add (GTK_CONTAINER (frame1), vbox2);
+
+ hbox3 = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (hbox3);
+ gtk_box_pack_start (GTK_BOX (vbox2), hbox3, TRUE, TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox3), 5);
+
+ menu_themes = gtk_option_menu_new ();
+ gtk_widget_show (menu_themes);
+ gtk_box_pack_start (GTK_BOX (hbox3), menu_themes, FALSE, FALSE, 0);
+ menu_themes_menu = gtk_menu_new ();
+ glade_menuitem = gtk_menu_item_new_with_label ("");
+ gtk_widget_show (glade_menuitem);
+ gtk_menu_append (GTK_MENU (menu_themes_menu), glade_menuitem);
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (menu_themes), menu_themes_menu);
+
+ btn_install = gtk_button_new_with_label (_("Install new..."));
+ gtk_widget_show (btn_install);
+ gtk_box_pack_start (GTK_BOX (hbox3), btn_install, FALSE, FALSE, 0);
+ GTK_WIDGET_SET_FLAGS (btn_install, GTK_CAN_DEFAULT);
+
+ btn_more = gtk_button_new_with_label (_("Get more..."));
+ gtk_widget_show (btn_more);
+ gtk_box_pack_start (GTK_BOX (hbox3), btn_more, FALSE, FALSE, 0);
+ GTK_WIDGET_SET_FLAGS (btn_more, GTK_CAN_DEFAULT);
+ /* make it look like an uri */
+ gtk_button_set_relief(GTK_BUTTON(btn_more), GTK_RELIEF_NONE);
+ gtk_label_get(GTK_LABEL(GTK_BIN(btn_more)->child), &buf);
+ buf = g_strdup(buf);
+ for (i = 0; buf[i] != '\0'; buf[i++] = '_');
+ gtk_label_set_pattern(GTK_LABEL(GTK_BIN(btn_more)->child), buf);
+ g_free(buf);
+ cmap = gdk_window_get_colormap((mainwindow_get_mainwindow())->window->window);
+ gdk_colormap_alloc_colors(cmap, uri_color, 2, FALSE, TRUE, success);
+ if (success[0] == TRUE && success[1] == TRUE) {
+ gtk_widget_ensure_style(GTK_BIN(btn_more)->child);
+ style = gtk_style_copy
+ (gtk_widget_get_style(GTK_BIN(btn_more)->child));
+ style->fg[GTK_STATE_NORMAL] = uri_color[0];
+ style->fg[GTK_STATE_ACTIVE] = uri_color[1];
+ style->fg[GTK_STATE_PRELIGHT] = uri_color[0];
+ gtk_widget_set_style(GTK_BIN(btn_more)->child, style);
+ } else
+ g_warning("prefs_themes_create_widget(): color allocation failed.\n");
+
+
+ label_global_status = gtk_label_new ("");
+ gtk_widget_show (label_global_status);
+ gtk_box_pack_start (GTK_BOX (vbox2), label_global_status, FALSE, FALSE, 0);
+ gtk_label_set_justify (GTK_LABEL (label_global_status), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label_global_status), 0, 0.5);
+ gtk_misc_set_padding (GTK_MISC (label_global_status), 6, 0);
+
+ frame_info = gtk_frame_new (_("Information"));
+ gtk_widget_show (frame_info);
+ gtk_box_pack_start (GTK_BOX (vbox1), frame_info, TRUE, TRUE, 0);
+
+ table1 = gtk_table_new (4, 2, FALSE);
+ gtk_widget_show (table1);
+ gtk_container_add (GTK_CONTAINER (frame_info), table1);
+
+ label1 = gtk_label_new (_("Name: "));
+ gtk_widget_show (label1);
+ gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 8, 2);
+ gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
+
+ label2 = gtk_label_new (_("Author: "));
+ gtk_widget_show (label2);
+ gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 8, 2);
+ gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
+ gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
+
+ label3 = gtk_label_new (_("URL:"));
+ gtk_widget_show (label3);
+ gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 8, 2);
+ gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);
+
+ label_name = gtk_label_new ("");
+ gtk_widget_show (label_name);
+ gtk_table_attach (GTK_TABLE (table1), label_name, 1, 2, 0, 1,
+ (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label_name), 0, 0.5);
+
+ label_author = gtk_label_new ("");
+ gtk_widget_show (label_author);
+ gtk_table_attach (GTK_TABLE (table1), label_author, 1, 2, 1, 2,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label_author), 0, 0.5);
+
+ label_url = gtk_label_new ("");
+ gtk_widget_show (label_url);
+ gtk_table_attach (GTK_TABLE (table1), label_url, 1, 2, 2, 3,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label_url), 0, 0.5);
+
+ label4 = gtk_label_new (_("Status:"));
+ gtk_widget_show (label4);
+ gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 3, 4,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 8, 2);
+ gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
+
+ label_status = gtk_label_new ("");
+ gtk_widget_show (label_status);
+ gtk_table_attach (GTK_TABLE (table1), label_status, 1, 2, 3, 4,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ gtk_misc_set_alignment (GTK_MISC (label_status), 0, 0.5);
+
+ frame_preview = gtk_frame_new (_("Preview"));
+ gtk_widget_show (frame_preview);
+ gtk_box_pack_start (GTK_BOX (vbox1), frame_preview, TRUE, TRUE, 0);
+
+ hbox1 = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (hbox1);
+ gtk_container_add (GTK_CONTAINER (frame_preview), hbox1);
+
+ icon_1 = create_pixmap (vbox1, NULL);
+ gtk_widget_show (icon_1);
+ gtk_box_pack_start (GTK_BOX (hbox1), icon_1, TRUE, TRUE, 2);
+ gtk_misc_set_padding (GTK_MISC (icon_1), 0, 5);
+
+ icon_2 = create_pixmap (vbox1, NULL);
+ gtk_widget_show (icon_2);
+ gtk_box_pack_start (GTK_BOX (hbox1), icon_2, TRUE, TRUE, 2);
+ gtk_misc_set_padding (GTK_MISC (icon_2), 0, 5);
+
+ icon_3 = create_pixmap (vbox1, NULL);
+ gtk_widget_show (icon_3);
+ gtk_box_pack_start (GTK_BOX (hbox1), icon_3, TRUE, TRUE, 2);
+ gtk_misc_set_padding (GTK_MISC (icon_3), 0, 5);
+
+ icon_4 = create_pixmap (vbox1, NULL);
+ gtk_widget_show (icon_4);
+ gtk_box_pack_start (GTK_BOX (hbox1), icon_4, TRUE, TRUE, 2);
+ gtk_misc_set_padding (GTK_MISC (icon_4), 0, 5);
+
+ icon_5 = create_pixmap (vbox1, NULL);
+ gtk_widget_show (icon_5);
+ gtk_box_pack_start (GTK_BOX (hbox1), icon_5, TRUE, TRUE, 2);
+ gtk_misc_set_padding (GTK_MISC (icon_5), 0, 5);
+
+ icon_6 = create_pixmap (vbox1, NULL);
+ gtk_widget_show (icon_6);
+ gtk_box_pack_start (GTK_BOX (hbox1), icon_6, TRUE, TRUE, 0);
+ gtk_misc_set_padding (GTK_MISC (icon_6), 0, 5);
+
+ icon_7 = create_pixmap (vbox1, NULL);
+ gtk_widget_show (icon_7);
+ gtk_box_pack_start (GTK_BOX (hbox1), icon_7, TRUE, TRUE, 0);
+ gtk_misc_set_padding (GTK_MISC (icon_7), 0, 5);
+
+ frame_buttons = gtk_frame_new (_("Actions"));
+ gtk_widget_show (frame_buttons);
+ gtk_box_pack_start (GTK_BOX (vbox1), frame_buttons, TRUE, TRUE, 0);
+
+ hbuttonbox1 = gtk_hbutton_box_new ();
+ gtk_widget_show (hbuttonbox1);
+ gtk_container_add (GTK_CONTAINER (frame_buttons), hbuttonbox1);
+ gtk_container_set_border_width (GTK_CONTAINER (hbuttonbox1), 5);
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_START);
+ gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox1), 5);
+ gtk_button_box_set_child_ipadding (GTK_BUTTON_BOX (hbuttonbox1), 5, 0);
+
+ btn_use = gtk_button_new_with_label (_("Use this"));
+ gtk_widget_show (btn_use);
+ gtk_container_add (GTK_CONTAINER (hbuttonbox1), btn_use);
+ GTK_WIDGET_SET_FLAGS (btn_use, GTK_CAN_DEFAULT);
+
+ btn_remove = gtk_button_new_with_label (_("Remove"));
+ gtk_widget_show (btn_remove);
+ gtk_container_add (GTK_CONTAINER (hbuttonbox1), btn_remove);
+ GTK_WIDGET_SET_FLAGS (btn_remove, GTK_CAN_DEFAULT);
+
+ gtk_signal_connect(GTK_OBJECT (btn_use), "clicked",
+ GTK_SIGNAL_FUNC (prefs_themes_btn_use_clicked_cb),
+ NULL);
+ gtk_signal_connect(GTK_OBJECT(btn_remove), "clicked",
+ GTK_SIGNAL_FUNC(prefs_themes_btn_remove_clicked_cb),
+ NULL);
+ gtk_signal_connect(GTK_OBJECT(btn_install), "clicked",
+ GTK_SIGNAL_FUNC(prefs_themes_btn_install_clicked_cb),
+ NULL);
+ gtk_signal_connect(GTK_OBJECT(btn_more), "clicked",
+ GTK_SIGNAL_FUNC(prefs_themes_btn_more_clicked_cb),
+ NULL);
+
+ gtk_widget_grab_default (btn_use);
+ /* END GLADE EDITED CODE */
+
+ prefs_themes->window = GTK_WIDGET(window);
+
+ prefs_themes->name = label_name;
+ prefs_themes->author = label_author;
+ prefs_themes->url = label_url;
+ prefs_themes->status = label_status;
+ prefs_themes->global = label_global_status;
+
+ prefs_themes->icons[0] = icon_1;
+ prefs_themes->icons[1] = icon_2;
+ prefs_themes->icons[2] = icon_3;
+ prefs_themes->icons[3] = icon_4;
+ prefs_themes->icons[4] = icon_5;
+ prefs_themes->icons[5] = icon_6;
+ prefs_themes->icons[6] = icon_7;
+
+ prefs_themes->btn_use = btn_use;
+ prefs_themes->btn_remove = btn_remove;
+ prefs_themes->btn_install = btn_install;
+ prefs_themes->btn_more = btn_more;
+
+ prefs_themes->op_menu = menu_themes;
+
+ prefs_themes->page.widget = vbox1;
+
+ prefs_themes_set_themes_menu(GTK_OPTION_MENU(prefs_themes->op_menu), tdata);
+
+ prefs_themes_get_theme_info(tdata);
+ prefs_themes_display_global_stats(tdata);
+}
+
+static void prefs_themes_destroy_widget(PrefsPage *page)
+{
+ /* ThemesPage *theme = (ThemesPage *)page; */
+}
+
+static void prefs_themes_save(PrefsPage *page)
+{
+ /* ThemesPage *theme = (ThemesPage *)page; */
+}
+
--- /dev/null
+#!/bin/bash
+
+# textviewer.sh
+# Copyright 2003 Luke Plant <L.Plant.98@cantab.net>
+# and Johann Koenig <johann@mental-graffiti.com>
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+##############################################################################
+#
+# This script is a text viewer designed to be used with sylpheed-claws actions
+# Set up an action with the command line: textviewer.sh %p |
+#
+# The script will try to detect file type automatically, and then
+# invokes a relevant program to print the file in plain text to
+# the standard output.
+#
+# From v 0.9.7claws7, sylpheed-claws sets the temporary file
+# of a part to XXXXXX.mimetmp.[filename of attachment]
+# This means we can use the extension of the filename for checking.
+# Also use the program 'file' if that fails.
+#
+# To extend the script just follow the patterns that already exist, or
+# contact the author if you have problems.
+
+##############################################################################
+#
+# Change Log
+#
+# 2004-01-25
+# - added brief messages describing whats going on
+#
+# 2004-01-23
+# - added support for 'pdftotext,' from xpdf-utils debian package
+#
+# 2004-01-05
+# - added matcher and action for OpenOffice Writer documents
+# (requires ooo2txt)
+#
+# 2004-01-05
+# - changed page width parameter for antiword
+# - fixed matcher for 'diffs'
+# - added a matcher and action for bzip2 - bzip2 files
+# are decompressed and textviewer.sh run on the result
+# - similarly decompress gzip files and run textviewer.sh
+# on the result, insteading of doing 'gzip -l'
+#
+# 2003-12-30
+# added the script to sylpheed-claws/tools
+#
+# 2003-12-30
+# - use 'fold' after 'unrtf' to wrap to a nice width
+# - added basic file sanity checks
+#
+# 2003-12-29
+# Added recognition for "Zip " from 'file' output
+#
+# 2003-12-19
+# Initial public release
+#
+###############################################################################
+
+if [ $# -eq 0 ]
+then
+ echo "No filename supplied." >&2
+ echo "Usage: textviewer.sh FILE" >&2
+ exit 1
+fi
+
+[ -f "$1" ] ||
+{
+ echo "File \"$1\" does not exist or is not a regular file." >&2
+ exit 1
+}
+
+[ -r "$1" ] ||
+{
+ echo "Cannot read file \"$1\"." >&2
+ exit 1
+}
+
+FILETYPE=`file --brief "$1"` ||
+{
+ echo "Please install the command 'file' to use this script." >&2
+ exit 1
+};
+
+case "$1" in
+ *.doc) TYPE=MSWORD ;;
+ *.zip) TYPE=ZIP ;;
+ *.tar.gz|*.tgz) TYPE=TARGZ ;;
+ *.tar.bz2|*.tar.bz) TYPE=TARBZ ;;
+ *.gz) TYPE=GZIP ;;
+ *.bz2|*.bz) TYPE=BZIP ;;
+ *.tar) TYPE=TAR ;;
+ *.diff) TYPE=TEXT ;;
+ *.txt) TYPE=TEXT ;;
+ *.rtf) TYPE=RTF ;;
+ *.sxw) TYPE=OOWRITER ;;
+ *.pdf) TYPE=PDF ;;
+esac
+
+if [ "$TYPE" == "" ]
+then
+ case $FILETYPE in
+ "'diff'"*) TYPE=TEXT ;;
+ gzip*) TYPE=GZIP ;;
+ bzip2*) TYPE=BZIP ;;
+ "POSIX tar archive"*) TYPE=TAR ;;
+ "Zip "*) TYPE=ZIP ;;
+ ASCII*) TYPE=TEXT ;;
+ "Rich Text Format"*)
+ TYPE=RTF ;;
+ "smtp mail text"* | "RFC 822 mail text"*)
+ TYPE=TEXT ;;
+ "Bourne shell script"* | "Bourne-Again shell script"*)
+ TYPE=TEXT ;;
+ esac
+fi
+
+case $TYPE in
+ TARGZ) echo -e "Gzip'd tarball contents:\n" ;
+ tar -tzvf "$1" ;;
+
+ TARBZ) echo -e "Bzip'd tarball contents:\n" ;
+ tar -tjvf "$1" ;;
+
+ BZIP) TMP=`mktemp "$1".temp.XXXXXXX` || exit 1;
+ bunzip2 -c "$1" > "$TMP" || exit 1;
+ echo -e "Re-running \"$0\" on bunzip'd contents of \"$1\":\n";
+ "$0" "$TMP";
+ rm "$TMP" ;;
+
+ GZIP) TMP=`mktemp "$1".temp.XXXXXXX` || exit 1;
+ gunzip -c "$1" > "$TMP" || exit 1;
+ echo "Re-running \"$0\" on gunzip'd contents of \"$1\":\n";
+ "$0" "$TMP";
+ rm "$TMP" ;;
+
+ TAR) echo -e "Tar archive contents:\n" ;
+ tar -tvf "$1" ;;
+
+ ZIP) echo -e "Zip file contents:\n" ;
+ unzip -l "$1" ;;
+
+ RTF) which unrtf > /dev/null 2>&1 ||
+ {
+ echo "Program 'unrtf' for displaying RTF files not found" >&2
+ exit 1
+ };
+ echo -e "Displaying \"$1\" using \"unrtf\":\n";
+ unrtf -t text "$1" 2>/dev/null | egrep -v '^### ' | fold -s -w 72 ;;
+
+ TEXT) cat "$1" ;;
+
+ MSWORD) which antiword > /dev/null 2>&1 ||
+ {
+ echo "Program 'antiword' for displaying MS Word files not found" >&2
+ exit 1
+ };
+ echo -e "Displaying \"$1\" using \"antiword\":\n";
+ antiword -w 72 "$1" ;;
+
+ OOWRITER) which ooo2txt > /dev/null 2>&1 ||
+ {
+ echo "Program 'ooo2txt' for converting OpenOffice Writer files not files not found" >&2
+ exit 1
+ };
+ echo -e "Displaying \"$1\" using \"ooo2txt\":\n";
+ ooo2txt "$1" ;;
+
+ PDF) which pdftotext > /dev/null 2>&1 ||
+ {
+ echo "Program 'pdftotext' for converting Adobe Portable Document Format to text not found" >&2
+ exit 1
+ };
+ echo -e "Displaying \"$1\" using \"pdftotext\":\n";
+ pdftotext "$1" - ;;
+
+ *) echo "Unsupported file type \"$FILETYPE\", cannot display.";;
+esac