From 46f10cfde9be49e0a40c11808592de5b87ff25db Mon Sep 17 00:00:00 2001 From: djcb Date: Sun, 20 May 2012 17:41:18 +0300 Subject: [PATCH] * refactoring: split src/ into mu/ and lib/ --- Makefile.am | 2 +- configure.ac | 8 ++- guile/Makefile.am | 4 +- guile/mu-guile-message.c | 2 +- {src => lib}/Makefile.am | 20 ------ {src => lib}/mu-bookmarks.c | 0 {src => lib}/mu-bookmarks.h | 0 {src => lib}/mu-contacts.c | 0 {src => lib}/mu-contacts.h | 0 {src => lib}/mu-container.c | 0 {src => lib}/mu-container.h | 0 {src => lib}/mu-date.c | 0 {src => lib}/mu-date.h | 0 {src => lib}/mu-flags.c | 0 {src => lib}/mu-flags.h | 0 {src => lib}/mu-index.c | 0 {src => lib}/mu-index.h | 0 {src => lib}/mu-log.c | 0 {src => lib}/mu-log.h | 0 {src => lib}/mu-maildir.c | 0 {src => lib}/mu-maildir.h | 0 {src => lib}/mu-msg-cache.c | 0 {src => lib}/mu-msg-cache.h | 0 {src => lib}/mu-msg-doc.cc | 0 {src => lib}/mu-msg-doc.h | 0 {src => lib}/mu-msg-fields.c | 0 {src => lib}/mu-msg-fields.h | 0 {src => lib}/mu-msg-file.c | 0 {src => lib}/mu-msg-file.h | 0 {src => lib}/mu-msg-iter.cc | 0 {src => lib}/mu-msg-iter.h | 0 {src => lib}/mu-msg-part.c | 0 {src => lib}/mu-msg-part.h | 0 {src => lib}/mu-msg-prio.c | 0 {src => lib}/mu-msg-prio.h | 0 {src => lib}/mu-msg-priv.h | 0 {src => lib}/mu-msg-sexp.c | 43 ++++++----- {src => lib}/mu-msg.c | 0 {src => lib}/mu-msg.h | 0 {src => lib}/mu-query.cc | 0 {src => lib}/mu-query.h | 0 {src => lib}/mu-runtime.c | 56 +-------------- {src => lib}/mu-runtime.h | 28 +++----- {src => lib}/mu-store-priv.hh | 0 {src => lib}/mu-store-read.cc | 0 {src => lib}/mu-store-write.cc | 0 {src => lib}/mu-store.cc | 0 {src => lib}/mu-store.h | 0 {src => lib}/mu-str-normalize.c | 0 {src => lib}/mu-str.c | 0 {src => lib}/mu-str.h | 4 +- {src => lib}/mu-threader.c | 0 {src => lib}/mu-threader.h | 0 {src => lib}/mu-util.c | 0 {src => lib}/mu-util.h | 0 {src => lib}/tests/Makefile.am | 72 ++++--------------- {src => lib}/tests/dummy.cc | 0 {src => lib}/tests/test-mu-common.c | 0 {src => lib}/tests/test-mu-common.h | 0 {src => lib}/tests/test-mu-date.c | 42 +++++------ {src => lib}/tests/test-mu-flags.c | 2 +- {src => lib}/tests/test-mu-maildir.c | 4 +- {src => lib}/tests/test-mu-msg-fields.c | 28 ++++---- {src => lib}/tests/test-mu-msg.c | 4 +- {src => lib}/tests/test-mu-store.c | 2 +- {src => lib}/tests/test-mu-str.c | 4 +- {src => lib}/tests/test-mu-util.c | 2 +- .../cur/1220863042.12663_1.mindcrime!2,S | 0 .../cur/1220863060.12663_3.mindcrime!2,S | 0 .../cur/1220863087.12663_15.mindcrime!2,PS | 0 .../cur/1220863087.12663_19.mindcrime!2,S | 0 .../cur/1220863087.12663_5.mindcrime!2,S | 0 .../cur/1220863087.12663_7.mindcrime!2,RS | 0 .../cur/1252168370_3.14675.cthulhu!2,S | 0 .../testdir/cur/1283599333.1840_11.cthulhu!2, | 0 .../cur/1305664394.2171_402.cthulhu!2, | 0 {src => lib}/tests/testdir/cur/encrypted!2,S | 0 {src => lib}/tests/testdir/cur/signed!2,S | 0 .../tests/testdir/cur/signed-encrypted!2,S | 0 .../testdir/new/1220863087.12663_21.mindcrime | 0 .../testdir/new/1220863087.12663_23.mindcrime | 0 .../testdir/new/1220863087.12663_25.mindcrime | 0 .../testdir/new/1220863087.12663_9.mindcrime | 0 .../tests/testdir/tmp/1220863087.12663.ignore | 0 {src => lib}/tests/testdir2/Foo/cur/arto.eml | 0 {src => lib}/tests/testdir2/Foo/cur/mail5 | 0 {src => lib}/tests/testdir2/Foo/new/.noindex | 0 {src => lib}/tests/testdir2/Foo/tmp/.noindex | 0 .../tests/testdir2/bar/cur/181736.eml | 0 {src => lib}/tests/testdir2/bar/cur/mail1 | 0 {src => lib}/tests/testdir2/bar/cur/mail2 | 0 {src => lib}/tests/testdir2/bar/cur/mail3 | 0 {src => lib}/tests/testdir2/bar/cur/mail4 | 0 {src => lib}/tests/testdir2/bar/cur/mail5 | 0 {src => lib}/tests/testdir2/bar/cur/mail6 | 0 {src => lib}/tests/testdir2/bar/new/.noindex | 0 {src => lib}/tests/testdir2/bar/tmp/.noindex | 0 .../tests/testdir2/wom_bat/cur/atomic | 0 .../tests/testdir2/wom_bat/cur/rfc822.1 | 0 .../tests/testdir2/wom_bat/cur/rfc822.2 | 0 {src => lib}/tests/testdir3/cycle/cur/cycle0 | 0 .../tests/testdir3/cycle/cur/cycle0.0 | 0 .../tests/testdir3/cycle/cur/cycle0.0.0 | 0 {src => lib}/tests/testdir3/cycle/cur/rogue0 | 0 .../tests/testdir3/cycle/new/.noindex | 0 .../tests/testdir3/cycle/tmp/.noindex | 0 {src => lib}/tests/testdir3/tree/cur/child0.0 | 0 {src => lib}/tests/testdir3/tree/cur/child0.1 | 0 .../tests/testdir3/tree/cur/child0.1.0 | 0 .../tests/testdir3/tree/cur/child2.0.0 | 0 .../tests/testdir3/tree/cur/child3.0.0.0.0 | 0 {src => lib}/tests/testdir3/tree/cur/child4.0 | 0 {src => lib}/tests/testdir3/tree/cur/child4.1 | 0 {src => lib}/tests/testdir3/tree/cur/root0 | 0 {src => lib}/tests/testdir3/tree/cur/root1 | 0 {src => lib}/tests/testdir3/tree/cur/root2 | 0 {src => lib}/tests/testdir3/tree/new/.noindex | 0 {src => lib}/tests/testdir3/tree/tmp/.noindex | 0 {src => mu}/mu-cmd-cfind.c | 0 {src => mu}/mu-cmd-extract.c | 0 {src => mu}/mu-cmd-find.c | 0 {src => mu}/mu-cmd-index.c | 0 {src => mu}/mu-cmd-server.c | 0 {src => mu}/mu-cmd.c | 0 {src => mu}/mu-cmd.h | 0 {src => mu}/mu-config.c | 0 {src => mu}/mu-config.h | 0 {src => mu}/mu.cc | 20 +++++- {src => mu}/tests/test-mu-cmd-cfind.c | 2 +- {src => mu}/tests/test-mu-cmd.c | 2 +- {src => mu}/tests/test-mu-contacts.c | 37 +++++----- {src => mu}/tests/test-mu-query.c | 6 +- {src => mu}/tests/test-mu-runtime.c | 0 {src => mu}/tests/test-mu-threads.c | 4 +- toys/msg2pdf/Makefile.am | 11 ++- toys/mug/Makefile.am | 7 +- toys/mug/mug-msg-list-view.c | 2 +- toys/mug2/Makefile.am | 5 +- widgets/Makefile.am | 5 +- widgets/mu-msg-attach-view.c | 2 +- widgets/mu-msg-attach-view.h | 3 +- widgets/mu-msg-header-view.c | 4 +- widgets/mu-msg-view.c | 2 +- 143 files changed, 160 insertions(+), 279 deletions(-) rename {src => lib}/Makefile.am (87%) rename {src => lib}/mu-bookmarks.c (100%) rename {src => lib}/mu-bookmarks.h (100%) rename {src => lib}/mu-contacts.c (100%) rename {src => lib}/mu-contacts.h (100%) rename {src => lib}/mu-container.c (100%) rename {src => lib}/mu-container.h (100%) rename {src => lib}/mu-date.c (100%) rename {src => lib}/mu-date.h (100%) rename {src => lib}/mu-flags.c (100%) rename {src => lib}/mu-flags.h (100%) rename {src => lib}/mu-index.c (100%) rename {src => lib}/mu-index.h (100%) rename {src => lib}/mu-log.c (100%) rename {src => lib}/mu-log.h (100%) rename {src => lib}/mu-maildir.c (100%) rename {src => lib}/mu-maildir.h (100%) rename {src => lib}/mu-msg-cache.c (100%) rename {src => lib}/mu-msg-cache.h (100%) rename {src => lib}/mu-msg-doc.cc (100%) rename {src => lib}/mu-msg-doc.h (100%) rename {src => lib}/mu-msg-fields.c (100%) rename {src => lib}/mu-msg-fields.h (100%) rename {src => lib}/mu-msg-file.c (100%) rename {src => lib}/mu-msg-file.h (100%) rename {src => lib}/mu-msg-iter.cc (100%) rename {src => lib}/mu-msg-iter.h (100%) rename {src => lib}/mu-msg-part.c (100%) rename {src => lib}/mu-msg-part.h (100%) rename {src => lib}/mu-msg-prio.c (100%) rename {src => lib}/mu-msg-prio.h (100%) rename {src => lib}/mu-msg-priv.h (100%) rename {src => lib}/mu-msg-sexp.c (92%) rename {src => lib}/mu-msg.c (100%) rename {src => lib}/mu-msg.h (100%) rename {src => lib}/mu-query.cc (100%) rename {src => lib}/mu-query.h (100%) rename {src => lib}/mu-runtime.c (80%) rename {src => lib}/mu-runtime.h (91%) rename {src => lib}/mu-store-priv.hh (100%) rename {src => lib}/mu-store-read.cc (100%) rename {src => lib}/mu-store-write.cc (100%) rename {src => lib}/mu-store.cc (100%) rename {src => lib}/mu-store.h (100%) rename {src => lib}/mu-str-normalize.c (100%) rename {src => lib}/mu-str.c (100%) rename {src => lib}/mu-str.h (99%) rename {src => lib}/mu-threader.c (100%) rename {src => lib}/mu-threader.h (100%) rename {src => lib}/mu-util.c (100%) rename {src => lib}/mu-util.h (100%) rename {src => lib}/tests/Makefile.am (68%) rename {src => lib}/tests/dummy.cc (100%) rename {src => lib}/tests/test-mu-common.c (100%) rename {src => lib}/tests/test-mu-common.h (100%) rename {src => lib}/tests/test-mu-date.c (94%) rename {src => lib}/tests/test-mu-flags.c (99%) rename {src => lib}/tests/test-mu-maildir.c (99%) rename {src => lib}/tests/test-mu-msg-fields.c (96%) rename {src => lib}/tests/test-mu-msg.c (99%) rename {src => lib}/tests/test-mu-store.c (99%) rename {src => lib}/tests/test-mu-str.c (99%) rename {src => lib}/tests/test-mu-util.c (99%) rename {src => lib}/tests/testdir/cur/1220863042.12663_1.mindcrime!2,S (100%) rename {src => lib}/tests/testdir/cur/1220863060.12663_3.mindcrime!2,S (100%) rename {src => lib}/tests/testdir/cur/1220863087.12663_15.mindcrime!2,PS (100%) rename {src => lib}/tests/testdir/cur/1220863087.12663_19.mindcrime!2,S (100%) rename {src => lib}/tests/testdir/cur/1220863087.12663_5.mindcrime!2,S (100%) rename {src => lib}/tests/testdir/cur/1220863087.12663_7.mindcrime!2,RS (100%) rename {src => lib}/tests/testdir/cur/1252168370_3.14675.cthulhu!2,S (100%) rename {src => lib}/tests/testdir/cur/1283599333.1840_11.cthulhu!2, (100%) rename {src => lib}/tests/testdir/cur/1305664394.2171_402.cthulhu!2, (100%) rename {src => lib}/tests/testdir/cur/encrypted!2,S (100%) rename {src => lib}/tests/testdir/cur/signed!2,S (100%) rename {src => lib}/tests/testdir/cur/signed-encrypted!2,S (100%) rename {src => lib}/tests/testdir/new/1220863087.12663_21.mindcrime (100%) rename {src => lib}/tests/testdir/new/1220863087.12663_23.mindcrime (100%) rename {src => lib}/tests/testdir/new/1220863087.12663_25.mindcrime (100%) rename {src => lib}/tests/testdir/new/1220863087.12663_9.mindcrime (100%) rename {src => lib}/tests/testdir/tmp/1220863087.12663.ignore (100%) rename {src => lib}/tests/testdir2/Foo/cur/arto.eml (100%) rename {src => lib}/tests/testdir2/Foo/cur/mail5 (100%) rename {src => lib}/tests/testdir2/Foo/new/.noindex (100%) rename {src => lib}/tests/testdir2/Foo/tmp/.noindex (100%) rename {src => lib}/tests/testdir2/bar/cur/181736.eml (100%) rename {src => lib}/tests/testdir2/bar/cur/mail1 (100%) rename {src => lib}/tests/testdir2/bar/cur/mail2 (100%) rename {src => lib}/tests/testdir2/bar/cur/mail3 (100%) rename {src => lib}/tests/testdir2/bar/cur/mail4 (100%) rename {src => lib}/tests/testdir2/bar/cur/mail5 (100%) rename {src => lib}/tests/testdir2/bar/cur/mail6 (100%) rename {src => lib}/tests/testdir2/bar/new/.noindex (100%) rename {src => lib}/tests/testdir2/bar/tmp/.noindex (100%) rename {src => lib}/tests/testdir2/wom_bat/cur/atomic (100%) rename {src => lib}/tests/testdir2/wom_bat/cur/rfc822.1 (100%) rename {src => lib}/tests/testdir2/wom_bat/cur/rfc822.2 (100%) rename {src => lib}/tests/testdir3/cycle/cur/cycle0 (100%) rename {src => lib}/tests/testdir3/cycle/cur/cycle0.0 (100%) rename {src => lib}/tests/testdir3/cycle/cur/cycle0.0.0 (100%) rename {src => lib}/tests/testdir3/cycle/cur/rogue0 (100%) rename {src => lib}/tests/testdir3/cycle/new/.noindex (100%) rename {src => lib}/tests/testdir3/cycle/tmp/.noindex (100%) rename {src => lib}/tests/testdir3/tree/cur/child0.0 (100%) rename {src => lib}/tests/testdir3/tree/cur/child0.1 (100%) rename {src => lib}/tests/testdir3/tree/cur/child0.1.0 (100%) rename {src => lib}/tests/testdir3/tree/cur/child2.0.0 (100%) rename {src => lib}/tests/testdir3/tree/cur/child3.0.0.0.0 (100%) rename {src => lib}/tests/testdir3/tree/cur/child4.0 (100%) rename {src => lib}/tests/testdir3/tree/cur/child4.1 (100%) rename {src => lib}/tests/testdir3/tree/cur/root0 (100%) rename {src => lib}/tests/testdir3/tree/cur/root1 (100%) rename {src => lib}/tests/testdir3/tree/cur/root2 (100%) rename {src => lib}/tests/testdir3/tree/new/.noindex (100%) rename {src => lib}/tests/testdir3/tree/tmp/.noindex (100%) rename {src => mu}/mu-cmd-cfind.c (100%) rename {src => mu}/mu-cmd-extract.c (100%) rename {src => mu}/mu-cmd-find.c (100%) rename {src => mu}/mu-cmd-index.c (100%) rename {src => mu}/mu-cmd-server.c (100%) rename {src => mu}/mu-cmd.c (100%) rename {src => mu}/mu-cmd.h (100%) rename {src => mu}/mu-config.c (100%) rename {src => mu}/mu-config.h (100%) rename {src => mu}/mu.cc (83%) rename {src => mu}/tests/test-mu-cmd-cfind.c (99%) rename {src => mu}/tests/test-mu-cmd.c (99%) rename {src => mu}/tests/test-mu-contacts.c (97%) rename {src => mu}/tests/test-mu-query.c (99%) rename {src => mu}/tests/test-mu-runtime.c (100%) rename {src => mu}/tests/test-mu-threads.c (99%) diff --git a/Makefile.am b/Makefile.am index 73ef0033..35677343 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ else emacs= endif -SUBDIRS=m4 man src $(widgets) $(guile) $(emacs) contrib toys +SUBDIRS=m4 man lib $(widgets) $(guile) mu $(emacs) contrib toys ACLOCAL_AMFLAGS=-I m4 diff --git a/configure.ac b/configure.ac index 3491fc9c..9a64f70a 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,7 @@ AC_INIT([mu],[0.9.8.5-dev2],[http://code.google.com/p/mu0/issues/list],[mu]) AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_SRCDIR([src/mu.cc]) +AC_CONFIG_SRCDIR([mu/mu.cc]) # libtoolize wants to put some stuff in here; if you have an old # autotools/libtool setup. you can try to comment this out AC_CONFIG_MACRO_DIR([m4]) @@ -291,8 +291,10 @@ AS_IF([test "x$PMCCABE" = "xno"],[ AC_CONFIG_FILES([ Makefile -src/Makefile -src/tests/Makefile +mu/Makefile +mu/tests/Makefile +lib/Makefile +lib/tests/Makefile widgets/Makefile emacs/Makefile emacs/mu4e-meta.el diff --git a/guile/Makefile.am b/guile/Makefile.am index be6758f6..90462e7b 100644 --- a/guile/Makefile.am +++ b/guile/Makefile.am @@ -25,7 +25,7 @@ AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter # note, we need top_builddir for snarfing with 'make distcheck' (ie., # with separate builddir) SUBDIRS= . mu examples -INCLUDES=-I. -I${top_builddir} -I${top_srcdir}/src ${GUILE_CFLAGS} ${GLIB_CFLAGS} +INCLUDES=-I. -I${top_builddir} -I${top_srcdir}/lib ${GUILE_CFLAGS} ${GLIB_CFLAGS} # don't use -Werror, as it might break on other compilers # use -Wno-unused-parameters, because some callbacks may not @@ -41,7 +41,7 @@ libguile_mu_la_SOURCES= \ mu-guile-message.h libguile_mu_la_LIBADD= \ - ${top_builddir}/src/libmu.la \ + ${top_builddir}/lib/libmu.la \ ${GUILE_LIBS} XFILES= \ diff --git a/guile/mu-guile-message.c b/guile/mu-guile-message.c index e7d0fc1e..a387d21e 100644 --- a/guile/mu-guile-message.c +++ b/guile/mu-guile-message.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 2011 Dirk-Jan C. Binnema +** Copyright (C) 2011-2012 Dirk-Jan C. Binnema ** ** 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 diff --git a/src/Makefile.am b/lib/Makefile.am similarity index 87% rename from src/Makefile.am rename to lib/Makefile.am index 8f203294..35e2fc06 100644 --- a/src/Makefile.am +++ b/lib/Makefile.am @@ -32,32 +32,12 @@ INCLUDES=$(XAPIAN_CXXFLAGS) $(GMIME_CFLAGS) $(GLIB_CFLAGS) AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement -pedantic -Wno-variadic-macros AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter -bin_PROGRAMS= \ - mu - noinst_LTLIBRARIES= \ libmu.la -# note, mu.cc is only '.cc' and not '.c' because libmu must explicitly -# be linked as c++, not c. -mu_SOURCES= \ - mu.cc - -mu_LDADD= \ - libmu.la - libmu_la_SOURCES= \ mu-bookmarks.c \ mu-bookmarks.h \ - mu-cmd-cfind.c \ - mu-cmd-extract.c \ - mu-cmd-find.c \ - mu-cmd-index.c \ - mu-cmd-server.c \ - mu-cmd.c \ - mu-cmd.h \ - mu-config.c \ - mu-config.h \ mu-contacts.c \ mu-contacts.h \ mu-container.c \ diff --git a/src/mu-bookmarks.c b/lib/mu-bookmarks.c similarity index 100% rename from src/mu-bookmarks.c rename to lib/mu-bookmarks.c diff --git a/src/mu-bookmarks.h b/lib/mu-bookmarks.h similarity index 100% rename from src/mu-bookmarks.h rename to lib/mu-bookmarks.h diff --git a/src/mu-contacts.c b/lib/mu-contacts.c similarity index 100% rename from src/mu-contacts.c rename to lib/mu-contacts.c diff --git a/src/mu-contacts.h b/lib/mu-contacts.h similarity index 100% rename from src/mu-contacts.h rename to lib/mu-contacts.h diff --git a/src/mu-container.c b/lib/mu-container.c similarity index 100% rename from src/mu-container.c rename to lib/mu-container.c diff --git a/src/mu-container.h b/lib/mu-container.h similarity index 100% rename from src/mu-container.h rename to lib/mu-container.h diff --git a/src/mu-date.c b/lib/mu-date.c similarity index 100% rename from src/mu-date.c rename to lib/mu-date.c diff --git a/src/mu-date.h b/lib/mu-date.h similarity index 100% rename from src/mu-date.h rename to lib/mu-date.h diff --git a/src/mu-flags.c b/lib/mu-flags.c similarity index 100% rename from src/mu-flags.c rename to lib/mu-flags.c diff --git a/src/mu-flags.h b/lib/mu-flags.h similarity index 100% rename from src/mu-flags.h rename to lib/mu-flags.h diff --git a/src/mu-index.c b/lib/mu-index.c similarity index 100% rename from src/mu-index.c rename to lib/mu-index.c diff --git a/src/mu-index.h b/lib/mu-index.h similarity index 100% rename from src/mu-index.h rename to lib/mu-index.h diff --git a/src/mu-log.c b/lib/mu-log.c similarity index 100% rename from src/mu-log.c rename to lib/mu-log.c diff --git a/src/mu-log.h b/lib/mu-log.h similarity index 100% rename from src/mu-log.h rename to lib/mu-log.h diff --git a/src/mu-maildir.c b/lib/mu-maildir.c similarity index 100% rename from src/mu-maildir.c rename to lib/mu-maildir.c diff --git a/src/mu-maildir.h b/lib/mu-maildir.h similarity index 100% rename from src/mu-maildir.h rename to lib/mu-maildir.h diff --git a/src/mu-msg-cache.c b/lib/mu-msg-cache.c similarity index 100% rename from src/mu-msg-cache.c rename to lib/mu-msg-cache.c diff --git a/src/mu-msg-cache.h b/lib/mu-msg-cache.h similarity index 100% rename from src/mu-msg-cache.h rename to lib/mu-msg-cache.h diff --git a/src/mu-msg-doc.cc b/lib/mu-msg-doc.cc similarity index 100% rename from src/mu-msg-doc.cc rename to lib/mu-msg-doc.cc diff --git a/src/mu-msg-doc.h b/lib/mu-msg-doc.h similarity index 100% rename from src/mu-msg-doc.h rename to lib/mu-msg-doc.h diff --git a/src/mu-msg-fields.c b/lib/mu-msg-fields.c similarity index 100% rename from src/mu-msg-fields.c rename to lib/mu-msg-fields.c diff --git a/src/mu-msg-fields.h b/lib/mu-msg-fields.h similarity index 100% rename from src/mu-msg-fields.h rename to lib/mu-msg-fields.h diff --git a/src/mu-msg-file.c b/lib/mu-msg-file.c similarity index 100% rename from src/mu-msg-file.c rename to lib/mu-msg-file.c diff --git a/src/mu-msg-file.h b/lib/mu-msg-file.h similarity index 100% rename from src/mu-msg-file.h rename to lib/mu-msg-file.h diff --git a/src/mu-msg-iter.cc b/lib/mu-msg-iter.cc similarity index 100% rename from src/mu-msg-iter.cc rename to lib/mu-msg-iter.cc diff --git a/src/mu-msg-iter.h b/lib/mu-msg-iter.h similarity index 100% rename from src/mu-msg-iter.h rename to lib/mu-msg-iter.h diff --git a/src/mu-msg-part.c b/lib/mu-msg-part.c similarity index 100% rename from src/mu-msg-part.c rename to lib/mu-msg-part.c diff --git a/src/mu-msg-part.h b/lib/mu-msg-part.h similarity index 100% rename from src/mu-msg-part.h rename to lib/mu-msg-part.h diff --git a/src/mu-msg-prio.c b/lib/mu-msg-prio.c similarity index 100% rename from src/mu-msg-prio.c rename to lib/mu-msg-prio.c diff --git a/src/mu-msg-prio.h b/lib/mu-msg-prio.h similarity index 100% rename from src/mu-msg-prio.h rename to lib/mu-msg-prio.h diff --git a/src/mu-msg-priv.h b/lib/mu-msg-priv.h similarity index 100% rename from src/mu-msg-priv.h rename to lib/mu-msg-priv.h diff --git a/src/mu-msg-sexp.c b/lib/mu-msg-sexp.c similarity index 92% rename from src/mu-msg-sexp.c rename to lib/mu-msg-sexp.c index 8363027c..a7fb39e3 100644 --- a/src/mu-msg-sexp.c +++ b/lib/mu-msg-sexp.c @@ -229,6 +229,15 @@ struct _PartInfo { typedef struct _PartInfo PartInfo; +/* like the elvis operator, + * http://colinharrington.net/blog/2008/10/groovy-elvis-operator/ + */ +static const char* +elvis (const char *s1, const char *s2) +{ + return s1 ? s1 : s2; +} + static void each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo) { @@ -236,34 +245,31 @@ each_part (MuMsg *msg, MuMsgPart *part, PartInfo *pinfo) char *name, *tmp; char *tmpfile; - fname = mu_msg_part_file_name (part); - if (!fname) + if (!(fname = mu_msg_part_file_name (part))) fname = mu_msg_part_description (part); - if (fname) name = mu_str_escape_c_literal (fname, TRUE); else - name = g_strdup_printf - ("\"%s-%s-%d\"", - part->type ? part->type : "application", - part->subtype ? part->subtype : "octet-stream", - part->index); + name = g_strdup_printf ("\"%s-%s-%d\"", + elvis (part->type, "application"), + elvis (part->subtype, "octet-stream"), + part->index); tmpfile = NULL; if (pinfo->want_images && g_ascii_strcasecmp (part->type, "image") == 0) { char *tmp; - tmp = get_temp_file (msg, part->index); - if (tmp) { + if ((tmp = get_temp_file (msg, part->index))) { tmpfile = mu_str_escape_c_literal (tmp, TRUE); g_free (tmp); } } tmp = g_strdup_printf - ("%s(:index %d :name %s :mime-type \"%s/%s\"%s%s :attachment %s :size %i)", - pinfo->parts ? pinfo->parts : "", part->index, name, - part->type ? part->type : "application", - part->subtype ? part->subtype : "octet-stream", + ("%s(:index %d :name %s :mime-type \"%s/%s\"%s%s " + ":attachment %s :size %i)", + elvis (pinfo->parts, ""), part->index, name, + elvis (part->type, "application"), + elvis (part->subtype, "octet-stream"), tmpfile ? " :temp" : "", tmpfile ? tmpfile : "", mu_msg_part_looks_like_attachment (part, TRUE) ? "t" : "nil", (int)part->size); @@ -338,10 +344,6 @@ mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti, if (docid != 0) g_string_append_printf (gstr, "\t:docid %u\n", docid); - if (!header_only) /* force loading of file... should do this a bit - * more elegantly */ - mu_msg_get_header (msg, "Reply-To"); - append_sexp_contacts (gstr, msg); if (ti) @@ -351,8 +353,7 @@ mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti, t = mu_msg_get_date (msg); /* weird time format for emacs 29-bit ints...*/ - g_string_append_printf (gstr, - "\t:date (%u %u 0)\n", (unsigned)(t >> 16), + g_string_append_printf (gstr,"\t:date (%u %u 0)\n", (unsigned)(t >> 16), (unsigned)(t & 0xffff)); g_string_append_printf (gstr, "\t:size %u\n", (unsigned) mu_msg_get_size (msg)); @@ -366,7 +367,6 @@ mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti, append_sexp_flags (gstr, msg); /* headers are retrieved from the database, views from the message file - * * file attr things can only be gotten from the file (ie., mu * view), not from the database (mu find). */ if (!header_only) { @@ -375,6 +375,5 @@ mu_msg_to_sexp (MuMsg *msg, unsigned docid, const MuMsgIterThreadInfo *ti, } g_string_append (gstr, ")\n"); - return g_string_free (gstr, FALSE); } diff --git a/src/mu-msg.c b/lib/mu-msg.c similarity index 100% rename from src/mu-msg.c rename to lib/mu-msg.c diff --git a/src/mu-msg.h b/lib/mu-msg.h similarity index 100% rename from src/mu-msg.h rename to lib/mu-msg.h diff --git a/src/mu-query.cc b/lib/mu-query.cc similarity index 100% rename from src/mu-query.cc rename to lib/mu-query.cc diff --git a/src/mu-query.h b/lib/mu-query.h similarity index 100% rename from src/mu-query.h rename to lib/mu-query.h diff --git a/src/mu-runtime.c b/lib/mu-runtime.c similarity index 80% rename from src/mu-runtime.c rename to lib/mu-runtime.c index 23607383..18df1ccf 100644 --- a/src/mu-runtime.c +++ b/lib/mu-runtime.c @@ -26,9 +26,7 @@ #include #include #include -#include - -#include "mu-config.h" +#include "mu-msg.h" #include "mu-log.h" #include "mu-util.h" @@ -41,7 +39,6 @@ struct _MuRuntimeData { gchar *_str[MU_RUNTIME_PATH_NUM]; - MuConfig *_config; gchar *_name; /* e.g., 'mu', 'mug' */ }; typedef struct _MuRuntimeData MuRuntimeData; @@ -116,48 +113,6 @@ mu_runtime_init (const char* muhome_arg, const char *name) return _initialized = TRUE; } - - -gboolean -mu_runtime_init_from_cmdline (int *pargc, char ***pargv, const char *name) -{ - g_return_val_if_fail (!_initialized, FALSE); - g_return_val_if_fail (name, FALSE); - - setlocale (LC_ALL, ""); - g_type_init (); - - _data = g_new0 (MuRuntimeData, 1); - _data->_config = mu_config_init (pargc, pargv); - if (!_data->_config) { - runtime_free (); - return FALSE; - } - - if (!mu_util_create_dir_maybe (_data->_config->muhome, 0700, TRUE)) { - g_printerr ("mu: invalid mu homedir specified;" - " use --muhome=\n"); - runtime_free (); - return FALSE; - } - - _data->_name = g_strdup (name); - _data->_str[MU_RUNTIME_PATH_MUHOME] = - g_strdup (_data->_config->muhome); - init_paths (_data->_str[MU_RUNTIME_PATH_MUHOME], _data); - - if (!init_log (runtime_path(MU_RUNTIME_PATH_MUHOME), name, - _data->_config->log_stderr, - _data->_config->quiet, - _data->_config->debug)) { - runtime_free (); - return FALSE; - } - - return _initialized = TRUE; -} - - static void runtime_free (void) { @@ -168,7 +123,7 @@ runtime_free (void) g_free (_data->_name); - mu_config_uninit (_data->_config); + /* mu_config_uninit (_data->_config); */ mu_log_uninit(); @@ -252,10 +207,3 @@ mu_runtime_path (MuRuntimePath path) return runtime_path (path); } - -MuConfig* -mu_runtime_config (void) -{ - g_return_val_if_fail (_initialized, NULL); - return _data->_config; -} diff --git a/src/mu-runtime.h b/lib/mu-runtime.h similarity index 91% rename from src/mu-runtime.h rename to lib/mu-runtime.h index 9c3a9421..af52862f 100644 --- a/src/mu-runtime.h +++ b/lib/mu-runtime.h @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- -** +** ** Copyright (C) 2010 Dirk-Jan C. Binnema ** ** This program is free software; you can redistribute it and/or modify it @@ -21,18 +21,17 @@ #define __MU_RUNTIME_H__ #include -#include G_BEGIN_DECLS /** * initialize the mu runtime system; initializes logging and other * systems. To uninitialize, use mu_runtime_uninit - * - * @param muhome path where to find the mu home directory (typicaly, ~/.mu) + * + * @param muhome path where to find the mu home directory (typicaly, ~/.mu) * @param name of the main program, ie. 'mu', 'mug' or * 'procmule'. this influences the name of the e.g. the logfile - * + * * @return TRUE if succeeded, FALSE in case of error */ gboolean mu_runtime_init (const char *muhome, const char *name); @@ -43,12 +42,12 @@ gboolean mu_runtime_init (const char *muhome, const char *name); * will parse the command line assuming the parameters of the 'mu' * program. Initializes logging and other systems. To uninitialize, * use mu_runtime_uninit - * + * * @param ptr to the param count (typically, argc) * @param ptr to the params (typically, argv) * @param name of the main program, ie. 'mu', 'mug' or * 'procmule'. this influences the name of the e.g. the logfile - * + * * @return TRUE if succeeded, FALSE in case of error */ gboolean mu_runtime_init_from_cmdline (int *pargc, char ***pargv, @@ -56,8 +55,8 @@ gboolean mu_runtime_init_from_cmdline (int *pargc, char ***pargv, /** - * free all resources - * + * free all resources + * */ void mu_runtime_uninit (void); @@ -76,21 +75,12 @@ typedef enum _MuRuntimePath MuRuntimePath; /** * get a file system path to some 'special' file or directory - * + * * @return ma string which should be not be modified/freed, or NULL in * case of error. */ const char* mu_runtime_path (MuRuntimePath path); - -/** - * get the mu configuration options (ie., the parsed command line - * parameters) - * - * @return the configuration options - */ -MuConfig* mu_runtime_config (void); - G_END_DECLS #endif /*__MU_RUNTIME_H__*/ diff --git a/src/mu-store-priv.hh b/lib/mu-store-priv.hh similarity index 100% rename from src/mu-store-priv.hh rename to lib/mu-store-priv.hh diff --git a/src/mu-store-read.cc b/lib/mu-store-read.cc similarity index 100% rename from src/mu-store-read.cc rename to lib/mu-store-read.cc diff --git a/src/mu-store-write.cc b/lib/mu-store-write.cc similarity index 100% rename from src/mu-store-write.cc rename to lib/mu-store-write.cc diff --git a/src/mu-store.cc b/lib/mu-store.cc similarity index 100% rename from src/mu-store.cc rename to lib/mu-store.cc diff --git a/src/mu-store.h b/lib/mu-store.h similarity index 100% rename from src/mu-store.h rename to lib/mu-store.h diff --git a/src/mu-str-normalize.c b/lib/mu-str-normalize.c similarity index 100% rename from src/mu-str-normalize.c rename to lib/mu-str-normalize.c diff --git a/src/mu-str.c b/lib/mu-str.c similarity index 100% rename from src/mu-str.c rename to lib/mu-str.c diff --git a/src/mu-str.h b/lib/mu-str.h similarity index 99% rename from src/mu-str.h rename to lib/mu-str.h index 6cae11bd..79f9613c 100644 --- a/src/mu-str.h +++ b/lib/mu-str.h @@ -25,8 +25,8 @@ #include #include -#include -#include +#include "lib/mu-msg.h" +#include "lib/mu-flags.h" G_BEGIN_DECLS diff --git a/src/mu-threader.c b/lib/mu-threader.c similarity index 100% rename from src/mu-threader.c rename to lib/mu-threader.c diff --git a/src/mu-threader.h b/lib/mu-threader.h similarity index 100% rename from src/mu-threader.h rename to lib/mu-threader.h diff --git a/src/mu-util.c b/lib/mu-util.c similarity index 100% rename from src/mu-util.c rename to lib/mu-util.c diff --git a/src/mu-util.h b/lib/mu-util.h similarity index 100% rename from src/mu-util.h rename to lib/mu-util.h diff --git a/src/tests/Makefile.am b/lib/tests/Makefile.am similarity index 68% rename from src/tests/Makefile.am rename to lib/tests/Makefile.am index c2de2022..7765ed08 100644 --- a/src/tests/Makefile.am +++ b/lib/tests/Makefile.am @@ -19,11 +19,11 @@ include $(top_srcdir)/gtest.mk INCLUDES=$(XAPIAN_CXXFLAGS) \ $(GMIME_CFLAGS) \ $(GLIB_CFLAGS) \ - -I ${top_srcdir} -I ${top_srcdir}/src \ + -I ${top_srcdir} \ + -I ${top_srcdir}/lib \ -DMU_TESTMAILDIR=\"${abs_srcdir}/testdir\" \ -DMU_TESTMAILDIR2=\"${abs_srcdir}/testdir2\" \ -DMU_TESTMAILDIR3=\"${abs_srcdir}/testdir3\" \ - -DMU_PROGRAM=\"${abs_top_builddir}/src/mu\" \ -DABS_CURDIR=\"${abs_builddir}\" \ -DABS_SRCDIR=\"${abs_srcdir}\" @@ -53,39 +53,14 @@ TEST_PROGS += test-mu-msg-fields test_mu_msg_fields_SOURCES= test-mu-msg-fields.c dummy.cc test_mu_msg_fields_LDADD= libtestmucommon.la -TEST_PROGS += test-mu-query -test_mu_query_SOURCES= test-mu-query.c dummy.cc -test_mu_query_LDADD= libtestmucommon.la - -TEST_PROGS += test-mu-contacts -test_mu_contacts_SOURCES= test-mu-contacts.c dummy.cc -test_mu_contacts_LDADD= libtestmucommon.la - -TEST_PROGS += test-mu-cmd -test_mu_cmd_SOURCES= test-mu-cmd.c dummy.cc -test_mu_cmd_LDADD= libtestmucommon.la - -TEST_PROGS += test-mu-cmd-cfind -test_mu_cmd_cfind_SOURCES= test-mu-cmd-cfind.c dummy.cc -test_mu_cmd_cfind_LDADD= libtestmucommon.la - - TEST_PROGS += test-mu-msg test_mu_msg_SOURCES= test-mu-msg.c dummy.cc test_mu_msg_LDADD= libtestmucommon.la -TEST_PROGS += test-mu-runtime -test_mu_runtime_SOURCES= test-mu-runtime.c dummy.cc -test_mu_runtime_LDADD= libtestmucommon.la - TEST_PROGS += test-mu-store test_mu_store_SOURCES= test-mu-store.c dummy.cc test_mu_store_LDADD= libtestmucommon.la -TEST_PROGS += test-mu-threads -test_mu_threads_SOURCES= test-mu-threads.c dummy.cc -test_mu_threads_LDADD= libtestmucommon.la - TEST_PROGS += test-mu-date test_mu_date_SOURCES= test-mu-date.c dummy.cc test_mu_date_LDADD= libtestmucommon.la @@ -94,22 +69,27 @@ TEST_PROGS += test-mu-flags test_mu_flags_SOURCES= test-mu-flags.c dummy.cc test_mu_flags_LDADD= libtestmucommon.la +# we need to use dummy.cc to enforce c++ linking... +BUILT_SOURCES= \ + dummy.cc + +dummy.cc: + touch dummy.cc -# TEST_PROGS += test-mu-msg-file -# test_mu_msg_file_SOURCES= test-mu-msg-file.c dummy.cc -# test_mu_msg_file_LDADD= libtestmucommon.la -# libtestmucommon_la_SOURCES= \ test-mu-common.c \ test-mu-common.h libtestmucommon_la_LIBADD= ../libmu.la + + + # note the question marks; make does not like files with ':', so we # use the (also supported) version with '!' instead. We could escape # the : with \: but automake does not recognize that.... -# 12 messages, the '.ignore' message should be ignored +# test messages, the '.ignore' message should be ignored # when indexing EXTRA_DIST= \ testdir/tmp/1220863087.12663.ignore \ @@ -145,30 +125,4 @@ EXTRA_DIST= \ testdir2/Foo/new/.noindex \ testdir2/wom_bat/cur/atomic \ testdir2/wom_bat/cur/rfc822.1 \ - testdir2/wom_bat/cur/rfc822.2 \ - testdir3/tree \ - testdir3/tree/new \ - testdir3/tree/new/.noindex \ - testdir3/tree/cur \ - testdir3/tree/cur/child0.1 \ - testdir3/tree/cur/root1 \ - testdir3/tree/cur/child3.0.0.0.0 \ - testdir3/tree/cur/child0.0 \ - testdir3/tree/cur/child4.1 \ - testdir3/tree/cur/child4.0 \ - testdir3/tree/cur/root2 \ - testdir3/tree/cur/child0.1.0 \ - testdir3/tree/cur/child2.0.0 \ - testdir3/tree/cur/root0 \ - testdir3/tree/tmp \ - testdir3/tree/tmp/.noindex \ - testdir3/cycle \ - testdir3/cycle/new \ - testdir3/cycle/new/.noindex \ - testdir3/cycle/cur \ - testdir3/cycle/cur/rogue0 \ - testdir3/cycle/cur/cycle0 \ - testdir3/cycle/cur/cycle0.0.0 \ - testdir3/cycle/cur/cycle0.0 \ - testdir3/cycle/tmp \ - testdir3/cycle/tmp/.noindex + testdir2/wom_bat/cur/rfc822.2 diff --git a/src/tests/dummy.cc b/lib/tests/dummy.cc similarity index 100% rename from src/tests/dummy.cc rename to lib/tests/dummy.cc diff --git a/src/tests/test-mu-common.c b/lib/tests/test-mu-common.c similarity index 100% rename from src/tests/test-mu-common.c rename to lib/tests/test-mu-common.c diff --git a/src/tests/test-mu-common.h b/lib/tests/test-mu-common.h similarity index 100% rename from src/tests/test-mu-common.h rename to lib/tests/test-mu-common.h diff --git a/src/tests/test-mu-date.c b/lib/tests/test-mu-date.c similarity index 94% rename from src/tests/test-mu-date.c rename to lib/tests/test-mu-date.c index 2ebab26c..a47ffa90 100644 --- a/src/tests/test-mu-date.c +++ b/lib/tests/test-mu-date.c @@ -1,6 +1,6 @@ /* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/ -/* +/* ** Copyright (C) 2008-2010 Dirk-Jan C. Binnema ** ** This program is free software; you can redistribute it and/or modify it @@ -15,8 +15,8 @@ ** ** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -** +** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +** */ #if HAVE_CONFIG_H @@ -31,7 +31,7 @@ #include #include "test-mu-common.h" -#include "src/mu-date.h" +#include "mu-date.h" static void @@ -41,7 +41,7 @@ test_mu_date_str (void) char buf[64]; gchar *tmp; time_t some_time; - + some_time = 1234567890; tmbuf = localtime (&some_time); strftime (buf, 64, "%x", tmbuf); @@ -54,9 +54,9 @@ test_mu_date_str (void) tmbuf = localtime (&some_time); strftime (buf, 64, "%c", tmbuf); tmp = mu_date_str ("%c", some_time); - + g_assert_cmpstr (tmp, ==, buf); - g_free (tmp); + g_free (tmp); } @@ -73,7 +73,7 @@ test_mu_date_parse_hdwmy (void) diff = time(NULL) - mu_date_parse_hdwmy ("5y"); g_assert (diff > 0); g_assert_cmpuint (5 * 365 * 24 * 60 * 60 - diff, <=, 1); - + diff = time(NULL) - mu_date_parse_hdwmy ("3m"); g_assert (diff > 0); g_assert_cmpuint (3 * 30 * 24 * 60 * 60 - diff, <=, 1); @@ -81,13 +81,13 @@ test_mu_date_parse_hdwmy (void) diff = time(NULL) - mu_date_parse_hdwmy ("21d"); g_assert (diff > 0); g_assert_cmpuint (21 * 24 * 60 * 60 - diff, <=, 1); - + diff = time(NULL) - mu_date_parse_hdwmy ("2w"); g_assert (diff > 0); g_assert_cmpuint (2 * 7 * 24 * 60 * 60 - diff, <=, 1); - - - g_assert_cmpint (mu_date_parse_hdwmy("-1y"),==, (time_t)-1); + + + g_assert_cmpint (mu_date_parse_hdwmy("-1y"),==, (time_t)-1); } @@ -95,9 +95,9 @@ static void test_mu_date_complete_begin (void) { g_assert_cmpstr (mu_date_complete_s("2000", TRUE), ==, - "20000101000000"); + "20000101000000"); g_assert_cmpstr (mu_date_complete_s("2", TRUE), ==, - "20000101000000"); + "20000101000000"); g_assert_cmpstr (mu_date_complete_s ("", TRUE), ==, "00000101000000"); g_assert_cmpstr (mu_date_complete_s ("201007", TRUE), ==, @@ -113,9 +113,9 @@ static void test_mu_date_complete_end (void) { g_assert_cmpstr (mu_date_complete_s ("2000", FALSE), ==, - "20001231235959"); + "20001231235959"); g_assert_cmpstr (mu_date_complete_s ("2", FALSE), ==, - "29991231235959"); + "29991231235959"); g_assert_cmpstr (mu_date_complete_s ("", FALSE), ==, "99991231235959"); g_assert_cmpstr (mu_date_complete_s ("201007", FALSE), ==, @@ -134,7 +134,7 @@ test_mu_date_interpret_begin (void) { time_t now; now = time (NULL); - + g_assert_cmpstr (mu_date_interpret_s ("now", TRUE) , ==, mu_date_str_s("%Y%m%d%H%M%S", now)); @@ -147,7 +147,7 @@ test_mu_date_interpret_end (void) { time_t now; now = time (NULL); - + g_assert_cmpstr (mu_date_interpret_s ("now", FALSE) , ==, mu_date_str_s("%Y%m%d%H%M%S", now)); @@ -167,7 +167,7 @@ main (int argc, char *argv[]) /* mu_str_date */ g_test_add_func ("/mu-str/mu-date-str", test_mu_date_str); - + g_test_add_func ("/mu-str/mu_date_parse_hdwmy", test_mu_date_parse_hdwmy); g_test_add_func ("/mu-str/mu_date_complete_begin", @@ -180,10 +180,10 @@ main (int argc, char *argv[]) g_test_add_func ("/mu-str/mu_date_interpret_end", test_mu_date_interpret_end); - + g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, (GLogFunc)black_hole, NULL); - + return g_test_run (); } diff --git a/src/tests/test-mu-flags.c b/lib/tests/test-mu-flags.c similarity index 99% rename from src/tests/test-mu-flags.c rename to lib/tests/test-mu-flags.c index 43709933..b8c2a4e4 100644 --- a/src/tests/test-mu-flags.c +++ b/lib/tests/test-mu-flags.c @@ -23,7 +23,7 @@ #endif /*HAVE_CONFIG_H*/ #include -#include "src/mu-flags.h" +#include "mu-flags.h" #include "test-mu-common.h" diff --git a/src/tests/test-mu-maildir.c b/lib/tests/test-mu-maildir.c similarity index 99% rename from src/tests/test-mu-maildir.c rename to lib/tests/test-mu-maildir.c index bb187470..17889aaf 100644 --- a/src/tests/test-mu-maildir.c +++ b/lib/tests/test-mu-maildir.c @@ -29,8 +29,8 @@ #include #include "test-mu-common.h" -#include "src/mu-maildir.h" -#include "src/mu-util.h" +#include "mu-maildir.h" +#include "mu-util.h" static void test_mu_maildir_mkdir_01 (void) diff --git a/src/tests/test-mu-msg-fields.c b/lib/tests/test-mu-msg-fields.c similarity index 96% rename from src/tests/test-mu-msg-fields.c rename to lib/tests/test-mu-msg-fields.c index 29f7e0b6..2d8e7969 100644 --- a/src/tests/test-mu-msg-fields.c +++ b/lib/tests/test-mu-msg-fields.c @@ -1,4 +1,4 @@ -/* +/* ** Copyright (C) 2008-2010 Dirk-Jan C. Binnema ** ** This program is free software; you can redistribute it and/or modify it @@ -13,8 +13,8 @@ ** ** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -** +** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +** */ #if HAVE_CONFIG_H @@ -29,7 +29,7 @@ #include #include "test-mu-common.h" -#include "src/mu-msg-fields.h" +#include "mu-msg-fields.h" static void test_mu_msg_field_body (void) @@ -37,11 +37,11 @@ test_mu_msg_field_body (void) MuMsgFieldId field; field = MU_MSG_FIELD_ID_BODY_TEXT; - + g_assert_cmpstr (mu_msg_field_name(field),==, "body"); g_assert_cmpuint (mu_msg_field_shortcut(field),==, 'b'); g_assert_cmpuint (mu_msg_field_xapian_prefix(field),==, 'B'); - + g_assert_cmpuint (mu_msg_field_is_numeric(field), ==, FALSE); } @@ -51,11 +51,11 @@ test_mu_msg_field_subject (void) MuMsgFieldId field; field = MU_MSG_FIELD_ID_SUBJECT; - + g_assert_cmpstr (mu_msg_field_name(field),==, "subject"); g_assert_cmpuint (mu_msg_field_shortcut(field),==, 's'); g_assert_cmpuint (mu_msg_field_xapian_prefix(field),==, 'S'); - + g_assert_cmpuint (mu_msg_field_is_numeric(field), ==,FALSE); } @@ -65,7 +65,7 @@ test_mu_msg_field_to (void) MuMsgFieldId field; field = MU_MSG_FIELD_ID_TO; - + g_assert_cmpstr (mu_msg_field_name(field),==, "to"); g_assert_cmpuint (mu_msg_field_shortcut(field),==, 't'); g_assert_cmpuint (mu_msg_field_xapian_prefix(field),==, 'T'); @@ -80,7 +80,7 @@ test_mu_msg_field_prio (void) MuMsgFieldId field; field = MU_MSG_FIELD_ID_PRIO; - + g_assert_cmpstr (mu_msg_field_name(field),==, "prio"); g_assert_cmpuint (mu_msg_field_shortcut(field),==, 'p'); g_assert_cmpuint (mu_msg_field_xapian_prefix(field),==, 'P'); @@ -94,12 +94,12 @@ test_mu_msg_field_flags (void) MuMsgFieldId field; field = MU_MSG_FIELD_ID_FLAGS; - + g_assert_cmpstr (mu_msg_field_name(field),==, "flag"); g_assert_cmpuint (mu_msg_field_shortcut(field),==, 'g'); g_assert_cmpuint (mu_msg_field_xapian_prefix(field),==, 'G'); - g_assert_cmpuint (mu_msg_field_is_numeric(field),==, TRUE); + g_assert_cmpuint (mu_msg_field_is_numeric(field),==, TRUE); } @@ -124,11 +124,11 @@ main (int argc, char *argv[]) /* FIXME: add tests for mu_msg_str_flags; but note the * function simply calls mu_msg_field_str */ - + g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, (GLogFunc)black_hole, NULL); - + return g_test_run (); } diff --git a/src/tests/test-mu-msg.c b/lib/tests/test-mu-msg.c similarity index 99% rename from src/tests/test-mu-msg.c rename to lib/tests/test-mu-msg.c index 2b7129cb..780b2b52 100644 --- a/src/tests/test-mu-msg.c +++ b/lib/tests/test-mu-msg.c @@ -30,8 +30,8 @@ #include #include "test-mu-common.h" -#include "src/mu-msg.h" -#include "src/mu-str.h" +#include "mu-msg.h" +#include "mu-str.h" static gboolean check_contact_01 (MuMsgContact *contact, int *idx) diff --git a/src/tests/test-mu-store.c b/lib/tests/test-mu-store.c similarity index 99% rename from src/tests/test-mu-store.c rename to lib/tests/test-mu-store.c index 88554d41..6b15bf0a 100644 --- a/src/tests/test-mu-store.c +++ b/lib/tests/test-mu-store.c @@ -31,7 +31,7 @@ #include #include "test-mu-common.h" -#include "src/mu-store.h" +#include "mu-store.h" static void test_mu_store_new_destroy (void) diff --git a/src/tests/test-mu-str.c b/lib/tests/test-mu-str.c similarity index 99% rename from src/tests/test-mu-str.c rename to lib/tests/test-mu-str.c index fadb8882..83e2943a 100644 --- a/src/tests/test-mu-str.c +++ b/lib/tests/test-mu-str.c @@ -31,8 +31,8 @@ #include #include "test-mu-common.h" -#include "src/mu-str.h" -#include "src/mu-msg-prio.h" +#include "mu-str.h" +#include "mu-msg-prio.h" diff --git a/src/tests/test-mu-util.c b/lib/tests/test-mu-util.c similarity index 99% rename from src/tests/test-mu-util.c rename to lib/tests/test-mu-util.c index 7f4aed5b..56c1dda1 100644 --- a/src/tests/test-mu-util.c +++ b/lib/tests/test-mu-util.c @@ -29,7 +29,7 @@ #include #include "test-mu-common.h" -#include "src/mu-util.h" +#include "lib/mu-util.h" static void test_mu_util_dir_expand_00 (void) diff --git a/src/tests/testdir/cur/1220863042.12663_1.mindcrime!2,S b/lib/tests/testdir/cur/1220863042.12663_1.mindcrime!2,S similarity index 100% rename from src/tests/testdir/cur/1220863042.12663_1.mindcrime!2,S rename to lib/tests/testdir/cur/1220863042.12663_1.mindcrime!2,S diff --git a/src/tests/testdir/cur/1220863060.12663_3.mindcrime!2,S b/lib/tests/testdir/cur/1220863060.12663_3.mindcrime!2,S similarity index 100% rename from src/tests/testdir/cur/1220863060.12663_3.mindcrime!2,S rename to lib/tests/testdir/cur/1220863060.12663_3.mindcrime!2,S diff --git a/src/tests/testdir/cur/1220863087.12663_15.mindcrime!2,PS b/lib/tests/testdir/cur/1220863087.12663_15.mindcrime!2,PS similarity index 100% rename from src/tests/testdir/cur/1220863087.12663_15.mindcrime!2,PS rename to lib/tests/testdir/cur/1220863087.12663_15.mindcrime!2,PS diff --git a/src/tests/testdir/cur/1220863087.12663_19.mindcrime!2,S b/lib/tests/testdir/cur/1220863087.12663_19.mindcrime!2,S similarity index 100% rename from src/tests/testdir/cur/1220863087.12663_19.mindcrime!2,S rename to lib/tests/testdir/cur/1220863087.12663_19.mindcrime!2,S diff --git a/src/tests/testdir/cur/1220863087.12663_5.mindcrime!2,S b/lib/tests/testdir/cur/1220863087.12663_5.mindcrime!2,S similarity index 100% rename from src/tests/testdir/cur/1220863087.12663_5.mindcrime!2,S rename to lib/tests/testdir/cur/1220863087.12663_5.mindcrime!2,S diff --git a/src/tests/testdir/cur/1220863087.12663_7.mindcrime!2,RS b/lib/tests/testdir/cur/1220863087.12663_7.mindcrime!2,RS similarity index 100% rename from src/tests/testdir/cur/1220863087.12663_7.mindcrime!2,RS rename to lib/tests/testdir/cur/1220863087.12663_7.mindcrime!2,RS diff --git a/src/tests/testdir/cur/1252168370_3.14675.cthulhu!2,S b/lib/tests/testdir/cur/1252168370_3.14675.cthulhu!2,S similarity index 100% rename from src/tests/testdir/cur/1252168370_3.14675.cthulhu!2,S rename to lib/tests/testdir/cur/1252168370_3.14675.cthulhu!2,S diff --git a/src/tests/testdir/cur/1283599333.1840_11.cthulhu!2, b/lib/tests/testdir/cur/1283599333.1840_11.cthulhu!2, similarity index 100% rename from src/tests/testdir/cur/1283599333.1840_11.cthulhu!2, rename to lib/tests/testdir/cur/1283599333.1840_11.cthulhu!2, diff --git a/src/tests/testdir/cur/1305664394.2171_402.cthulhu!2, b/lib/tests/testdir/cur/1305664394.2171_402.cthulhu!2, similarity index 100% rename from src/tests/testdir/cur/1305664394.2171_402.cthulhu!2, rename to lib/tests/testdir/cur/1305664394.2171_402.cthulhu!2, diff --git a/src/tests/testdir/cur/encrypted!2,S b/lib/tests/testdir/cur/encrypted!2,S similarity index 100% rename from src/tests/testdir/cur/encrypted!2,S rename to lib/tests/testdir/cur/encrypted!2,S diff --git a/src/tests/testdir/cur/signed!2,S b/lib/tests/testdir/cur/signed!2,S similarity index 100% rename from src/tests/testdir/cur/signed!2,S rename to lib/tests/testdir/cur/signed!2,S diff --git a/src/tests/testdir/cur/signed-encrypted!2,S b/lib/tests/testdir/cur/signed-encrypted!2,S similarity index 100% rename from src/tests/testdir/cur/signed-encrypted!2,S rename to lib/tests/testdir/cur/signed-encrypted!2,S diff --git a/src/tests/testdir/new/1220863087.12663_21.mindcrime b/lib/tests/testdir/new/1220863087.12663_21.mindcrime similarity index 100% rename from src/tests/testdir/new/1220863087.12663_21.mindcrime rename to lib/tests/testdir/new/1220863087.12663_21.mindcrime diff --git a/src/tests/testdir/new/1220863087.12663_23.mindcrime b/lib/tests/testdir/new/1220863087.12663_23.mindcrime similarity index 100% rename from src/tests/testdir/new/1220863087.12663_23.mindcrime rename to lib/tests/testdir/new/1220863087.12663_23.mindcrime diff --git a/src/tests/testdir/new/1220863087.12663_25.mindcrime b/lib/tests/testdir/new/1220863087.12663_25.mindcrime similarity index 100% rename from src/tests/testdir/new/1220863087.12663_25.mindcrime rename to lib/tests/testdir/new/1220863087.12663_25.mindcrime diff --git a/src/tests/testdir/new/1220863087.12663_9.mindcrime b/lib/tests/testdir/new/1220863087.12663_9.mindcrime similarity index 100% rename from src/tests/testdir/new/1220863087.12663_9.mindcrime rename to lib/tests/testdir/new/1220863087.12663_9.mindcrime diff --git a/src/tests/testdir/tmp/1220863087.12663.ignore b/lib/tests/testdir/tmp/1220863087.12663.ignore similarity index 100% rename from src/tests/testdir/tmp/1220863087.12663.ignore rename to lib/tests/testdir/tmp/1220863087.12663.ignore diff --git a/src/tests/testdir2/Foo/cur/arto.eml b/lib/tests/testdir2/Foo/cur/arto.eml similarity index 100% rename from src/tests/testdir2/Foo/cur/arto.eml rename to lib/tests/testdir2/Foo/cur/arto.eml diff --git a/src/tests/testdir2/Foo/cur/mail5 b/lib/tests/testdir2/Foo/cur/mail5 similarity index 100% rename from src/tests/testdir2/Foo/cur/mail5 rename to lib/tests/testdir2/Foo/cur/mail5 diff --git a/src/tests/testdir2/Foo/new/.noindex b/lib/tests/testdir2/Foo/new/.noindex similarity index 100% rename from src/tests/testdir2/Foo/new/.noindex rename to lib/tests/testdir2/Foo/new/.noindex diff --git a/src/tests/testdir2/Foo/tmp/.noindex b/lib/tests/testdir2/Foo/tmp/.noindex similarity index 100% rename from src/tests/testdir2/Foo/tmp/.noindex rename to lib/tests/testdir2/Foo/tmp/.noindex diff --git a/src/tests/testdir2/bar/cur/181736.eml b/lib/tests/testdir2/bar/cur/181736.eml similarity index 100% rename from src/tests/testdir2/bar/cur/181736.eml rename to lib/tests/testdir2/bar/cur/181736.eml diff --git a/src/tests/testdir2/bar/cur/mail1 b/lib/tests/testdir2/bar/cur/mail1 similarity index 100% rename from src/tests/testdir2/bar/cur/mail1 rename to lib/tests/testdir2/bar/cur/mail1 diff --git a/src/tests/testdir2/bar/cur/mail2 b/lib/tests/testdir2/bar/cur/mail2 similarity index 100% rename from src/tests/testdir2/bar/cur/mail2 rename to lib/tests/testdir2/bar/cur/mail2 diff --git a/src/tests/testdir2/bar/cur/mail3 b/lib/tests/testdir2/bar/cur/mail3 similarity index 100% rename from src/tests/testdir2/bar/cur/mail3 rename to lib/tests/testdir2/bar/cur/mail3 diff --git a/src/tests/testdir2/bar/cur/mail4 b/lib/tests/testdir2/bar/cur/mail4 similarity index 100% rename from src/tests/testdir2/bar/cur/mail4 rename to lib/tests/testdir2/bar/cur/mail4 diff --git a/src/tests/testdir2/bar/cur/mail5 b/lib/tests/testdir2/bar/cur/mail5 similarity index 100% rename from src/tests/testdir2/bar/cur/mail5 rename to lib/tests/testdir2/bar/cur/mail5 diff --git a/src/tests/testdir2/bar/cur/mail6 b/lib/tests/testdir2/bar/cur/mail6 similarity index 100% rename from src/tests/testdir2/bar/cur/mail6 rename to lib/tests/testdir2/bar/cur/mail6 diff --git a/src/tests/testdir2/bar/new/.noindex b/lib/tests/testdir2/bar/new/.noindex similarity index 100% rename from src/tests/testdir2/bar/new/.noindex rename to lib/tests/testdir2/bar/new/.noindex diff --git a/src/tests/testdir2/bar/tmp/.noindex b/lib/tests/testdir2/bar/tmp/.noindex similarity index 100% rename from src/tests/testdir2/bar/tmp/.noindex rename to lib/tests/testdir2/bar/tmp/.noindex diff --git a/src/tests/testdir2/wom_bat/cur/atomic b/lib/tests/testdir2/wom_bat/cur/atomic similarity index 100% rename from src/tests/testdir2/wom_bat/cur/atomic rename to lib/tests/testdir2/wom_bat/cur/atomic diff --git a/src/tests/testdir2/wom_bat/cur/rfc822.1 b/lib/tests/testdir2/wom_bat/cur/rfc822.1 similarity index 100% rename from src/tests/testdir2/wom_bat/cur/rfc822.1 rename to lib/tests/testdir2/wom_bat/cur/rfc822.1 diff --git a/src/tests/testdir2/wom_bat/cur/rfc822.2 b/lib/tests/testdir2/wom_bat/cur/rfc822.2 similarity index 100% rename from src/tests/testdir2/wom_bat/cur/rfc822.2 rename to lib/tests/testdir2/wom_bat/cur/rfc822.2 diff --git a/src/tests/testdir3/cycle/cur/cycle0 b/lib/tests/testdir3/cycle/cur/cycle0 similarity index 100% rename from src/tests/testdir3/cycle/cur/cycle0 rename to lib/tests/testdir3/cycle/cur/cycle0 diff --git a/src/tests/testdir3/cycle/cur/cycle0.0 b/lib/tests/testdir3/cycle/cur/cycle0.0 similarity index 100% rename from src/tests/testdir3/cycle/cur/cycle0.0 rename to lib/tests/testdir3/cycle/cur/cycle0.0 diff --git a/src/tests/testdir3/cycle/cur/cycle0.0.0 b/lib/tests/testdir3/cycle/cur/cycle0.0.0 similarity index 100% rename from src/tests/testdir3/cycle/cur/cycle0.0.0 rename to lib/tests/testdir3/cycle/cur/cycle0.0.0 diff --git a/src/tests/testdir3/cycle/cur/rogue0 b/lib/tests/testdir3/cycle/cur/rogue0 similarity index 100% rename from src/tests/testdir3/cycle/cur/rogue0 rename to lib/tests/testdir3/cycle/cur/rogue0 diff --git a/src/tests/testdir3/cycle/new/.noindex b/lib/tests/testdir3/cycle/new/.noindex similarity index 100% rename from src/tests/testdir3/cycle/new/.noindex rename to lib/tests/testdir3/cycle/new/.noindex diff --git a/src/tests/testdir3/cycle/tmp/.noindex b/lib/tests/testdir3/cycle/tmp/.noindex similarity index 100% rename from src/tests/testdir3/cycle/tmp/.noindex rename to lib/tests/testdir3/cycle/tmp/.noindex diff --git a/src/tests/testdir3/tree/cur/child0.0 b/lib/tests/testdir3/tree/cur/child0.0 similarity index 100% rename from src/tests/testdir3/tree/cur/child0.0 rename to lib/tests/testdir3/tree/cur/child0.0 diff --git a/src/tests/testdir3/tree/cur/child0.1 b/lib/tests/testdir3/tree/cur/child0.1 similarity index 100% rename from src/tests/testdir3/tree/cur/child0.1 rename to lib/tests/testdir3/tree/cur/child0.1 diff --git a/src/tests/testdir3/tree/cur/child0.1.0 b/lib/tests/testdir3/tree/cur/child0.1.0 similarity index 100% rename from src/tests/testdir3/tree/cur/child0.1.0 rename to lib/tests/testdir3/tree/cur/child0.1.0 diff --git a/src/tests/testdir3/tree/cur/child2.0.0 b/lib/tests/testdir3/tree/cur/child2.0.0 similarity index 100% rename from src/tests/testdir3/tree/cur/child2.0.0 rename to lib/tests/testdir3/tree/cur/child2.0.0 diff --git a/src/tests/testdir3/tree/cur/child3.0.0.0.0 b/lib/tests/testdir3/tree/cur/child3.0.0.0.0 similarity index 100% rename from src/tests/testdir3/tree/cur/child3.0.0.0.0 rename to lib/tests/testdir3/tree/cur/child3.0.0.0.0 diff --git a/src/tests/testdir3/tree/cur/child4.0 b/lib/tests/testdir3/tree/cur/child4.0 similarity index 100% rename from src/tests/testdir3/tree/cur/child4.0 rename to lib/tests/testdir3/tree/cur/child4.0 diff --git a/src/tests/testdir3/tree/cur/child4.1 b/lib/tests/testdir3/tree/cur/child4.1 similarity index 100% rename from src/tests/testdir3/tree/cur/child4.1 rename to lib/tests/testdir3/tree/cur/child4.1 diff --git a/src/tests/testdir3/tree/cur/root0 b/lib/tests/testdir3/tree/cur/root0 similarity index 100% rename from src/tests/testdir3/tree/cur/root0 rename to lib/tests/testdir3/tree/cur/root0 diff --git a/src/tests/testdir3/tree/cur/root1 b/lib/tests/testdir3/tree/cur/root1 similarity index 100% rename from src/tests/testdir3/tree/cur/root1 rename to lib/tests/testdir3/tree/cur/root1 diff --git a/src/tests/testdir3/tree/cur/root2 b/lib/tests/testdir3/tree/cur/root2 similarity index 100% rename from src/tests/testdir3/tree/cur/root2 rename to lib/tests/testdir3/tree/cur/root2 diff --git a/src/tests/testdir3/tree/new/.noindex b/lib/tests/testdir3/tree/new/.noindex similarity index 100% rename from src/tests/testdir3/tree/new/.noindex rename to lib/tests/testdir3/tree/new/.noindex diff --git a/src/tests/testdir3/tree/tmp/.noindex b/lib/tests/testdir3/tree/tmp/.noindex similarity index 100% rename from src/tests/testdir3/tree/tmp/.noindex rename to lib/tests/testdir3/tree/tmp/.noindex diff --git a/src/mu-cmd-cfind.c b/mu/mu-cmd-cfind.c similarity index 100% rename from src/mu-cmd-cfind.c rename to mu/mu-cmd-cfind.c diff --git a/src/mu-cmd-extract.c b/mu/mu-cmd-extract.c similarity index 100% rename from src/mu-cmd-extract.c rename to mu/mu-cmd-extract.c diff --git a/src/mu-cmd-find.c b/mu/mu-cmd-find.c similarity index 100% rename from src/mu-cmd-find.c rename to mu/mu-cmd-find.c diff --git a/src/mu-cmd-index.c b/mu/mu-cmd-index.c similarity index 100% rename from src/mu-cmd-index.c rename to mu/mu-cmd-index.c diff --git a/src/mu-cmd-server.c b/mu/mu-cmd-server.c similarity index 100% rename from src/mu-cmd-server.c rename to mu/mu-cmd-server.c diff --git a/src/mu-cmd.c b/mu/mu-cmd.c similarity index 100% rename from src/mu-cmd.c rename to mu/mu-cmd.c diff --git a/src/mu-cmd.h b/mu/mu-cmd.h similarity index 100% rename from src/mu-cmd.h rename to mu/mu-cmd.h diff --git a/src/mu-config.c b/mu/mu-config.c similarity index 100% rename from src/mu-config.c rename to mu/mu-config.c diff --git a/src/mu-config.h b/mu/mu-config.h similarity index 100% rename from src/mu-config.h rename to mu/mu-config.h diff --git a/src/mu.cc b/mu/mu.cc similarity index 83% rename from src/mu.cc rename to mu/mu.cc index 39868966..4074709d 100644 --- a/src/mu.cc +++ b/mu/mu.cc @@ -24,10 +24,14 @@ #endif /*HAVE_CONFIG_H*/ #include +#include +#include +#include "mu-config.h" #include "mu-cmd.h" #include "mu-runtime.h" + static void handle_error (GError *err) { @@ -66,16 +70,28 @@ main (int argc, char *argv[]) { GError *err; MuError rv; + MuConfig *conf; - if (!mu_runtime_init_from_cmdline (&argc, &argv, "mu")) + setlocale (LC_ALL, ""); + g_type_init (); + + conf = mu_config_init (&argc, &argv); + if (!conf) return 1; + if (!mu_runtime_init (conf->muhome, PACKAGE_NAME)) { + mu_config_uninit (conf); + return 1; + } + err = NULL; - rv = mu_cmd_execute (mu_runtime_config(), &err); + rv = mu_cmd_execute (conf, &err); handle_error (err); g_clear_error (&err); + + mu_config_uninit (conf); mu_runtime_uninit (); return rv; diff --git a/src/tests/test-mu-cmd-cfind.c b/mu/tests/test-mu-cmd-cfind.c similarity index 99% rename from src/tests/test-mu-cmd-cfind.c rename to mu/tests/test-mu-cmd-cfind.c index 7b6174c1..66e6cbae 100644 --- a/src/tests/test-mu-cmd-cfind.c +++ b/mu/tests/test-mu-cmd-cfind.c @@ -32,7 +32,7 @@ #include #include "test-mu-common.h" -#include "src/mu-store.h" +#include "mu-store.h" static gchar* fill_contacts_cache (void) diff --git a/src/tests/test-mu-cmd.c b/mu/tests/test-mu-cmd.c similarity index 99% rename from src/tests/test-mu-cmd.c rename to mu/tests/test-mu-cmd.c index b0db4a24..1b0afa85 100644 --- a/src/tests/test-mu-cmd.c +++ b/mu/tests/test-mu-cmd.c @@ -32,7 +32,7 @@ #include #include "test-mu-common.h" -#include "src/mu-store.h" +#include "mu-store.h" /* tests for the command line interface, uses testdir2 */ diff --git a/src/tests/test-mu-contacts.c b/mu/tests/test-mu-contacts.c similarity index 97% rename from src/tests/test-mu-contacts.c rename to mu/tests/test-mu-contacts.c index 695feb26..428acf42 100644 --- a/src/tests/test-mu-contacts.c +++ b/mu/tests/test-mu-contacts.c @@ -1,4 +1,4 @@ -/* +/* ** Copyright (C) 2008-2011 Dirk-Jan C. Binnema ** ** This program is free software; you can redistribute it and/or modify it @@ -13,8 +13,8 @@ ** ** 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -** +** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +** */ #ifdef HAVE_CONFIG_H @@ -29,22 +29,22 @@ #include #include "test-mu-common.h" -#include "src/mu-contacts.h" +#include "mu-contacts.h" static gchar* fill_database (void) { gchar *cmdline, *tmpdir; - + tmpdir = test_mu_common_get_random_tmpdir(); cmdline = g_strdup_printf ("%s index --muhome=%s --maildir=%s" " --quiet", MU_PROGRAM, tmpdir, MU_TESTMAILDIR); - + g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, NULL)); g_free (cmdline); - + return tmpdir; } @@ -59,7 +59,7 @@ static Contact* contact_new (const char *email, const char *name, size_t tstamp) { Contact *contact; - + contact = g_slice_new (Contact); contact->name = name ? g_strdup (name) :NULL; contact->email = email ? g_strdup (email) : NULL; @@ -87,7 +87,7 @@ each_contact (const char *email, const char *name, time_t tstamp, Contact *contact; /* g_print ("[n:%s, e:%s]\n", name, email); */ - + contact = contact_new (email, name, tstamp); *lst = g_slist_prepend (*lst, contact); } @@ -100,7 +100,7 @@ has_contact (GSList *lst, const char* name_or_email, gboolean use_name) c = (Contact*)lst->data; /* g_print ("{n:%s,e:%s}\n", c->name, c->email); */ - + if (use_name && g_strcmp0(name_or_email, c->name) == 0) return TRUE; if (g_strcmp0 (name_or_email, c->email) == 0) @@ -133,13 +133,13 @@ test_mu_contacts_01 (void) MuContacts *contacts; gchar *muhome, *contactsfile; GSList *clist; - + muhome = fill_database (); g_assert (muhome != NULL); contactsfile = g_strdup_printf ("%s%ccache%ccontacts", muhome, G_DIR_SEPARATOR, G_DIR_SEPARATOR); /* g_print ("[%s]\n", contactsfile); */ - + contacts = mu_contacts_new (contactsfile); g_assert (contacts); @@ -156,12 +156,12 @@ test_mu_contacts_01 (void) g_assert (has_contact (clist, "testmu@testmu.xx", FALSE)); g_assert (has_contact (clist, "Helmut Kröger", TRUE)); g_assert (has_contact (clist, "hk@testmu.xxx", FALSE)); - + g_slist_foreach (clist, (GFunc)contact_destroy, NULL); g_slist_free (clist); mu_contacts_destroy (contacts); - + g_free (contactsfile); g_free (muhome); } @@ -171,15 +171,14 @@ int main (int argc, char *argv[]) { int rv; - - g_test_init (&argc, &argv, NULL); + + g_test_init (&argc, &argv, NULL); g_test_add_func ("/mu-contacts/test-mu-contacts-01", test_mu_contacts_01); - + g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION, (GLogFunc)black_hole, NULL); rv = g_test_run (); - + return rv; } - diff --git a/src/tests/test-mu-query.c b/mu/tests/test-mu-query.c similarity index 99% rename from src/tests/test-mu-query.c rename to mu/tests/test-mu-query.c index 6bdb0fd8..94cc00f4 100644 --- a/src/tests/test-mu-query.c +++ b/mu/tests/test-mu-query.c @@ -32,9 +32,9 @@ #include #include "test-mu-common.h" -#include "src/mu-query.h" -#include "src/mu-str.h" -#include "src/mu-store.h" +#include "mu-query.h" +#include "mu-str.h" +#include "mu-store.h" static gchar* fill_database (const char *testdir) diff --git a/src/tests/test-mu-runtime.c b/mu/tests/test-mu-runtime.c similarity index 100% rename from src/tests/test-mu-runtime.c rename to mu/tests/test-mu-runtime.c diff --git a/src/tests/test-mu-threads.c b/mu/tests/test-mu-threads.c similarity index 99% rename from src/tests/test-mu-threads.c rename to mu/tests/test-mu-threads.c index 32fd8b28..4310de97 100644 --- a/src/tests/test-mu-threads.c +++ b/mu/tests/test-mu-threads.c @@ -31,8 +31,8 @@ #include #include "test-mu-common.h" -#include "src/mu-query.h" -#include "src/mu-str.h" +#include "mu-query.h" +#include "mu-str.h" static gchar* fill_database (const char *testdir) diff --git a/toys/msg2pdf/Makefile.am b/toys/msg2pdf/Makefile.am index 13b90bd7..e85ce3d5 100644 --- a/toys/msg2pdf/Makefile.am +++ b/toys/msg2pdf/Makefile.am @@ -20,7 +20,7 @@ include $(top_srcdir)/gtest.mk SUBDIRS= . -INCLUDES=-I${top_srcdir}/src $(GTK_CFLAGS) $(WEBKIT_CFLAGS) -DICONDIR='"$(icondir)"' +INCLUDES=-I${top_srcdir}/lib $(GTK_CFLAGS) $(WEBKIT_CFLAGS) -DICONDIR='"$(icondir)"' # don't use -Werror, as it might break on other compilers # use -Wno-unused-parameters, because some callbacks may not @@ -28,8 +28,7 @@ INCLUDES=-I${top_srcdir}/src $(GTK_CFLAGS) $(WEBKIT_CFLAGS) -DICONDIR='"$(icondi AM_CFLAGS=-Wall -Wextra -Wno-unused-parameter -Wdeclaration-after-statement AM_CXXFLAGS=-Wall -Wextra -Wno-unused-parameter - -noinst_PROGRAMS= \ +noinst_PROGRAMS= \ msg2pdf # note, mug.cc is '.cc' only because libmu must explicitly @@ -49,7 +48,7 @@ DISTCLEANFILES= \ $(BUILT_SOURCES) -msg2pdf_LDADD= \ - ${top_builddir}/src/libmu.la \ - $(GTK_LIBS) \ +msg2pdf_LDADD= \ + ${top_builddir}/lib/libmu.la \ + $(GTK_LIBS) \ ${WEBKIT_LIBS} diff --git a/toys/mug/Makefile.am b/toys/mug/Makefile.am index 603c875d..61b40aa6 100644 --- a/toys/mug/Makefile.am +++ b/toys/mug/Makefile.am @@ -20,7 +20,7 @@ include $(top_srcdir)/gtest.mk SUBDIRS= . -INCLUDES=-I${top_srcdir}/src $(GTK_CFLAGS) -DICONDIR='"$(icondir)"' +INCLUDES=-I${top_srcdir}/lib $(GTK_CFLAGS) -DICONDIR='"$(icondir)"' # don't use -Werror, as it might break on other compilers # use -Wno-unused-parameters, because some callbacks may not @@ -58,8 +58,5 @@ DISTCLEANFILES= \ mug_LDADD= \ - ${top_builddir}/src/libmu.la \ + ${top_builddir}/lib/libmu.la \ ${GTK_LIBS} - - - diff --git a/toys/mug/mug-msg-list-view.c b/toys/mug/mug-msg-list-view.c index bf504347..a9c08f44 100644 --- a/toys/mug/mug-msg-list-view.c +++ b/toys/mug/mug-msg-list-view.c @@ -1,6 +1,6 @@ /* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/ /* -** Copyright (C) 2008-2011 Dirk-Jan C. Binnema +** Copyright (C) 2008-2012 Dirk-Jan C. Binnema ** ** 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 diff --git a/toys/mug2/Makefile.am b/toys/mug2/Makefile.am index 7b3062ff..4c5865d6 100644 --- a/toys/mug2/Makefile.am +++ b/toys/mug2/Makefile.am @@ -19,7 +19,7 @@ include $(top_srcdir)/gtest.mk # enforce compiling this dir first before decending into tests/ SUBDIRS= . -INCLUDES=-I${top_srcdir} -I${top_srcdir}/src $(GTK_CFLAGS) $(WEBKIT_CFLAGS) -DICONDIR='"$(icondir)"' \ +INCLUDES=-I${top_srcdir} -I${top_srcdir}/lib $(GTK_CFLAGS) $(WEBKIT_CFLAGS) -DICONDIR='"$(icondir)"' \ -DMUG2DIR='"$(abs_srcdir)"' -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE # don't use -Werror, as it might break on other compilers @@ -57,10 +57,9 @@ DISTCLEANFILES= \ mug2_LDADD= \ - ${top_builddir}/src/libmu.la \ + ${top_builddir}/lib/libmu.la \ ${top_builddir}/widgets/libmuwidgets.la \ ${GTK_LIBS} EXTRA_DIST= \ mug.svg - diff --git a/widgets/Makefile.am b/widgets/Makefile.am index b65449aa..0417f1b3 100644 --- a/widgets/Makefile.am +++ b/widgets/Makefile.am @@ -18,7 +18,7 @@ include $(top_srcdir)/gtest.mk # enforce compiling this dir first before decending into tests/ SUBDIRS= . -INCLUDES=-I${top_srcdir}/src $(GTK_CFLAGS) $(WEBKIT_CFLAGS) $(GIO_CFLAGS) -DICONDIR='"$(icondir)"' \ +INCLUDES=-I${top_srcdir}/lib $(GTK_CFLAGS) $(WEBKIT_CFLAGS) $(GIO_CFLAGS) -DICONDIR='"$(icondir)"' \ -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE # don't use -Werror, as it might break on other compilers @@ -43,8 +43,7 @@ libmuwidgets_la_SOURCES= \ mu-msg-view.c libmuwidgets_la_LIBADD= \ - ${top_builddir}/src/libmu.la \ + ${top_builddir}/lib/libmu.la \ ${GTK_LIBS} \ ${WEBKIT_LIBS} \ ${GIO_LIBS} - diff --git a/widgets/mu-msg-attach-view.c b/widgets/mu-msg-attach-view.c index 1a79afa3..122e4bbf 100644 --- a/widgets/mu-msg-attach-view.c +++ b/widgets/mu-msg-attach-view.c @@ -19,7 +19,7 @@ #include "mu-msg-attach-view.h" #include "mu-widget-util.h" -#include +#include enum { ICON_COL, diff --git a/widgets/mu-msg-attach-view.h b/widgets/mu-msg-attach-view.h index 55efd6cf..d49b02fa 100644 --- a/widgets/mu-msg-attach-view.h +++ b/widgets/mu-msg-attach-view.h @@ -22,7 +22,7 @@ #define __MU_MSG_ATTACH_VIEW_H__ #include -#include +#include G_BEGIN_DECLS @@ -65,4 +65,3 @@ int mu_msg_attach_view_set_message (MuMsgAttachView *self, MuMsg *msg); G_END_DECLS #endif /* __MU_MSG_ATTACH_VIEW_H__ */ - diff --git a/widgets/mu-msg-header-view.c b/widgets/mu-msg-header-view.c index 26f62fba..2509cb21 100644 --- a/widgets/mu-msg-header-view.c +++ b/widgets/mu-msg-header-view.c @@ -19,8 +19,8 @@ #include "mu-msg-header-view.h" -#include -#include +#include +#include #if HAVE_CONFIG_H #include diff --git a/widgets/mu-msg-view.c b/widgets/mu-msg-view.c index 119520f0..3cf0419a 100644 --- a/widgets/mu-msg-view.c +++ b/widgets/mu-msg-view.c @@ -25,7 +25,7 @@ #include "mu-msg-body-view.h" #include "mu-msg-header-view.h" #include "mu-msg-attach-view.h" -#include "mu-msg-part.h" +#include /* 'private'/'protected' functions */