diff --git a/src/mu-cmd.c b/src/mu-cmd.c index 242be652..76782721 100644 --- a/src/mu-cmd.c +++ b/src/mu-cmd.c @@ -1,3 +1,5 @@ +/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/ + /* ** Copyright (C) 2010-2011 Dirk-Jan C. Binnema ** @@ -50,7 +52,7 @@ each_part (MuMsg *msg, MuMsgPart *part, gchar **attach) } /* return comma-sep'd list of attachments */ -gchar * +static gchar * get_attach_str (MuMsg *msg) { gchar *attach; diff --git a/src/mu-log.c b/src/mu-log.c index 8854a0fc..03f43398 100644 --- a/src/mu-log.c +++ b/src/mu-log.c @@ -1,3 +1,5 @@ +/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/ + /* ** Copyright (C) 2008-2011 Dirk-Jan C. Binnema ** diff --git a/src/mu-log.h b/src/mu-log.h index 5a90c499..dbe7b787 100644 --- a/src/mu-log.h +++ b/src/mu-log.h @@ -1,5 +1,7 @@ +/* -*-mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-*/ + /* -** Copyright (C) 2008-2010 Dirk-Jan C. Binnema +** Copyright (C) 2008-2011 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 @@ -56,8 +58,8 @@ gboolean mu_log_init_with_fd (int fd, gboolean doclose, gboolean quiet, gboolean debug) G_GNUC_WARN_UNUSED_RESULT; /** - * be absolutely silent, except for runtime errors, which will be - * written to stderr. + * be silent except for runtime errors, which will be written to + * stderr. * * @return TRUE if initialization succeeds, FALSE otherwise */ diff --git a/src/mu-util-db.cc b/src/mu-util-db.cc index 4220e4ba..eea2fc82 100644 --- a/src/mu-util-db.cc +++ b/src/mu-util-db.cc @@ -1,3 +1,5 @@ +/* -*-mode: c++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8-*- */ + /* ** Copyright (C) 2008-2011 Dirk-Jan C. Binnema ** @@ -28,8 +30,8 @@ #include "mu-util.h" -char* -mu_util_xapian_get_metadata (const gchar *xpath, const gchar *key) +static char* +xapian_get_metadata (const gchar *xpath, const gchar *key) { g_return_val_if_fail (xpath, NULL); g_return_val_if_fail (key, NULL); @@ -49,37 +51,12 @@ mu_util_xapian_get_metadata (const gchar *xpath, const gchar *key) return NULL; } - -gboolean -mu_util_xapian_set_metadata (const gchar *xpath, - const gchar *key, const gchar *val) -{ - g_return_val_if_fail (xpath, FALSE); - g_return_val_if_fail (key, FALSE); - g_return_val_if_fail (val, FALSE); - - if (!access(xpath, F_OK) == 0) { - g_warning ("cannot access %s: %s", xpath, strerror(errno)); - return FALSE; - } - - try { - Xapian::WritableDatabase db (xpath, Xapian::DB_OPEN); - db.set_metadata (key, val); - return TRUE; - - } MU_XAPIAN_CATCH_BLOCK; - - return FALSE; -} - - char* mu_util_xapian_dbversion (const gchar *xpath) { g_return_val_if_fail (xpath, NULL); - return mu_util_xapian_get_metadata (xpath, MU_STORE_VERSION_KEY); + return xapian_get_metadata (xpath, MU_STORE_VERSION_KEY); } gboolean @@ -151,7 +128,8 @@ mu_util_xapian_is_locked (const gchar *xpath) } catch (const Xapian::DatabaseLockError& xer) { return TRUE; } catch (const Xapian::Error &xer) { - g_warning ("%s: error: %s", __FUNCTION__, xer.get_msg().c_str()); + g_warning ("%s: error: %s", __FUNCTION__, + xer.get_msg().c_str()); } return FALSE; diff --git a/src/mu-util.h b/src/mu-util.h index 503b73e1..b3ee9f94 100644 --- a/src/mu-util.h +++ b/src/mu-util.h @@ -159,7 +159,14 @@ gboolean mu_util_play (const char *path, gchar* mu_util_xapian_dbversion (const gchar *xpath) G_GNUC_WARN_UNUSED_RESULT; - +/** + * check whether the database needs to be upgraded, e.g., when it was + * created with a different version of mu + * + * @param xpath path to the database dir + * + * @return TRUE if the database needs upgrading, FALSE otherwise + */ gboolean mu_util_xapian_needs_upgrade (const gchar *xpath); @@ -322,7 +329,7 @@ typedef gpointer XapianEnquire; /* name of the bookmark file */ #define MU_BOOKMARK_FILENAME "bookmarks" -/* metdata key for the xapian 'schema' version */ +/* metadata key for the xapian 'schema' version */ #define MU_STORE_VERSION_KEY "db_version"