mirror of https://github.com/djcb/mu.git
* minor updates / cleanups
This commit is contained in:
parent
744b363d8e
commit
34683157d1
|
@ -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 <djcb@djcbsoftware.nl>
|
||||
**
|
||||
|
@ -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;
|
||||
|
|
|
@ -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 <djcb@djcbsoftware.nl>
|
||||
**
|
||||
|
|
|
@ -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 <djcb@djcbsoftware.nl>
|
||||
** Copyright (C) 2008-2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
**
|
||||
** 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
|
||||
*/
|
||||
|
|
|
@ -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 <djcb@djcbsoftware.nl>
|
||||
**
|
||||
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue