mirror of https://github.com/djcb/mu.git
lib: add last_child flag to thread information
With that flag it's possible to reconstruct the entire thread tree structure in mu4e.
This commit is contained in:
parent
b4cc67d455
commit
297120dc6c
|
@ -571,7 +571,8 @@ count_colons (const char *str)
|
||||||
|
|
||||||
static MuMsgIterThreadInfo*
|
static MuMsgIterThreadInfo*
|
||||||
thread_info_new (gchar *threadpath, gboolean root, gboolean first_child,
|
thread_info_new (gchar *threadpath, gboolean root, gboolean first_child,
|
||||||
gboolean empty_parent, gboolean has_child, gboolean is_dup)
|
gboolean last_child, gboolean empty_parent,
|
||||||
|
gboolean has_child, gboolean is_dup)
|
||||||
{
|
{
|
||||||
MuMsgIterThreadInfo *ti;
|
MuMsgIterThreadInfo *ti;
|
||||||
|
|
||||||
|
@ -582,6 +583,7 @@ thread_info_new (gchar *threadpath, gboolean root, gboolean first_child,
|
||||||
ti->prop = MU_MSG_ITER_THREAD_PROP_NONE;
|
ti->prop = MU_MSG_ITER_THREAD_PROP_NONE;
|
||||||
ti->prop |= root ? MU_MSG_ITER_THREAD_PROP_ROOT : 0;
|
ti->prop |= root ? MU_MSG_ITER_THREAD_PROP_ROOT : 0;
|
||||||
ti->prop |= first_child ? MU_MSG_ITER_THREAD_PROP_FIRST_CHILD : 0;
|
ti->prop |= first_child ? MU_MSG_ITER_THREAD_PROP_FIRST_CHILD : 0;
|
||||||
|
ti->prop |= last_child ? MU_MSG_ITER_THREAD_PROP_LAST_CHILD : 0;
|
||||||
ti->prop |= empty_parent ? MU_MSG_ITER_THREAD_PROP_EMPTY_PARENT : 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 |= is_dup ? MU_MSG_ITER_THREAD_PROP_DUP : 0;
|
||||||
ti->prop |= has_child ? MU_MSG_ITER_THREAD_PROP_HAS_CHILD : 0;
|
ti->prop |= has_child ? MU_MSG_ITER_THREAD_PROP_HAS_CHILD : 0;
|
||||||
|
@ -610,12 +612,13 @@ static void
|
||||||
add_to_thread_info_hash (GHashTable *thread_info_hash, MuContainer *c,
|
add_to_thread_info_hash (GHashTable *thread_info_hash, MuContainer *c,
|
||||||
char *threadpath)
|
char *threadpath)
|
||||||
{
|
{
|
||||||
gboolean is_root, first_child, empty_parent, is_dup, has_child;
|
gboolean is_root, first_child, last_child, empty_parent, is_dup, has_child;
|
||||||
|
|
||||||
/* 'root' means we're a child of the dummy root-container */
|
/* 'root' means we're a child of the dummy root-container */
|
||||||
is_root = (c->parent == NULL);
|
is_root = (c->parent == NULL);
|
||||||
|
|
||||||
first_child = is_root ? FALSE : (c->parent->child == c);
|
first_child = is_root ? FALSE : (c->parent->child == c);
|
||||||
|
last_child = is_root ? FALSE : (c->next == NULL);
|
||||||
empty_parent = is_root ? FALSE : (!c->parent->msg);
|
empty_parent = is_root ? FALSE : (!c->parent->msg);
|
||||||
is_dup = c->flags & MU_CONTAINER_FLAG_DUP;
|
is_dup = c->flags & MU_CONTAINER_FLAG_DUP;
|
||||||
has_child = c->child ? TRUE : FALSE;
|
has_child = c->child ? TRUE : FALSE;
|
||||||
|
@ -625,6 +628,7 @@ add_to_thread_info_hash (GHashTable *thread_info_hash, MuContainer *c,
|
||||||
thread_info_new (threadpath,
|
thread_info_new (threadpath,
|
||||||
is_root,
|
is_root,
|
||||||
first_child,
|
first_child,
|
||||||
|
last_child,
|
||||||
empty_parent,
|
empty_parent,
|
||||||
has_child,
|
has_child,
|
||||||
is_dup));
|
is_dup));
|
||||||
|
|
|
@ -163,9 +163,10 @@ enum _MuMsgIterThreadProp {
|
||||||
|
|
||||||
MU_MSG_ITER_THREAD_PROP_ROOT = 1 << 0,
|
MU_MSG_ITER_THREAD_PROP_ROOT = 1 << 0,
|
||||||
MU_MSG_ITER_THREAD_PROP_FIRST_CHILD = 1 << 1,
|
MU_MSG_ITER_THREAD_PROP_FIRST_CHILD = 1 << 1,
|
||||||
MU_MSG_ITER_THREAD_PROP_EMPTY_PARENT = 1 << 2,
|
MU_MSG_ITER_THREAD_PROP_LAST_CHILD = 1 << 2,
|
||||||
MU_MSG_ITER_THREAD_PROP_DUP = 1 << 3,
|
MU_MSG_ITER_THREAD_PROP_EMPTY_PARENT = 1 << 3,
|
||||||
MU_MSG_ITER_THREAD_PROP_HAS_CHILD = 1 << 4
|
MU_MSG_ITER_THREAD_PROP_DUP = 1 << 4,
|
||||||
|
MU_MSG_ITER_THREAD_PROP_HAS_CHILD = 1 << 5
|
||||||
};
|
};
|
||||||
typedef guint8 MuMsgIterThreadProp;
|
typedef guint8 MuMsgIterThreadProp;
|
||||||
|
|
||||||
|
|
|
@ -434,11 +434,13 @@ static void
|
||||||
append_sexp_thread_info (GString *gstr, const MuMsgIterThreadInfo *ti)
|
append_sexp_thread_info (GString *gstr, const MuMsgIterThreadInfo *ti)
|
||||||
{
|
{
|
||||||
g_string_append_printf
|
g_string_append_printf
|
||||||
(gstr, "\t:thread (:path \"%s\" :level %u%s%s%s%s)\n",
|
(gstr, "\t:thread (:path \"%s\" :level %u%s%s%s%s%s)\n",
|
||||||
ti->threadpath,
|
ti->threadpath,
|
||||||
ti->level,
|
ti->level,
|
||||||
ti->prop & MU_MSG_ITER_THREAD_PROP_FIRST_CHILD ?
|
ti->prop & MU_MSG_ITER_THREAD_PROP_FIRST_CHILD ?
|
||||||
" :first-child t" : "",
|
" :first-child t" : "",
|
||||||
|
ti->prop & MU_MSG_ITER_THREAD_PROP_LAST_CHILD ?
|
||||||
|
" :last-child t" : "",
|
||||||
ti->prop & MU_MSG_ITER_THREAD_PROP_EMPTY_PARENT ?
|
ti->prop & MU_MSG_ITER_THREAD_PROP_EMPTY_PARENT ?
|
||||||
" :empty-parent t" : "",
|
" :empty-parent t" : "",
|
||||||
ti->prop & MU_MSG_ITER_THREAD_PROP_DUP ?
|
ti->prop & MU_MSG_ITER_THREAD_PROP_DUP ?
|
||||||
|
|
Loading…
Reference in New Issue