* minor changes, trailing whitespace fixes
This commit is contained in:
140
src/mu-util.h
140
src/mu-util.h
@ -33,7 +33,7 @@ G_BEGIN_DECLS
|
||||
* do system-specific initialization. should be called before anything
|
||||
* else. Initializes the locale and Gtype. Note: this function is
|
||||
* called by mu_runtime_init.
|
||||
*
|
||||
*
|
||||
* @return TRUE if is succeeds, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_util_init_system (void);
|
||||
@ -43,7 +43,7 @@ gboolean mu_util_init_system (void);
|
||||
* path does not have to exist
|
||||
*
|
||||
* @param path path to expand
|
||||
*
|
||||
*
|
||||
* @return the expanded path as a newly allocated string, or NULL in
|
||||
* case of error
|
||||
*/
|
||||
@ -53,7 +53,7 @@ char* mu_util_dir_expand (const char* path)
|
||||
/**
|
||||
* guess the maildir; first try $MAILDIR; if it is unset or
|
||||
* non-existant, try ~/Maildir if both fail, return NULL
|
||||
*
|
||||
*
|
||||
* @return full path of the guessed Maildir, or NULL; must be freed (gfree)
|
||||
*/
|
||||
char* mu_util_guess_maildir (void)
|
||||
@ -64,7 +64,7 @@ char* mu_util_guess_maildir (void)
|
||||
* guess the place of the mu homedir (typically, ~/.mu). Note, this
|
||||
* directory does not necessarily exist. mu_util_check_dir can be use
|
||||
* to check that
|
||||
*
|
||||
*
|
||||
* @return the guessed mu homedir, which needs to be freed with g_free
|
||||
* when no longer needed.
|
||||
*/
|
||||
@ -74,11 +74,11 @@ gchar* mu_util_guess_mu_homedir (void)
|
||||
/**
|
||||
* if path exists, check that's a read/writeable dir; otherwise try to
|
||||
* create it (with perms 0700)
|
||||
*
|
||||
*
|
||||
* @param path path to the dir
|
||||
* @param mode to set for the dir (as per chmod(1))
|
||||
* @param nowarn, if TRUE, don't write warnings (if any) to stderr
|
||||
*
|
||||
*
|
||||
* @return TRUE if a read/writeable directory `path' exists after
|
||||
* leaving this function, FALSE otherwise
|
||||
*/
|
||||
@ -88,11 +88,11 @@ gboolean mu_util_create_dir_maybe (const gchar *path, mode_t mode, gboolean nowa
|
||||
/**
|
||||
* check whether path is a directory, and optionally, if it's readable
|
||||
* and/or writeable
|
||||
*
|
||||
*
|
||||
* @param path dir path
|
||||
* @param readable check for readability
|
||||
* @param writeable check for writability
|
||||
*
|
||||
*
|
||||
* @return TRUE if dir exist and has the specified properties
|
||||
*/
|
||||
gboolean mu_util_check_dir (const gchar* path, gboolean readable,
|
||||
@ -102,8 +102,8 @@ gboolean mu_util_check_dir (const gchar* path, gboolean readable,
|
||||
|
||||
/**
|
||||
* get our the cache directory, typically, /tmp/mu-<userid>/
|
||||
*
|
||||
* @return the cache directory; don't free
|
||||
*
|
||||
* @return the cache directory; don't free
|
||||
*/
|
||||
const char* mu_util_cache_dir (void) G_GNUC_CONST;
|
||||
|
||||
@ -112,11 +112,11 @@ const char* mu_util_cache_dir (void) G_GNUC_CONST;
|
||||
/**
|
||||
* create a writeable file and return its file descriptor (which
|
||||
* you'll need to close(2) when done with it.)
|
||||
*
|
||||
*
|
||||
* @param path the full path of the file to create
|
||||
* @param the mode to open (ie. 0644 or 0600 etc., see chmod(3)
|
||||
* @param overwrite should we allow for overwriting existing files?
|
||||
*
|
||||
*
|
||||
* @return a file descriptor, or -1 in case of error. If it's a file
|
||||
* system error, 'errno' may contain more info. use 'close()' when done
|
||||
* with the file descriptor
|
||||
@ -129,17 +129,17 @@ int mu_util_create_writeable_fd (const char* path, mode_t mode,
|
||||
/**
|
||||
* check if file is local, ie. on the local file system. this means
|
||||
* that it's either having a file URI, *or* that it's an existing file
|
||||
*
|
||||
*
|
||||
* @param path a path
|
||||
*
|
||||
*
|
||||
* @return TRUE if the file is local, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_util_is_local_file (const char* path);
|
||||
|
||||
|
||||
/**
|
||||
* is the current locale utf-8 compatible?
|
||||
*
|
||||
* is the current locale utf-8 compatible?
|
||||
*
|
||||
* @return TRUE if it's utf8 compatible, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_util_locale_is_utf8 (void) G_GNUC_CONST;
|
||||
@ -148,10 +148,10 @@ gboolean mu_util_locale_is_utf8 (void) G_GNUC_CONST;
|
||||
/**
|
||||
* write a string (assumed to be in utf8-format) to a stream,
|
||||
* converted to the current locale
|
||||
*
|
||||
*
|
||||
* @param str a string
|
||||
* @param stream a stream
|
||||
*
|
||||
*
|
||||
* @return TRUE if printing worked, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_util_fputs_encoded (const char *str, FILE *stream);
|
||||
@ -159,9 +159,9 @@ gboolean mu_util_fputs_encoded (const char *str, FILE *stream);
|
||||
/**
|
||||
* print a formatted string (assumed to be in utf8-format) to stdout,
|
||||
* converted to the current locale
|
||||
*
|
||||
*
|
||||
* @param a standard printf() format string, followed by a parameter list
|
||||
*
|
||||
*
|
||||
* @return TRUE if printing worked, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_util_print_encoded (const char *frm, ...) G_GNUC_PRINTF(1,2);
|
||||
@ -169,9 +169,9 @@ gboolean mu_util_print_encoded (const char *frm, ...) G_GNUC_PRINTF(1,2);
|
||||
/**
|
||||
* print a formatted string (assumed to be in utf8-format) to stderr,
|
||||
* converted to the current locale
|
||||
*
|
||||
*
|
||||
* @param a standard printf() format string, followed by a parameter list
|
||||
*
|
||||
*
|
||||
* @return TRUE if printing worked, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_util_printerr_encoded (const char *frm, ...) G_GNUC_PRINTF(1,2);
|
||||
@ -181,82 +181,23 @@ gboolean mu_util_printerr_encoded (const char *frm, ...) G_GNUC_PRINTF(1,2);
|
||||
/**
|
||||
* try to 'play' (ie., open with it's associated program) a
|
||||
* file. depends on xdg-open to do the actual opening
|
||||
*
|
||||
*
|
||||
* @param path full path of the file to open
|
||||
* @param allow_local allow local files (ie. with file:// prefix or fs paths)
|
||||
* @param allow_remote allow URIs (ie., http, mailto)
|
||||
*
|
||||
*
|
||||
* @return TRUE if it succeeded, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_util_play (const char *path,
|
||||
gboolean allow_local, gboolean allow_remote);
|
||||
|
||||
|
||||
/**
|
||||
" * get the version of the xapian database (ie., the version of the
|
||||
* 'schema' we are using). If this version != MU_XAPIAN_DB_VERSION,
|
||||
* it's means we need to a full reindex.
|
||||
*
|
||||
* @param xpath path to the xapian database
|
||||
*
|
||||
* @return the version of the database as a newly allocated string
|
||||
* (free with g_free); if there is no version yet, it will return NULL
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
/**
|
||||
* check whether the database is empty (contains 0 documents); in
|
||||
* addition, a non-existing database is considered 'empty' too
|
||||
*
|
||||
* @param xpath path to the xapian database
|
||||
*
|
||||
* @return TRUE if the database is empty, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_util_xapian_is_empty (const gchar *xpath);
|
||||
|
||||
|
||||
/**
|
||||
* clear the database, ie., remove all of the contents. This is a
|
||||
* destructive operation, but the database can be restored be doing a
|
||||
* full scan of the maildirs. Also, clear the contacts cache file
|
||||
*
|
||||
* @param xpath path to the database
|
||||
* @param ccache path to the contacts cache file
|
||||
*
|
||||
* @return TRUE if the clearing succeeded, FALSE otherwise.
|
||||
*/
|
||||
gboolean mu_util_xapian_clear (const gchar *xpath,
|
||||
const gchar *ccache);
|
||||
|
||||
|
||||
/**
|
||||
* check if the database is locked for writing
|
||||
*
|
||||
* @param xpath path to a xapian database
|
||||
*
|
||||
* @return TRUE if it is locked, FALSE otherwise (or in case of error)
|
||||
*/
|
||||
gboolean mu_util_xapian_is_locked (const gchar *xpath);
|
||||
|
||||
|
||||
/**
|
||||
* convert a string array in to a string, with the elements separated
|
||||
* by ' '
|
||||
*
|
||||
*
|
||||
* @param params a non-NULL, NULL-terminated string array
|
||||
*
|
||||
*
|
||||
* @return a newly allocated string
|
||||
*/
|
||||
gchar* mu_util_str_from_strv (const gchar **params)
|
||||
@ -292,9 +233,9 @@ enum {
|
||||
/**
|
||||
* get the d_type (as in direntry->d_type) for the file at path, using
|
||||
* lstat(3)
|
||||
*
|
||||
*
|
||||
* @param path full path
|
||||
*
|
||||
*
|
||||
* @return DT_REG, DT_DIR, DT_LNK, or DT_UNKNOWN (other values are not
|
||||
* supported currently )
|
||||
*/
|
||||
@ -303,20 +244,23 @@ unsigned char mu_util_get_dtype_with_lstat (const char *path);
|
||||
|
||||
/**
|
||||
* we need this when using Xapian::Document* from C
|
||||
*
|
||||
*
|
||||
*/
|
||||
typedef gpointer XapianDocument;
|
||||
|
||||
/**
|
||||
* we need this when using Xapian::Enquire* from C
|
||||
*
|
||||
*
|
||||
*/
|
||||
typedef gpointer XapianEnquire;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* don't repeat these catch blocks everywhere...
|
||||
*
|
||||
*
|
||||
*/
|
||||
#define MU_XAPIAN_CATCH_BLOCK \
|
||||
catch (const Xapian::Error &xerr) { \
|
||||
@ -396,13 +340,13 @@ typedef gpointer XapianEnquire;
|
||||
enum _MuError {
|
||||
/* no error at all! */
|
||||
MU_OK = 0,
|
||||
|
||||
|
||||
/* generic error */
|
||||
MU_ERROR = 1,
|
||||
MU_ERROR_IN_PARAMETERS = 2,
|
||||
MU_ERROR_INTERNAL = 3,
|
||||
MU_ERROR_INTERNAL = 3,
|
||||
MU_ERROR_NO_MATCHES = 4,
|
||||
|
||||
|
||||
/* general xapian related error */
|
||||
MU_ERROR_XAPIAN = 11,
|
||||
|
||||
@ -420,15 +364,15 @@ enum _MuError {
|
||||
MU_ERROR_XAPIAN_CANNOT_GET_WRITELOCK = 18,
|
||||
|
||||
/* GMime related errors */
|
||||
|
||||
|
||||
/* gmime parsing related error */
|
||||
MU_ERROR_GMIME = 30,
|
||||
|
||||
/* contacts related errors */
|
||||
MU_ERROR_CONTACTS = 50,
|
||||
MU_ERROR_CONTACTS_CANNOT_RETRIEVE = 51,
|
||||
|
||||
|
||||
|
||||
|
||||
/* File errors */
|
||||
/* generic file-related error */
|
||||
MU_ERROR_FILE = 70,
|
||||
@ -442,7 +386,7 @@ enum _MuError {
|
||||
MU_ERROR_FILE_READDIR_FAILED = 78,
|
||||
MU_ERROR_FILE_INVALID_SOURCE = 79,
|
||||
MU_ERROR_FILE_TARGET_EQUALS_SOURCE = 80,
|
||||
|
||||
|
||||
/* not really an error, used in callbacks */
|
||||
MU_STOP = 99,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user