mirror of https://github.com/djcb/mu.git
* toys/widgets: update for mumsgpart changes
This commit is contained in:
parent
279f627c5e
commit
1cd20c9921
|
@ -67,36 +67,36 @@ save_file_for_cid (MuMsg *msg, const char* cid)
|
|||
{
|
||||
gint idx;
|
||||
gchar *filepath;
|
||||
gboolean rv;
|
||||
GError *err;
|
||||
|
||||
g_return_val_if_fail (msg, NULL);
|
||||
g_return_val_if_fail (cid, NULL);
|
||||
|
||||
idx = mu_msg_part_find_cid (msg, cid);
|
||||
idx = mu_msg_find_index_for_cid (msg, MU_MSG_OPTION_NONE, cid);
|
||||
if (idx < 0) {
|
||||
g_warning ("%s: cannot find %s", __FUNCTION__, cid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
filepath = mu_msg_part_filepath_cache (msg, idx);
|
||||
if (!filepath) {
|
||||
g_warning ("%s: cannot create filepath", filepath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err = NULL;
|
||||
rv = mu_msg_part_save (msg, filepath, idx, FALSE, TRUE, &err);
|
||||
if (!rv) {
|
||||
filepath = mu_msg_part_get_cache_path (msg, MU_MSG_OPTION_NONE, idx, NULL);
|
||||
if (!filepath)
|
||||
goto errexit;
|
||||
|
||||
if (!mu_msg_part_save (msg, MU_MSG_OPTION_USE_EXISTING, filepath, idx,
|
||||
&err))
|
||||
goto errexit;
|
||||
|
||||
return filepath;
|
||||
|
||||
errexit:
|
||||
g_warning ("%s: failed to save %s: %s", __FUNCTION__,
|
||||
filepath,
|
||||
err&&err->message?err->message:"error");
|
||||
g_clear_error (&err);
|
||||
g_free (filepath);
|
||||
filepath = NULL;
|
||||
}
|
||||
|
||||
return filepath;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -128,10 +128,14 @@ accumulate_parts (MuMsgAttachView *self, GtkTreePath *path, GSList **lst)
|
|||
gchar *filepath;
|
||||
gint idx;
|
||||
gtk_tree_model_get (model, &iter, PARTNUM_COL, &idx, -1);
|
||||
filepath = mu_msg_part_filepath_cache (self->_priv->_msg, idx);
|
||||
filepath = mu_msg_part_get_cache_path (self->_priv->_msg,
|
||||
MU_MSG_OPTION_NONE,
|
||||
idx, NULL);
|
||||
if (filepath) {
|
||||
if (mu_msg_part_save (self->_priv->_msg, filepath,
|
||||
idx, FALSE, TRUE, NULL)) {
|
||||
if (mu_msg_part_save (self->_priv->_msg,
|
||||
MU_MSG_OPTION_USE_EXISTING,
|
||||
filepath,
|
||||
idx, NULL)) {
|
||||
GFile *file;
|
||||
file = g_file_new_for_path (filepath);
|
||||
*lst = g_slist_prepend (*lst, g_file_get_uri(file));
|
||||
|
@ -257,7 +261,7 @@ each_part (MuMsg *msg, MuMsgPart *part, CBData *cbdata)
|
|||
|
||||
gtk_list_store_append (cbdata->store, &treeiter);
|
||||
gtk_list_store_set (cbdata->store, &treeiter,
|
||||
NAME_COL, mu_msg_part_file_name (part),
|
||||
NAME_COL, mu_msg_part_get_filename (part, TRUE),
|
||||
ICON_COL, pixbuf,
|
||||
PARTNUM_COL, part->index,
|
||||
-1);
|
||||
|
@ -286,8 +290,8 @@ mu_msg_attach_view_set_message (MuMsgAttachView *self, MuMsg *msg)
|
|||
|
||||
cbdata.store = store;
|
||||
cbdata.count = 0;
|
||||
mu_msg_part_foreach (msg, (MuMsgPartForeachFunc)each_part, &cbdata,
|
||||
MU_MSG_OPTION_NONE);
|
||||
mu_msg_part_foreach (msg, MU_MSG_OPTION_NONE,
|
||||
(MuMsgPartForeachFunc)each_part, &cbdata);
|
||||
|
||||
return cbdata.count;
|
||||
}
|
||||
|
|
|
@ -108,25 +108,25 @@ save_file_for_cid (MuMsg *msg, const char* cid)
|
|||
g_return_val_if_fail (msg, NULL);
|
||||
g_return_val_if_fail (cid, NULL);
|
||||
|
||||
idx = mu_msg_part_find_cid (msg, cid);
|
||||
idx = mu_msg_find_index_for_cid (msg, MU_MSG_OPTION_NONE, cid);
|
||||
if (idx < 0) {
|
||||
g_warning ("%s: cannot find %s", __FUNCTION__, cid);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
filepath = mu_msg_part_filepath_cache (msg, idx);
|
||||
filepath = mu_msg_part_get_cache_path (msg, MU_MSG_OPTION_NONE, idx, NULL);
|
||||
if (!filepath) {
|
||||
g_warning ("%s: cannot create filepath", filepath);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err = NULL;
|
||||
rv = mu_msg_part_save (msg, filepath, idx, FALSE, TRUE, &err);
|
||||
rv = mu_msg_part_save (msg, MU_MSG_OPTION_USE_EXISTING,
|
||||
filepath, idx, &err);
|
||||
if (!rv) {
|
||||
g_warning ("%s: failed to save %s: %s", __FUNCTION__, filepath,
|
||||
err&&err->message?err->message:"error");
|
||||
if (err)
|
||||
g_error_free (err);
|
||||
g_clear_error (&err);
|
||||
g_free (filepath);
|
||||
filepath = NULL;
|
||||
}
|
||||
|
|
|
@ -115,32 +115,40 @@ on_body_action_requested (GtkWidget *w, const char* action,
|
|||
if (self->_priv->_msg)
|
||||
mu_msg_view_set_message (self, self->_priv->_msg);
|
||||
|
||||
} else if (g_strcmp0 (action, "reindex") == 0) {
|
||||
} else if (g_strcmp0 (action, "reindex") == 0)
|
||||
g_warning ("reindex");
|
||||
} else {
|
||||
else
|
||||
g_warning ("unknown action '%s'", action);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
on_attach_activated (GtkWidget *w, guint partnum, MuMsg *msg)
|
||||
{
|
||||
gchar *filepath;
|
||||
|
||||
filepath = mu_msg_part_filepath_cache (msg, partnum);
|
||||
if (filepath) {
|
||||
GError *err;
|
||||
|
||||
err = NULL;
|
||||
if (!mu_msg_part_save (msg, filepath, partnum, FALSE, TRUE, &err)) {
|
||||
filepath = mu_msg_part_get_cache_path (msg, MU_MSG_OPTION_NONE, partnum,
|
||||
&err);
|
||||
if (!filepath) {
|
||||
g_warning ("failed to get cache path: %s",
|
||||
err&&err->message?err->message:"error");
|
||||
g_clear_error (&err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mu_msg_part_save (msg, MU_MSG_OPTION_USE_EXISTING,
|
||||
filepath, partnum, &err)) {
|
||||
g_warning ("failed to save %s: %s", filepath,
|
||||
err&&err->message?err->message:"error");
|
||||
g_clear_error (&err);
|
||||
}
|
||||
return;
|
||||
|
||||
} else
|
||||
mu_util_play (filepath, TRUE, FALSE, NULL);
|
||||
|
||||
g_free (filepath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue