* merge branch 'master' of github.com:djcb/mu

This commit is contained in:
djcb
2013-06-13 23:56:35 +03:00
20 changed files with 403 additions and 206 deletions

View File

@ -520,7 +520,7 @@ count_colons (const char *str)
static MuMsgIterThreadInfo*
thread_info_new (gchar *threadpath, gboolean root, gboolean child,
thread_info_new (gchar *threadpath, gboolean root, gboolean first_child,
gboolean empty_parent, gboolean has_child, gboolean is_dup)
{
MuMsgIterThreadInfo *ti;
@ -529,9 +529,9 @@ thread_info_new (gchar *threadpath, gboolean root, gboolean child,
ti->threadpath = threadpath;
ti->level = count_colons (threadpath); /* hacky... */
ti->prop = 0;
ti->prop = MU_MSG_ITER_THREAD_PROP_NONE;
ti->prop |= root ? MU_MSG_ITER_THREAD_PROP_ROOT : 0;
ti->prop |= child ? MU_MSG_ITER_THREAD_PROP_FIRST_CHILD : 0;
ti->prop |= first_child ? MU_MSG_ITER_THREAD_PROP_FIRST_CHILD : 0;
ti->prop |= empty_parent ? MU_MSG_ITER_THREAD_PROP_EMPTY_PARENT : 0;
ti->prop |= is_dup ? MU_MSG_ITER_THREAD_PROP_DUP : 0;
ti->prop |= has_child ? MU_MSG_ITER_THREAD_PROP_HAS_CHILD : 0;

View File

@ -159,6 +159,8 @@ gboolean mu_msg_iter_calculate_threads (MuMsgIter *iter);
enum _MuMsgIterThreadProp {
MU_MSG_ITER_THREAD_PROP_NONE = 0 << 0,
MU_MSG_ITER_THREAD_PROP_ROOT = 1 << 0,
MU_MSG_ITER_THREAD_PROP_FIRST_CHILD = 1 << 1,
MU_MSG_ITER_THREAD_PROP_EMPTY_PARENT = 1 << 2,

View File

@ -438,7 +438,6 @@ mu_util_locale_is_utf8 (void)
gboolean
mu_util_fputs_encoded (const char *str, FILE *stream)
{
char *conv;
int rv;
g_return_val_if_fail (str, FALSE);
@ -449,10 +448,14 @@ mu_util_fputs_encoded (const char *str, FILE *stream)
rv = fputs (str, stream);
else { /* charset is _not_ utf8, so we actually have to
* convert it..*/
GError *err;
unsigned bytes;
err = NULL;
GError *err;
unsigned bytes;
char *conv;
err = NULL;
conv = g_locale_from_utf8 (str, -1, (gsize*)&bytes, NULL, &err);
if (!conv || err) {
/* conversion failed; this happens because is
* some cases GMime may gives us non-UTF-8
@ -462,14 +465,15 @@ mu_util_fputs_encoded (const char *str, FILE *stream)
g_warning ("%s: g_locale_from_utf8 failed: %s",
__FUNCTION__,
err ? err->message : "conversion failed");
g_clear_error (&err);
g_free (conv);
conv = g_strescape (str, NULL);
}
g_clear_error (&err);
rv = fputs (conv, stream);
g_free (conv);
}
}
return (rv == EOF) ? FALSE : TRUE;
}