[virt-tools-list] [PATCH virt-viewer] !fixup Show failed file transfers
Jonathon Jongsma
jjongsma at redhat.com
Thu Oct 27 16:45:41 UTC 2016
---
Here's a possible solution. I don't think that a "continue" if the filename is
NULL would work well since then you might have an error message with non files
listed. So here I just display the task ID. Not sure whether that makes sense
or not. I could instead use something like "(unnamed file)". Or we could just
ignore the scenario and let gcc print "(null)" for this unexpected case.
src/virt-viewer-file-transfer-dialog.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/virt-viewer-file-transfer-dialog.c b/src/virt-viewer-file-transfer-dialog.c
index 626a26a..c016e64 100644
--- a/src/virt-viewer-file-transfer-dialog.c
+++ b/src/virt-viewer-file-transfer-dialog.c
@@ -178,10 +178,18 @@ static gboolean hide_transfer_dialog(gpointer data)
if (self->priv->failed) {
GSList *sl;
GString *msg = g_string_new("");
+ GtkWidget *dialog;
for (sl = self->priv->failed; sl != NULL; sl = g_slist_next(sl)) {
SpiceFileTransferTask *failed_task = sl->data;
gchar *filename = spice_file_transfer_task_get_filename(failed_task);
+ if (filename == NULL) {
+ guint id;
+
+ g_object_get(failed_task, "id", &id, NULL);
+ g_warning("Unable to get filename of failed transfer");
+ filename = g_strdup_printf("(task #%u)", id);
+ }
g_string_append_printf(msg, "\n%s", filename);
g_free(filename);
@@ -189,10 +197,10 @@ static gboolean hide_transfer_dialog(gpointer data)
g_slist_free_full(self->priv->failed, g_object_unref);
self->priv->failed = NULL;
- GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(self), 0, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("An error caused following file transfers to fail:\n%s"),
- msg->str);
+ dialog = gtk_message_dialog_new(GTK_WINDOW(self), 0, GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("An error caused following file transfers to fail:%s"),
+ msg->str);
g_string_free(msg, TRUE);
g_signal_connect(dialog, "response", G_CALLBACK(error_dialog_response), NULL);
gtk_widget_show(dialog);
--
2.7.4
More information about the virt-tools-list
mailing list