* gnoemoe/mcp/gm-mcp-icecrew-userlist.c: change the behavior for
fetching icons so that only one icon at a time is being fetched. This is needed to make the fetching fully async (before we checked whether the remove icon existed before trying to fetch it, which could block gnoemoe if the icon remote host was down). By only fetching one icon we can work around the bugs in gnome-vfs that don't allow proper error handling for fetching multiple files. Closes debian bug #388321
This commit is contained in:
parent
9e968f1218
commit
a8dadeb408
|
@ -417,7 +417,7 @@ gm_mcp_icecrew_userlist_remote_to_local_path(gchar const *url,
|
|||
|
||||
void
|
||||
gm_mcp_icecrew_userlist_remove_alternatives(GmMcpIcecrewUserlist *package,
|
||||
gchar *path, gint n, gboolean rank) {
|
||||
gchar const *path, gint n, gboolean rank) {
|
||||
GList *item, **alter;
|
||||
gint i;
|
||||
GmKeyValuePair *map;
|
||||
|
@ -459,7 +459,7 @@ gm_mcp_icecrew_userlist_remove_alternatives(GmMcpIcecrewUserlist *package,
|
|||
break;
|
||||
}
|
||||
|
||||
g_free(path);
|
||||
g_free(pathd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,8 +576,6 @@ gm_mcp_icecrew_userlist_fetch_next_alternatives(GmMcpIcecrewUserlist *package,
|
|||
gchar *prev_name = NULL, *path;
|
||||
GList *item, **alter, *iter;
|
||||
GmKeyValuePair *map, *itermap;
|
||||
GnomeVFSResult result;
|
||||
GnomeVFSFileInfo *finfo;
|
||||
|
||||
/* Select unique name alternatives */
|
||||
alter = rank ? &(package->priv->rank_alternatives) :
|
||||
|
@ -593,53 +591,38 @@ gm_mcp_icecrew_userlist_fetch_next_alternatives(GmMcpIcecrewUserlist *package,
|
|||
/* Skip alternatives with names we've already stored to be fetched */
|
||||
if (prev_name == NULL || (map->key != NULL &&
|
||||
strcmp(map->key, prev_name) != 0)) {
|
||||
finfo = gnome_vfs_file_info_new();
|
||||
result = gnome_vfs_get_file_info(map->value, finfo,
|
||||
GNOME_VFS_FILE_INFO_DEFAULT);
|
||||
gnome_vfs_file_info_unref(finfo);
|
||||
|
||||
if (result != GNOME_VFS_OK) {
|
||||
gm_debug_msg(DEBUG_MCP, "GmMcpIcecrewUserlist."
|
||||
"FetchNextAlternatives: removing %s because it's "
|
||||
"invalid: %s", map->value,
|
||||
gnome_vfs_result_to_string(result));
|
||||
item = item->next;
|
||||
prev_name = map->key;
|
||||
|
||||
*alter = g_list_remove(*alter, map);
|
||||
gm_mcp_icecrew_userlist_pair_free(map);
|
||||
} else {
|
||||
prev_name = map->key;
|
||||
path = gm_mcp_icecrew_userlist_remote_to_local_path(map->value,
|
||||
rank ? package->priv->rank_dir :
|
||||
package->priv->state_dir);
|
||||
|
||||
gm_debug_msg(DEBUG_MCP, "GmMcpIcecrewUserlist."
|
||||
"FetchNextAlternatives: adding to be fetched: %s => %s",
|
||||
map->key, map->value);
|
||||
|
||||
path = gm_mcp_icecrew_userlist_remote_to_local_path(map->value,
|
||||
rank ? package->priv->rank_dir :
|
||||
package->priv->state_dir);
|
||||
|
||||
gm_debug_msg(DEBUG_MCP, "GmMcpIcecrewUserlist."
|
||||
"FetchNextAlternatives: adding to be fetched: %s => %s",
|
||||
map->key, map->value);
|
||||
|
||||
source_uri = g_list_append(source_uri, map->value);
|
||||
dest_uri = g_list_append(dest_uri, path);
|
||||
|
||||
unlink(path);
|
||||
|
||||
for (iter = rank ? package->priv->rank_icons :
|
||||
package->priv->state_icons; iter; iter = iter->next) {
|
||||
itermap = (GmKeyValuePair *)(iter->data);
|
||||
|
||||
if (itermap->key != NULL &&
|
||||
strcmp(itermap->key, map->key) == 0) {
|
||||
g_free(itermap->value);
|
||||
itermap->value = g_strdup(path);
|
||||
break;
|
||||
}
|
||||
source_uri = g_list_append(source_uri, map->value);
|
||||
dest_uri = g_list_append(dest_uri, path);
|
||||
|
||||
unlink(path);
|
||||
|
||||
for (iter = rank ? package->priv->rank_icons :
|
||||
package->priv->state_icons; iter; iter = iter->next) {
|
||||
itermap = (GmKeyValuePair *)(iter->data);
|
||||
|
||||
if (itermap->key != NULL &&
|
||||
strcmp(itermap->key, map->key) == 0) {
|
||||
g_free(itermap->value);
|
||||
itermap->value = g_strdup(path);
|
||||
break;
|
||||
}
|
||||
|
||||
item = item->next;
|
||||
}
|
||||
} else {
|
||||
item = item->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (source_uri != NULL)
|
||||
break;
|
||||
|
||||
item = item->next;
|
||||
}
|
||||
|
||||
if (source_uri != NULL) {
|
||||
|
@ -682,6 +665,11 @@ gm_mcp_icecrew_userlist_fetch_progress(GmFetchHandle *g,
|
|||
if (g->done) {
|
||||
gm_debug_msg(DEBUG_MCP, "GmMcpIcecrewUserlist.FetchProgress: "
|
||||
"fetch done!");
|
||||
|
||||
/* Remove this one from the alternatives */
|
||||
gm_mcp_icecrew_userlist_remove_alternatives(package,
|
||||
gnome_vfs_uri_get_path((GnomeVFSURI *)(g->dest_uri->data)),
|
||||
1, rank);
|
||||
|
||||
if (rank) {
|
||||
package->priv->rank_fetch = NULL;
|
||||
|
@ -697,9 +685,6 @@ gm_mcp_icecrew_userlist_fetch_progress(GmFetchHandle *g,
|
|||
if (g->status == GNOME_VFS_XFER_PROGRESS_STATUS_VFSERROR) {
|
||||
/* Skip to the next alternative (in the next run, see on done */
|
||||
gm_debug_msg(DEBUG_MCP, "GmMcpIcecrewUserlist.FetchProgress: error");
|
||||
path = gnome_vfs_get_local_path_from_uri(g->cur_file_name);
|
||||
gm_mcp_icecrew_userlist_remove_alternatives(package, path, 1, rank);
|
||||
g_free(path);
|
||||
}
|
||||
|
||||
if (g->cur_phase == GNOME_VFS_XFER_PHASE_FILECOMPLETED) {
|
||||
|
|
Reference in New Issue