mirror of https://github.com/djcb/mu.git
* guile: cosmetic
This commit is contained in:
parent
b4443d1eae
commit
1df0e31062
|
@ -302,7 +302,7 @@ typedef struct _AttInfo AttInfo;
|
||||||
static void
|
static void
|
||||||
each_part (MuMsg *msg, MuMsgPart *part, AttInfo *attinfo)
|
each_part (MuMsg *msg, MuMsgPart *part, AttInfo *attinfo)
|
||||||
{
|
{
|
||||||
char *mime_type;
|
char *mime_type, *filename;
|
||||||
SCM elm;
|
SCM elm;
|
||||||
|
|
||||||
if (!part->type)
|
if (!part->type)
|
||||||
|
@ -312,6 +312,7 @@ each_part (MuMsg *msg, MuMsgPart *part, AttInfo *attinfo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mime_type = g_strdup_printf ("%s/%s", part->type, part->subtype);
|
mime_type = g_strdup_printf ("%s/%s", part->type, part->subtype);
|
||||||
|
filename = mu_msg_part_get_filename (part, FALSE);
|
||||||
|
|
||||||
elm = scm_list_5 (
|
elm = scm_list_5 (
|
||||||
/* msg */
|
/* msg */
|
||||||
|
@ -319,19 +320,14 @@ each_part (MuMsg *msg, MuMsgPart *part, AttInfo *attinfo)
|
||||||
/* index */
|
/* index */
|
||||||
scm_from_uint(part->index),
|
scm_from_uint(part->index),
|
||||||
/* filename or #f */
|
/* filename or #f */
|
||||||
part->file_name ?
|
filename ? mu_guile_scm_from_str (filename) : SCM_BOOL_F,
|
||||||
mu_guile_scm_from_str (part->file_name) :
|
|
||||||
SCM_BOOL_F,
|
|
||||||
/* mime-type */
|
/* mime-type */
|
||||||
mime_type ?
|
mime_type ? mu_guile_scm_from_str (mime_type): SCM_BOOL_F,
|
||||||
mu_guile_scm_from_str (mime_type):
|
|
||||||
SCM_BOOL_F,
|
|
||||||
/* size */
|
/* size */
|
||||||
part->size > 0 ?
|
part->size > 0 ? scm_from_uint (part->size) : SCM_BOOL_F);
|
||||||
scm_from_uint (part->size) :
|
|
||||||
SCM_BOOL_F);
|
|
||||||
|
|
||||||
g_free (mime_type);
|
g_free (mime_type);
|
||||||
|
g_free (filename);
|
||||||
|
|
||||||
attinfo->attlist = scm_cons (elm, attinfo->attlist);
|
attinfo->attlist = scm_cons (elm, attinfo->attlist);
|
||||||
}
|
}
|
||||||
|
@ -356,9 +352,9 @@ SCM_DEFINE (get_parts, "mu:c:get-parts", 1, 1, 0,
|
||||||
attinfo.attachments_only = ATTS_ONLY == SCM_BOOL_T ? TRUE : FALSE;
|
attinfo.attachments_only = ATTS_ONLY == SCM_BOOL_T ? TRUE : FALSE;
|
||||||
|
|
||||||
msgwrap = (MuMsgWrapper*) SCM_CDR(MSG);
|
msgwrap = (MuMsgWrapper*) SCM_CDR(MSG);
|
||||||
mu_msg_part_foreach (msgwrap->_msg,
|
mu_msg_part_foreach (msgwrap->_msg, MU_MSG_OPTION_NONE,
|
||||||
(MuMsgPartForeachFunc)each_part,
|
(MuMsgPartForeachFunc)each_part,
|
||||||
&attinfo, MU_MSG_OPTION_NONE);
|
&attinfo);
|
||||||
|
|
||||||
/* explicitly close the file backend, so we won't run of fds */
|
/* explicitly close the file backend, so we won't run of fds */
|
||||||
mu_msg_unload_msg_file (msgwrap->_msg);
|
mu_msg_unload_msg_file (msgwrap->_msg);
|
||||||
|
|
|
@ -88,26 +88,26 @@ mu_guile_init_instance (const char *muhome)
|
||||||
if (!mu_runtime_init (muhome, "guile"))
|
if (!mu_runtime_init (muhome, "guile"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
err = NULL;
|
||||||
store = mu_store_new_read_only (mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB),
|
store = mu_store_new_read_only (mu_runtime_path(MU_RUNTIME_PATH_XAPIANDB),
|
||||||
&err);
|
&err);
|
||||||
if (!store) {
|
if (!store)
|
||||||
mu_guile_g_error (__FUNCTION__, err);
|
goto errexit;
|
||||||
g_clear_error (&err);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
query = mu_query_new (store, &err);
|
query = mu_query_new (store, &err);
|
||||||
mu_store_unref (store);
|
mu_store_unref (store);
|
||||||
if (!query) {
|
if (!query)
|
||||||
mu_guile_g_error (__FUNCTION__, err);
|
goto errexit;
|
||||||
g_clear_error (&err);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
_singleton = g_new0 (MuGuile, 1);
|
_singleton = g_new0 (MuGuile, 1);
|
||||||
_singleton->query = query;
|
_singleton->query = query;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
errexit:
|
||||||
|
mu_guile_g_error (__FUNCTION__, err);
|
||||||
|
g_clear_error (&err);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -161,7 +161,7 @@ SCM_DEFINE_PUBLIC (mu_initialize, "mu:initialize", 0, 1, 0,
|
||||||
else
|
else
|
||||||
muhome = scm_to_utf8_string (MUHOME);
|
muhome = scm_to_utf8_string (MUHOME);
|
||||||
|
|
||||||
rv = mu_guile_init_instance(muhome);
|
rv = mu_guile_init_instance (muhome);
|
||||||
free (muhome);
|
free (muhome);
|
||||||
|
|
||||||
if (!rv)
|
if (!rv)
|
||||||
|
|
Loading…
Reference in New Issue