mirror of https://github.com/djcb/mu.git
* rename mu_msg_str => mu_str
This commit is contained in:
parent
89b85cf7f7
commit
0f2b4e2d3c
|
@ -80,9 +80,9 @@ libmu_la_SOURCES= \
|
|||
mu-msg-iter.h \
|
||||
mu-msg-part.c \
|
||||
mu-msg-part.h \
|
||||
mu-msg-str.c \
|
||||
mu-msg-str-normalize.c \
|
||||
mu-msg-str.h \
|
||||
mu-str.c \
|
||||
mu-str-normalize.c \
|
||||
mu-str.h \
|
||||
mu-msg.h \
|
||||
mu-output-link.c \
|
||||
mu-output-link.h \
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "mu-msg.h"
|
||||
#include "mu-msg-part.h"
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-cmd.h"
|
||||
#include "mu-util.h"
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "mu-index.h"
|
||||
#include "mu-query.h"
|
||||
#include "mu-msg-iter.h"
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-bookmarks.h"
|
||||
|
||||
#include "mu-runtime.h"
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "mu-msg.h"
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-str.h"
|
||||
#include "mu-cmd.h"
|
||||
|
||||
#include "mu-util.h"
|
||||
|
@ -57,7 +57,7 @@ view_file (const gchar *path, const gchar *fields, size_t summary_len)
|
|||
g_print ("Subject: %s\n", field);
|
||||
|
||||
if ((date = mu_msg_get_date (msg)))
|
||||
g_print ("Date: %s\n", mu_msg_str_date_s ("%c", date));
|
||||
g_print ("Date: %s\n", mu_str_date_s ("%c", date));
|
||||
|
||||
if (summary_len > 0) {
|
||||
field = mu_msg_get_summary (msg, summary_len);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#include "mu-util.h"
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-str.h"
|
||||
|
||||
#include "mu-msg-priv.h" /* include before mu-msg.h */
|
||||
#include "mu-msg.h"
|
||||
|
@ -763,7 +763,7 @@ mu_msg_get_summary (MuMsg *msg, size_t max_lines)
|
|||
return NULL; /* there was no text body */
|
||||
|
||||
return msg->_fields[SUMMARY_FIELD] =
|
||||
mu_msg_str_summarize (body, max_lines);
|
||||
mu_str_summarize (body, max_lines);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "mu-maildir.h"
|
||||
#include "mu-index.h"
|
||||
#include "mu-msg-iter.h"
|
||||
#include "mu-msg-str.h"
|
||||
|
||||
#include "mu-util.h"
|
||||
#include "mu-output-link.h"
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "mu-maildir.h"
|
||||
#include "mu-index.h"
|
||||
#include "mu-msg-iter.h"
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-str.h"
|
||||
|
||||
/* #include "mu-util.h" */
|
||||
/* #include "mu-util-db.h" */
|
||||
|
@ -55,17 +55,17 @@ display_field (MuMsgIter *iter, MuMsgFieldId mfid)
|
|||
return mu_msg_prio_name ((MuMsgPrio)val);
|
||||
} else if (mfid == MU_MSG_FIELD_ID_FLAGS) {
|
||||
val = mu_msg_iter_get_field_numeric (iter, mfid);
|
||||
return mu_msg_str_flags_s ((MuMsgFlags)val);
|
||||
return mu_str_flags_s ((MuMsgFlags)val);
|
||||
} else /* as string */
|
||||
return mu_msg_iter_get_field (iter, mfid);
|
||||
|
||||
case MU_MSG_FIELD_TYPE_TIME_T:
|
||||
val = mu_msg_iter_get_field_numeric (iter, mfid);
|
||||
return mu_msg_str_date_s ("%c", (time_t)val);
|
||||
return mu_str_date_s ("%c", (time_t)val);
|
||||
|
||||
case MU_MSG_FIELD_TYPE_BYTESIZE:
|
||||
val = mu_msg_iter_get_field_numeric (iter, mfid);
|
||||
return mu_msg_str_size_s ((unsigned)val);
|
||||
return mu_str_size_s ((unsigned)val);
|
||||
default:
|
||||
g_return_val_if_reached (NULL);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include "mu-util.h"
|
||||
#include "mu-util-db.h"
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-str.h"
|
||||
|
||||
/*
|
||||
* a xapian value date processor with the following properties:
|
||||
|
@ -391,7 +391,7 @@ mu_query_preprocess (const char *query)
|
|||
* will fixes some of the false-negatives. A full fix
|
||||
* probably requires some custom query parser.
|
||||
*/
|
||||
my_query = mu_msg_str_normalize(query, TRUE);
|
||||
my_query = mu_str_normalize(query, TRUE);
|
||||
|
||||
for (cur = my_query; *cur; ++cur) {
|
||||
if (*cur == ':') /* we found a ':' */
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "mu-msg-contact.h"
|
||||
#include "mu-store.h"
|
||||
#include "mu-util.h"
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-str.h"
|
||||
#include "mu-msg-flags.h"
|
||||
|
||||
/* number of new messages after which we commit to the database */
|
||||
|
@ -325,7 +325,7 @@ add_terms_values_string (Xapian::Document& doc, MuMsg *msg,
|
|||
|
||||
if (mu_msg_field_xapian_index (mfid)) {
|
||||
Xapian::TermGenerator termgen;
|
||||
gchar *norm (mu_msg_str_normalize(str, TRUE));
|
||||
gchar *norm (mu_str_normalize(str, TRUE));
|
||||
termgen.set_document (doc);
|
||||
termgen.index_text_without_positions (norm, 1, prefix);
|
||||
g_free(norm);
|
||||
|
@ -334,7 +334,7 @@ add_terms_values_string (Xapian::Document& doc, MuMsg *msg,
|
|||
if (mu_msg_field_xapian_term(mfid)) {
|
||||
/* add a normalized version (accents removed,
|
||||
* lowercase) */
|
||||
gchar *norm = mu_msg_str_normalize(str, TRUE);
|
||||
gchar *norm = mu_str_normalize(str, TRUE);
|
||||
doc.add_term (std::string (prefix + std::string(norm), 0,
|
||||
MU_STORE_MAX_TERM_LENGTH));
|
||||
g_free (norm);
|
||||
|
@ -366,7 +366,7 @@ add_terms_values_body (Xapian::Document& doc, MuMsg *msg,
|
|||
Xapian::TermGenerator termgen;
|
||||
termgen.set_document(doc);
|
||||
|
||||
norm = mu_msg_str_normalize (str, TRUE);
|
||||
norm = mu_str_normalize (str, TRUE);
|
||||
termgen.index_text_without_positions
|
||||
(norm, 1,
|
||||
std::string(1, mu_msg_field_xapian_prefix(mfid)));
|
||||
|
@ -435,7 +435,7 @@ each_contact_info (MuMsgContact *contact, MsgDoc *data)
|
|||
if (contact->name && strlen(contact->name) > 0) {
|
||||
Xapian::TermGenerator termgen;
|
||||
termgen.set_document (*data->_doc);
|
||||
char *norm = mu_msg_str_normalize (contact->name, TRUE);
|
||||
char *norm = mu_str_normalize (contact->name, TRUE);
|
||||
termgen.index_text_without_positions (norm, 1, *pfxp);
|
||||
g_free (norm);
|
||||
}
|
||||
|
|
|
@ -26,16 +26,16 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-str.h"
|
||||
|
||||
static char* normalize_in_place_downcase (char *str);
|
||||
|
||||
char*
|
||||
mu_msg_str_normalize (const char *str, gboolean downcase)
|
||||
mu_str_normalize (const char *str, gboolean downcase)
|
||||
{
|
||||
g_return_val_if_fail (str, NULL);
|
||||
|
||||
return mu_msg_str_normalize_in_place (g_strdup(str), downcase);
|
||||
return mu_str_normalize_in_place (g_strdup(str), downcase);
|
||||
}
|
||||
|
||||
/* we can normalize in-place, as the normalized string will never be
|
||||
|
@ -44,7 +44,7 @@ mu_msg_str_normalize (const char *str, gboolean downcase)
|
|||
* original 0xc3 0x9f
|
||||
*/
|
||||
char*
|
||||
mu_msg_str_normalize_in_place (char *str, gboolean downcase)
|
||||
mu_str_normalize_in_place (char *str, gboolean downcase)
|
||||
{
|
||||
const guchar *cur;
|
||||
int i;
|
|
@ -27,12 +27,12 @@
|
|||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-str.h"
|
||||
#include "mu-msg-flags.h"
|
||||
|
||||
|
||||
const char*
|
||||
mu_msg_str_date_s (const char* frm, time_t t)
|
||||
mu_str_date_s (const char* frm, time_t t)
|
||||
{
|
||||
struct tm *tmbuf;
|
||||
static char buf[128];
|
||||
|
@ -47,15 +47,15 @@ mu_msg_str_date_s (const char* frm, time_t t)
|
|||
}
|
||||
|
||||
char*
|
||||
mu_msg_str_date (const char *frm, time_t t)
|
||||
mu_str_date (const char *frm, time_t t)
|
||||
{
|
||||
return g_strdup (mu_msg_str_date_s(frm, t));
|
||||
return g_strdup (mu_str_date_s(frm, t));
|
||||
}
|
||||
|
||||
|
||||
|
||||
const char*
|
||||
mu_msg_str_display_date_s (time_t t)
|
||||
mu_str_display_date_s (time_t t)
|
||||
{
|
||||
time_t now;
|
||||
static const time_t SECS_IN_DAY = 24 * 60 * 60;
|
||||
|
@ -63,13 +63,13 @@ mu_msg_str_display_date_s (time_t t)
|
|||
now = time (NULL);
|
||||
|
||||
if (ABS(now - t) > SECS_IN_DAY)
|
||||
return mu_msg_str_date_s ("%x", t);
|
||||
return mu_str_date_s ("%x", t);
|
||||
else
|
||||
return mu_msg_str_date_s ("%X", t);
|
||||
return mu_str_date_s ("%X", t);
|
||||
}
|
||||
|
||||
const char*
|
||||
mu_msg_str_size_s (size_t s)
|
||||
mu_str_size_s (size_t s)
|
||||
{
|
||||
static char buf[32];
|
||||
|
||||
|
@ -94,25 +94,25 @@ mu_msg_str_size_s (size_t s)
|
|||
}
|
||||
|
||||
char*
|
||||
mu_msg_str_size (size_t s)
|
||||
mu_str_size (size_t s)
|
||||
{
|
||||
return g_strdup (mu_msg_str_size_s(s));
|
||||
return g_strdup (mu_str_size_s(s));
|
||||
}
|
||||
|
||||
const char*
|
||||
mu_msg_str_flags_s (MuMsgFlags flags)
|
||||
mu_str_flags_s (MuMsgFlags flags)
|
||||
{
|
||||
return mu_msg_flags_str_s (flags);
|
||||
}
|
||||
|
||||
char*
|
||||
mu_msg_str_flags (MuMsgFlags flags)
|
||||
mu_str_flags (MuMsgFlags flags)
|
||||
{
|
||||
return g_strdup (mu_msg_str_flags_s(flags));
|
||||
return g_strdup (mu_str_flags_s(flags));
|
||||
}
|
||||
|
||||
char*
|
||||
mu_msg_str_summarize (const char* str, size_t max_lines)
|
||||
mu_str_summarize (const char* str, size_t max_lines)
|
||||
{
|
||||
char *summary;
|
||||
size_t nl_seen;
|
||||
|
@ -154,7 +154,7 @@ mu_msg_str_summarize (const char* str, size_t max_lines)
|
|||
|
||||
|
||||
const char*
|
||||
mu_msg_str_display_contact_s (const char *str)
|
||||
mu_str_display_contact_s (const char *str)
|
||||
{
|
||||
static gchar contact[255];
|
||||
gchar *c, *c2;
|
||||
|
@ -180,9 +180,9 @@ mu_msg_str_display_contact_s (const char *str)
|
|||
}
|
||||
|
||||
char*
|
||||
mu_msg_str_display_contact (const char *str)
|
||||
mu_str_display_contact (const char *str)
|
||||
{
|
||||
g_return_val_if_fail (str, NULL);
|
||||
|
||||
return g_strdup (mu_msg_str_display_contact_s (str));
|
||||
return g_strdup (mu_str_display_contact_s (str));
|
||||
}
|
|
@ -17,8 +17,8 @@
|
|||
**
|
||||
*/
|
||||
|
||||
#ifndef __MU_MSG_STR_H__
|
||||
#define __MU_MSG_STR_H__
|
||||
#ifndef __MU_STR_H__
|
||||
#define __MU_STR_H__
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -31,8 +31,8 @@ G_BEGIN_DECLS
|
|||
/**
|
||||
* get a string for a given time_t
|
||||
*
|
||||
* mu_msg_str_date_s returns a ptr to a static buffer,
|
||||
* while mu_msg_str_date returns dynamically allocated
|
||||
* mu_str_date_s returns a ptr to a static buffer,
|
||||
* while mu_str_date returns dynamically allocated
|
||||
* memory that must be freed after use.
|
||||
*
|
||||
* @param frm the format of the string (in strftime(3) format)
|
||||
|
@ -43,8 +43,8 @@ G_BEGIN_DECLS
|
|||
* format is too long, the value will be truncated. in practice this
|
||||
* should not happen.
|
||||
*/
|
||||
const char* mu_msg_str_date_s (const char* frm, time_t t) G_GNUC_CONST;
|
||||
char* mu_msg_str_date (const char* frm, time_t t) G_GNUC_WARN_UNUSED_RESULT;
|
||||
const char* mu_str_date_s (const char* frm, time_t t) G_GNUC_CONST;
|
||||
char* mu_str_date (const char* frm, time_t t) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -52,13 +52,13 @@ char* mu_msg_str_date (const char* frm, time_t t) G_GNUC_WARN_UNUSED_RES
|
|||
* 24h from the current time, we display the time, otherwise the date,
|
||||
* using the preferred date/time for the current locale
|
||||
*
|
||||
* mu_msg_str_display_date_s returns a ptr to a static buffer,
|
||||
* mu_str_display_date_s returns a ptr to a static buffer,
|
||||
*
|
||||
* @param t the time as time_t
|
||||
*
|
||||
* @return a string representation of the time/date
|
||||
*/
|
||||
const char* mu_msg_str_display_date_s (time_t t);
|
||||
const char* mu_str_display_date_s (time_t t);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -69,8 +69,8 @@ const char* mu_msg_str_display_date_s (time_t t);
|
|||
* Foo Bar
|
||||
* Note that this is based on some simple heuristics. Max length is 255 bytes.
|
||||
*
|
||||
* mu_msg_str_display_contact_s returns a statically allocated
|
||||
* buffer (ie, non-reentrant), while mu_msg_str_display_contact
|
||||
* mu_str_display_contact_s returns a statically allocated
|
||||
* buffer (ie, non-reentrant), while mu_str_display_contact
|
||||
* returns a newly allocated string that you must free with g_free
|
||||
* when done with it.
|
||||
*
|
||||
|
@ -78,8 +78,8 @@ const char* mu_msg_str_display_date_s (time_t t);
|
|||
*
|
||||
* @return a newly allocated string with a display contact
|
||||
*/
|
||||
const char* mu_msg_str_display_contact_s (const char *str);
|
||||
char *mu_msg_str_display_contact (const char *str);
|
||||
const char* mu_str_display_contact_s (const char *str);
|
||||
char *mu_str_display_contact (const char *str);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -87,8 +87,8 @@ char *mu_msg_str_display_contact (const char *str);
|
|||
* 1000*1000, k for smaller sizes. Note: this function use the
|
||||
* 10-based SI units, _not_ the powers-of-2 based ones.
|
||||
*
|
||||
* mu_msg_str_size_s returns a ptr to a static buffer,
|
||||
* while mu_msg_str_size returns dynamically allocated
|
||||
* mu_str_size_s returns a ptr to a static buffer,
|
||||
* while mu_str_size returns dynamically allocated
|
||||
* memory that must be freed after use.
|
||||
*
|
||||
* @param t the size as an size_t
|
||||
|
@ -96,8 +96,8 @@ char *mu_msg_str_display_contact (const char *str);
|
|||
* @return a string representation of the size; see above
|
||||
* for what to do with it
|
||||
*/
|
||||
const char* mu_msg_str_size_s (size_t s) G_GNUC_CONST;
|
||||
char* mu_msg_str_size (size_t s) G_GNUC_WARN_UNUSED_RESULT;
|
||||
const char* mu_str_size_s (size_t s) G_GNUC_CONST;
|
||||
char* mu_str_size (size_t s) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* get a display string for a given set of flags, OR'ed in
|
||||
|
@ -105,8 +105,8 @@ char* mu_msg_str_size (size_t s) G_GNUC_WARN_UNUSED_RESULT;
|
|||
* D=draft,F=flagged,N=new,P=passed,R=replied,S=seen,T=trashed
|
||||
* a=has-attachment,s=signed, x=encrypted
|
||||
*
|
||||
* mu_msg_str_file_flags_s returns a ptr to a static buffer,
|
||||
* while mu_msg_str_file_flags returns dynamically allocated
|
||||
* mu_str_file_flags_s returns a ptr to a static buffer,
|
||||
* while mu_str_file_flags returns dynamically allocated
|
||||
* memory that must be freed after use.
|
||||
*
|
||||
* @param flags file flags
|
||||
|
@ -114,8 +114,8 @@ char* mu_msg_str_size (size_t s) G_GNUC_WARN_UNUSED_RESULT;
|
|||
* @return a string representation of the flags; see above
|
||||
* for what to do with it
|
||||
*/
|
||||
const char* mu_msg_str_flags_s (MuMsgFlags flags) G_GNUC_CONST;
|
||||
char* mu_msg_str_flags (MuMsgFlags flags) G_GNUC_WARN_UNUSED_RESULT;
|
||||
const char* mu_str_flags_s (MuMsgFlags flags) G_GNUC_CONST;
|
||||
char* mu_str_flags (MuMsgFlags flags) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -127,7 +127,7 @@ char* mu_msg_str_flags (MuMsgFlags flags) G_GNUC_WARN_UNUSED_RESULT;
|
|||
*
|
||||
* @return a newly allocated string with the summary. use g_free to free it.
|
||||
*/
|
||||
char* mu_msg_str_summarize (const char* str,
|
||||
char* mu_str_summarize (const char* str,
|
||||
size_t max_lines) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
|
@ -142,22 +142,22 @@ char* mu_msg_str_summarize (const char* str,
|
|||
*
|
||||
* @return the normalize string, or NULL in case of error or str was NULL
|
||||
*/
|
||||
char* mu_msg_str_normalize (const char *str, gboolean downcase);
|
||||
char* mu_str_normalize (const char *str, gboolean downcase);
|
||||
|
||||
|
||||
/**
|
||||
* normalize a string (ie., collapse accented characters etc.), and
|
||||
* optionally, downcase it. this happen by changing the string; if
|
||||
* that is not desired, use mu_msg_str_normalize
|
||||
* that is not desired, use mu_str_normalize
|
||||
*
|
||||
* @param str a valid utf8 string or NULL
|
||||
* @param downcase if TRUE, convert the string to lowercase
|
||||
*
|
||||
* @return the normalize string, or NULL in case of error or str was NULL
|
||||
*/
|
||||
char* mu_msg_str_normalize_in_place (char *str, gboolean downcase);
|
||||
char* mu_str_normalize_in_place (char *str, gboolean downcase);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /*__MU_MSG_STR_H__*/
|
||||
#endif /*__MU_STR_H__*/
|
|
@ -40,9 +40,9 @@ TEST_PROGS += test-mu-util
|
|||
test_mu_util_SOURCES= test-mu-util.c
|
||||
test_mu_util_LDADD= libtestmucommon.la
|
||||
|
||||
TEST_PROGS += test-mu-msg-str
|
||||
test_mu_msg_str_SOURCES= test-mu-msg-str.c
|
||||
test_mu_msg_str_LDADD= libtestmucommon.la
|
||||
TEST_PROGS += test-mu-str
|
||||
test_mu_str_SOURCES= test-mu-str.c
|
||||
test_mu_str_LDADD= libtestmucommon.la
|
||||
|
||||
TEST_PROGS += test-mu-maildir
|
||||
test_mu_maildir_SOURCES= test-mu-maildir.c
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
#include <locale.h>
|
||||
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-msg-str.h"
|
||||
#include "src/mu-str.h"
|
||||
#include "src/mu-msg-prio.h"
|
||||
|
||||
static void
|
||||
test_mu_msg_str_date_01 (void)
|
||||
test_mu_str_date_01 (void)
|
||||
{
|
||||
struct tm *tmbuf;
|
||||
char buf[64];
|
||||
|
@ -45,13 +45,13 @@ test_mu_msg_str_date_01 (void)
|
|||
strftime (buf, 64, "%x", tmbuf);
|
||||
|
||||
/* $ date -ud@1234567890; Fri Feb 13 23:31:30 UTC 2009 */
|
||||
g_assert_cmpstr (mu_msg_str_date_s ("%x", some_time), ==, buf);
|
||||
g_assert_cmpstr (mu_str_date_s ("%x", some_time), ==, buf);
|
||||
|
||||
/* date -ud@987654321 Thu Apr 19 04:25:21 UTC 2001 */
|
||||
some_time = 987654321;
|
||||
tmbuf = localtime (&some_time);
|
||||
strftime (buf, 64, "%c", tmbuf);
|
||||
tmp = mu_msg_str_date ("%c", some_time);
|
||||
tmp = mu_str_date ("%c", some_time);
|
||||
|
||||
g_assert_cmpstr (tmp, ==, buf);
|
||||
g_free (tmp);
|
||||
|
@ -60,7 +60,7 @@ test_mu_msg_str_date_01 (void)
|
|||
|
||||
|
||||
static void
|
||||
test_mu_msg_str_size_01 (void)
|
||||
test_mu_str_size_01 (void)
|
||||
{
|
||||
struct lconv *lc;
|
||||
char *tmp2;
|
||||
|
@ -68,22 +68,22 @@ test_mu_msg_str_size_01 (void)
|
|||
lc = localeconv();
|
||||
|
||||
tmp2 = g_strdup_printf ("0%s0 kB", lc->decimal_point);
|
||||
g_assert_cmpstr (mu_msg_str_size_s (0), ==, tmp2);
|
||||
g_assert_cmpstr (mu_str_size_s (0), ==, tmp2);
|
||||
g_free (tmp2);
|
||||
|
||||
tmp2 = g_strdup_printf ("100%s0 kB", lc->decimal_point);
|
||||
g_assert_cmpstr (mu_msg_str_size_s (100000), ==, tmp2);
|
||||
g_assert_cmpstr (mu_str_size_s (100000), ==, tmp2);
|
||||
g_free (tmp2);
|
||||
|
||||
tmp2 = g_strdup_printf ("1%s1 MB", lc->decimal_point);
|
||||
g_assert_cmpstr (mu_msg_str_size_s (1100*1000), ==, tmp2);
|
||||
g_assert_cmpstr (mu_str_size_s (1100*1000), ==, tmp2);
|
||||
g_free (tmp2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
test_mu_msg_str_size_02 (void)
|
||||
test_mu_str_size_02 (void)
|
||||
{
|
||||
struct lconv *lc;
|
||||
char *tmp1, *tmp2;
|
||||
|
@ -91,7 +91,7 @@ test_mu_msg_str_size_02 (void)
|
|||
lc = localeconv();
|
||||
|
||||
tmp2 = g_strdup_printf ("1%s0 MB", lc->decimal_point);
|
||||
tmp1 = mu_msg_str_size (999999);
|
||||
tmp1 = mu_str_size (999999);
|
||||
g_assert_cmpstr (tmp1, !=, tmp2);
|
||||
|
||||
g_free (tmp1);
|
||||
|
@ -101,7 +101,7 @@ test_mu_msg_str_size_02 (void)
|
|||
|
||||
|
||||
static void
|
||||
test_mu_msg_str_prio_01 (void)
|
||||
test_mu_str_prio_01 (void)
|
||||
{
|
||||
g_assert_cmpstr(mu_msg_prio_name(MU_MSG_PRIO_LOW), ==, "low");
|
||||
g_assert_cmpstr(mu_msg_prio_name(MU_MSG_PRIO_NORMAL), ==, "normal");
|
||||
|
@ -118,7 +118,7 @@ ignore_error (const char* log_domain, GLogLevelFlags log_level,
|
|||
|
||||
|
||||
static void
|
||||
test_mu_msg_str_prio_02 (void)
|
||||
test_mu_str_prio_02 (void)
|
||||
{
|
||||
/* this must fail */
|
||||
g_test_log_set_fatal_handler ((GTestLogFatalFunc)ignore_error, NULL);
|
||||
|
@ -128,7 +128,7 @@ test_mu_msg_str_prio_02 (void)
|
|||
|
||||
|
||||
static void
|
||||
test_mu_msg_str_normalize_01 (void)
|
||||
test_mu_str_normalize_01 (void)
|
||||
{
|
||||
int i;
|
||||
struct {
|
||||
|
@ -145,7 +145,7 @@ test_mu_msg_str_normalize_01 (void)
|
|||
|
||||
for (i = 0; i != G_N_ELEMENTS(words); ++i) {
|
||||
gchar *str;
|
||||
str = mu_msg_str_normalize (words[i].word, TRUE);
|
||||
str = mu_str_normalize (words[i].word, TRUE);
|
||||
g_assert_cmpstr (str, ==, words[i].norm);
|
||||
g_free (str);
|
||||
}
|
||||
|
@ -160,28 +160,28 @@ main (int argc, char *argv[])
|
|||
{
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
/* mu_msg_str_date */
|
||||
/* mu_str_date */
|
||||
g_test_add_func ("/mu-msg-str/mu-msg-str-date",
|
||||
test_mu_msg_str_date_01);
|
||||
test_mu_str_date_01);
|
||||
|
||||
/* mu_msg_str_size */
|
||||
/* mu_str_size */
|
||||
g_test_add_func ("/mu-msg-str/mu-msg-str-size-01",
|
||||
test_mu_msg_str_size_01);
|
||||
test_mu_str_size_01);
|
||||
g_test_add_func ("/mu-msg-str/mu-msg-str-size-02",
|
||||
test_mu_msg_str_size_02);
|
||||
test_mu_str_size_02);
|
||||
|
||||
/* mu_msg_str_prio */
|
||||
/* mu_str_prio */
|
||||
g_test_add_func ("/mu-msg-str/mu-msg-str-prio-01",
|
||||
test_mu_msg_str_prio_01);
|
||||
test_mu_str_prio_01);
|
||||
g_test_add_func ("/mu-msg-str/mu-msg-str-prio-02",
|
||||
test_mu_msg_str_prio_02);
|
||||
test_mu_str_prio_02);
|
||||
|
||||
/* mu_msg_str_normalize */
|
||||
/* mu_str_normalize */
|
||||
g_test_add_func ("/mu-msg-str/mu-msg-str-normalize-01",
|
||||
test_mu_msg_str_normalize_01);
|
||||
test_mu_str_normalize_01);
|
||||
|
||||
|
||||
/* FIXME: add tests for mu_msg_str_flags; but note the
|
||||
/* FIXME: add tests for mu_str_flags; but note the
|
||||
* function simply calls mu_msg_field_str */
|
||||
|
||||
g_log_set_handler (NULL,
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "mug-msg-list-view.h"
|
||||
#include "mu-query.h"
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-str.h"
|
||||
/* include other impl specific header files */
|
||||
|
||||
/* 'private'/'protected' functions */
|
||||
|
@ -298,7 +298,7 @@ empty_or_display_contact (const gchar* str)
|
|||
if (!str || *str == '\0')
|
||||
return g_strdup ("-");
|
||||
else
|
||||
return mu_msg_str_display_contact (str);
|
||||
return mu_str_display_contact (str);
|
||||
|
||||
}
|
||||
|
||||
|
@ -334,7 +334,7 @@ add_row (GtkListStore *store, MuMsgIter *iter)
|
|||
time_t date;
|
||||
|
||||
date = mu_msg_iter_get_date (iter);
|
||||
datestr = date == 0 ? "-" : mu_msg_str_display_date_s (date);
|
||||
datestr = date == 0 ? "-" : mu_str_display_date_s (date);
|
||||
from = empty_or_display_contact (mu_msg_iter_get_from(iter));
|
||||
to = empty_or_display_contact (mu_msg_iter_get_to(iter));
|
||||
flagstr = mu_msg_flags_str_s(mu_msg_iter_get_flags (iter));
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "mug-msg-view.h"
|
||||
#include "mu-msg.h"
|
||||
#include "mu-msg-str.h"
|
||||
#include "mu-str.h"
|
||||
|
||||
/* 'private'/'protected' functions */
|
||||
static void mug_msg_view_class_init (MugMsgViewClass *klass);
|
||||
|
@ -243,10 +243,10 @@ fill_header (MugMsgViewPrivate *priv, MuMsg* msg)
|
|||
case HEADER_ROW_MSGID: val = mu_msg_get_msgid(msg); break;
|
||||
case HEADER_ROW_CC: val = mu_msg_get_cc (msg); break;
|
||||
case HEADER_ROW_PATH: val = mu_msg_get_path (msg); break;
|
||||
case HEADER_ROW_DATE: val = mu_msg_str_date_s(
|
||||
case HEADER_ROW_DATE: val = mu_str_date_s(
|
||||
"%c", mu_msg_get_date (msg));
|
||||
break;
|
||||
case HEADER_ROW_SIZE: val = mu_msg_str_size_s (mu_msg_get_size(msg));
|
||||
case HEADER_ROW_SIZE: val = mu_str_size_s (mu_msg_get_size(msg));
|
||||
break;
|
||||
default: val = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue