Commit c5eff90e authored by Rocky Automation's avatar Rocky Automation 📺
Browse files

import virt-viewer-9.0-9.el8

parent 2d31dcff
From 21b482e6b85df7dca46e1dc8501b0f28ce4570a1 Mon Sep 17 00:00:00 2001
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
Date: Fri, 15 May 2020 10:24:08 -0300
Subject: [PATCH virt-viewer] ovirt: Do not filter out DATA storage domains
Since ovirt 4.2 it is acceptable to have ISO images in storage domains
of DATA type, while the usage of ISO type is about to be deprecated. The
code now allow both types of storage domains when looking up for ISO
images.
https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.2/html/release_notes/deprecated_features_rhv
https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.4-beta/html/release_notes/deprecated_features_rhv
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1835640
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
---
src/ovirt-foreign-menu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index dc6ecf4..c31c93f 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -661,8 +661,8 @@ static gboolean storage_domain_validate(OvirtForeignMenu *menu G_GNUC_UNUSED,
g_object_get(domain, "name", &name, "type", &type, "state", &state, NULL);
- if (type != OVIRT_STORAGE_DOMAIN_TYPE_ISO) {
- g_debug("Storage domain '%s' type is not ISO", name);
+ if (type != OVIRT_STORAGE_DOMAIN_TYPE_ISO && type != OVIRT_STORAGE_DOMAIN_TYPE_DATA) {
+ g_debug("Storage domain '%s' type is not ISO or DATA", name);
ret = FALSE;
}
--
2.26.2
From 0a16fd513034c2a1475ed84b38461faea7a12250 Mon Sep 17 00:00:00 2001
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
Date: Thu, 25 Jun 2020 21:19:32 -0300
Subject: [PATCH virt-viewer] ovirt-foreign-menu: Use proper function in the
case of DATA StorageDomains
Unlike the StorageDomain objects of ISO type, the DATA ones require a
specific API recently added to libgovirt to support them. This commit
makes use of those new functions under #ifdef guards and adds proper a
check to configure.ac.
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1847223
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
---
configure.ac | 2 +-
src/ovirt-foreign-menu.c | 36 ++++++++++++++++++++++++++++++++++--
2 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9da056f..a313ce1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -203,7 +203,7 @@ AS_IF([test "x$with_ovirt" = "xyes"],
SAVED_LIBS="$LIBS"
CFLAGS="$SAVED_CFLAGS $OVIRT_CFLAGS"
LIBS="$SAVED_LIBS $OVIRT_LIBS"
- AC_CHECK_FUNCS([ovirt_api_search_vms ovirt_vm_get_host ovirt_host_get_cluster ovirt_cluster_get_data_center],
+ AC_CHECK_FUNCS([ovirt_api_search_vms ovirt_vm_get_host ovirt_host_get_cluster ovirt_cluster_get_data_center ovirt_storage_domain_get_disks],
[AC_DEFINE([HAVE_OVIRT_DATA_CENTER], 1, [Have support for data center])],
[]
)
diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index c31c93f..3c67f1a 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -481,6 +481,18 @@ static void ovirt_foreign_menu_set_files(OvirtForeignMenu *menu,
for (it = files; it != NULL; it = it->next) {
char *name;
g_object_get(it->data, "name", &name, NULL);
+
+#ifdef HAVE_OVIRT_STORAGE_DOMAIN_GET_DISKS
+ if (OVIRT_IS_DISK(it->data)) {
+ OvirtDiskContentType content_type;
+ g_object_get(it->data, "content-type", &content_type, NULL);
+ if (content_type != OVIRT_DISK_CONTENT_TYPE_ISO) {
+ g_debug("Ignoring %s disk which content-type is not ISO", name);
+ continue;
+ }
+ }
+#endif
+
/* The oVirt REST API is supposed to have a 'type' node
* associated with file resources , but as of 3.2, this node
* is not present, so we do an extension check instead
@@ -695,6 +707,26 @@ static gboolean ovirt_foreign_menu_set_file_collection(OvirtForeignMenu *menu, O
return TRUE;
}
+static OvirtCollection *storage_domain_get_files(OvirtStorageDomain *domain)
+{
+ OvirtCollection *files = NULL;
+ OvirtStorageDomainType type;
+
+ if (domain == NULL)
+ return NULL;
+
+ g_object_get(domain, "type", &type, NULL);
+
+ if (type == OVIRT_STORAGE_DOMAIN_TYPE_ISO)
+ files = ovirt_storage_domain_get_files(domain);
+#ifdef HAVE_OVIRT_STORAGE_DOMAIN_GET_DISKS
+ else if (type == OVIRT_STORAGE_DOMAIN_TYPE_DATA)
+ files = ovirt_storage_domain_get_disks(domain);
+#endif
+
+ return files;
+}
+
static gboolean set_file_collection_from_toplevel_storage_domain(OvirtForeignMenu *menu, OvirtStorageDomain *domain)
{
gboolean ret = FALSE;
@@ -716,7 +748,7 @@ static gboolean set_file_collection_from_toplevel_storage_domain(OvirtForeignMen
goto end;
}
- ret = ovirt_foreign_menu_set_file_collection(menu, ovirt_storage_domain_get_files(OVIRT_STORAGE_DOMAIN(resource)));
+ ret = ovirt_foreign_menu_set_file_collection(menu, storage_domain_get_files(OVIRT_STORAGE_DOMAIN(resource)));
end:
g_clear_error(&error);
@@ -756,7 +788,7 @@ static void storage_domains_fetched_cb(GObject *source_object,
if (!domain_valid)
domain_valid = TRUE;
- file_collection = ovirt_storage_domain_get_files(domain);
+ file_collection = storage_domain_get_files(domain);
if (!ovirt_foreign_menu_set_file_collection(menu, file_collection)) {
/* Retry with toplevel storage domain */
if (!set_file_collection_from_toplevel_storage_domain(menu, domain))
--
2.26.2
From f5936a87795dfdefee10f87672abcf8f9175a7c9 Mon Sep 17 00:00:00 2001
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
Date: Mon, 15 Jun 2020 20:53:18 -0300
Subject: [PATCH virt-viewer] ovirt-foreign-menu: Take into account
StorageDomains of type DATA
Now that we support both ISO and DATA storage domain types, we need to
make sure that the files are listed correctly. In this case we give the
domains of ISO type the precedence over DATA ones.
This change extends previous commit bbda3aa which made it possible for
storage domains of type DATA to be considered valid.
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
---
src/ovirt-foreign-menu.c | 39 ++++++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index 3c67f1a..8d02a79 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -734,6 +734,9 @@ static gboolean set_file_collection_from_toplevel_storage_domain(OvirtForeignMen
OvirtResource *resource = NULL;
gchar *href = NULL, *id = NULL;
+ if (domain == NULL)
+ return FALSE;
+
g_object_get(domain, "guid", &id, NULL);
href = g_strdup_printf("/ovirt-engine/api/storagedomains/%s", id);
resource = g_initable_new(OVIRT_TYPE_STORAGE_DOMAIN, NULL, &error, "guid", id, "href", href, NULL);
@@ -767,8 +770,8 @@ static void storage_domains_fetched_cb(GObject *source_object,
OvirtForeignMenu *menu = OVIRT_FOREIGN_MENU(g_task_get_source_object(task));
OvirtCollection *collection = OVIRT_COLLECTION(source_object);
GHashTableIter iter;
- OvirtStorageDomain *domain;
- gboolean domain_valid = FALSE;
+ OvirtStorageDomain *domain, *valid_domain = NULL;
+ OvirtCollection *file_collection;
ovirt_collection_fetch_finish(collection, result, &error);
if (error != NULL) {
@@ -780,35 +783,37 @@ static void storage_domains_fetched_cb(GObject *source_object,
g_hash_table_iter_init(&iter, ovirt_collection_get_resources(collection));
while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&domain)) {
- OvirtCollection *file_collection;
-
if (!storage_domain_validate(menu, domain))
continue;
- if (!domain_valid)
- domain_valid = TRUE;
+ /* Storage domain of type ISO has precedence over type DATA */
+ if (valid_domain != NULL) {
+ OvirtStorageDomainType domain_type, valid_type;
+ g_object_get(domain, "type", &domain_type, NULL);
+ g_object_get(valid_domain, "type", &valid_type, NULL);
- file_collection = storage_domain_get_files(domain);
- if (!ovirt_foreign_menu_set_file_collection(menu, file_collection)) {
- /* Retry with toplevel storage domain */
- if (!set_file_collection_from_toplevel_storage_domain(menu, domain))
- continue;
+ if (domain_type > valid_type)
+ valid_domain = domain;
+
+ continue;
}
- break; /* There can only be one valid storage domain at a time,
- no need to iterate more on the list */
+ valid_domain = domain;
}
- if (menu->priv->files != NULL) {
- ovirt_foreign_menu_next_async_step(menu, task, STATE_STORAGE_DOMAIN);
- } else {
- const char *msg = domain_valid ? "Could not find ISO file collection"
+ file_collection = storage_domain_get_files(valid_domain);
+ if (!ovirt_foreign_menu_set_file_collection(menu, file_collection) &&
+ !set_file_collection_from_toplevel_storage_domain(menu, valid_domain)) { /* Retry with toplevel storage domain */
+ const char *msg = valid_domain ? "Could not find ISO file collection"
: "Could not find valid ISO storage domain";
g_debug("%s", msg);
g_task_return_new_error(task, OVIRT_ERROR, OVIRT_ERROR_FAILED, "%s", msg);
g_object_unref(task);
+ return;
}
+
+ ovirt_foreign_menu_next_async_step(menu, task, STATE_STORAGE_DOMAIN);
}
--
2.26.2
From ae25f6ca6b46e95281186492de5bc0a0fe4974a6 Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <freddy77@gmail.com>
Date: Fri, 10 Jul 2020 10:58:35 +0100
Subject: [PATCH] More specific key accelerator description
The default key accelerator to release mouse if left control and
left alt but the current description is "Ctrl+Alt", change to
"Ctrl_L+Alt_L" to avoid misunderstanding.
This solves https://bugzilla.redhat.com/show_bug.cgi?id=1548371
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
---
src/virt-viewer-window.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 6c9bc41..614120f 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -1395,7 +1395,7 @@ virt_viewer_window_update_title(VirtViewerWindow *self)
g_debug("release-cursor accel key: key=%u, mods=%x, flags=%u", key.accel_key, key.accel_mods, key.accel_flags);
label = gtk_accelerator_get_label(key.accel_key, key.accel_mods);
} else {
- label = g_strdup(_("Ctrl+Alt"));
+ label = g_strdup(_("Ctrl_L+Alt_L"));
}
ungrab = g_strdup_printf(_("(Press %s to release pointer)"), label);
--
2.28.0
From 522cca5ac1473405d325fce4fef0d6e0343f6257 Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <freddy77@gmail.com>
Date: Wed, 10 Jun 2020 13:27:36 +0100
Subject: [PATCH] virt-viewer-file-transfer-dialog: Reports detailed errors
Instead of showing just a generic error with a list of files group
files by error and show them.
This solves https://bugzilla.redhat.com/show_bug.cgi?id=1753563
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
---
src/virt-viewer-file-transfer-dialog.c | 47 +++++++++++++++++++++++---
1 file changed, 43 insertions(+), 4 deletions(-)
diff --git a/src/virt-viewer-file-transfer-dialog.c b/src/virt-viewer-file-transfer-dialog.c
index b510d8e..975346f 100644
--- a/src/virt-viewer-file-transfer-dialog.c
+++ b/src/virt-viewer-file-transfer-dialog.c
@@ -188,6 +188,23 @@ error_dialog_response(GtkDialog *dialog,
gtk_widget_destroy(GTK_WIDGET(dialog));
}
+static const gchar*
+file_error_message(GError *err)
+{
+ if (err && err->message) {
+ return err->message;
+ }
+ return _("Unspecified error");
+}
+
+static gint
+compare_file_error(gconstpointer a, gconstpointer b)
+{
+ GError *error_a = g_object_get_data(G_OBJECT(a), "virt-viewer-error");
+ GError *error_b = g_object_get_data(G_OBJECT(b), "virt-viewer-error");
+ return g_strcmp0(file_error_message(error_a), file_error_message(error_b));
+}
+
static gboolean hide_transfer_dialog(gpointer data)
{
VirtViewerFileTransferDialog *self = data;
@@ -202,10 +219,26 @@ static gboolean hide_transfer_dialog(gpointer data)
GString *msg = g_string_new("");
GtkWidget *dialog, *files_label, *scrolled_window, *area;
GtkRequisition files_label_sz;
+ const gchar *last_error = NULL;
+ const gchar *group_separator = "";
+
+ self->priv->failed = g_slist_sort(self->priv->failed, compare_file_error);
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);
+
+ const gchar *error_message =
+ file_error_message(g_object_get_data(G_OBJECT(failed_task), "virt-viewer-error"));
+ if (g_strcmp0(error_message, last_error) != 0) {
+ // add error message
+ gchar *header = g_markup_printf_escaped("%s<b>%s</b>:", group_separator, error_message);
+ g_string_append(msg, header);
+ g_free(header);
+ last_error = error_message;
+ group_separator = "\n\n";
+ }
+
if (filename == NULL) {
guint id;
@@ -214,15 +247,16 @@ static gboolean hide_transfer_dialog(gpointer data)
filename = g_strdup_printf("(task #%u)", id);
}
- g_string_append_printf(msg, "\n%s", filename);
+ gchar *escaped_filename = g_markup_printf_escaped("\n%s", filename);
+ g_string_append(msg, escaped_filename);
+ g_free(escaped_filename);
g_free(filename);
}
g_slist_free_full(self->priv->failed, g_object_unref);
self->priv->failed = NULL;
dialog = gtk_message_dialog_new(GTK_WINDOW(self), 0, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- _("An error caused the following file transfers to fail:"));
+ GTK_BUTTONS_OK, NULL);
gtk_window_set_title(GTK_WINDOW(dialog), "Transfer error");
scrolled_window = gtk_scrolled_window_new(NULL, NULL);
@@ -232,8 +266,9 @@ static gboolean hide_transfer_dialog(gpointer data)
area = gtk_message_dialog_get_message_area(GTK_MESSAGE_DIALOG(dialog));
gtk_container_add(GTK_CONTAINER(area), scrolled_window);
- files_label = gtk_label_new(msg->str + 1); /* skip the initial '\n' */
+ files_label = gtk_label_new(NULL);
gtk_label_set_selectable(GTK_LABEL(files_label), TRUE);
+ gtk_label_set_markup(GTK_LABEL(files_label), msg->str);
gtk_container_add(GTK_CONTAINER(scrolled_window), files_label);
g_string_free(msg, TRUE);
@@ -242,6 +277,8 @@ static gboolean hide_transfer_dialog(gpointer data)
/* adjust panel to file_label height */
gtk_widget_get_preferred_size(files_label, NULL, &files_label_sz);
+ gtk_scrolled_window_set_min_content_width(GTK_SCROLLED_WINDOW(scrolled_window),
+ MIN(files_label_sz.width, 500));
gtk_scrolled_window_set_min_content_height(GTK_SCROLLED_WINDOW(scrolled_window),
MIN(files_label_sz.height, 170));
}
@@ -256,6 +293,8 @@ static void task_finished(SpiceFileTransferTask *task,
VirtViewerFileTransferDialog *self = VIRT_VIEWER_FILE_TRANSFER_DIALOG(user_data);
if (error && !g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+ g_object_set_data_full(G_OBJECT(task), "virt-viewer-error",
+ g_error_copy(error), (GDestroyNotify) g_error_free);
self->priv->failed = g_slist_prepend(self->priv->failed, g_object_ref(task));
g_warning("File transfer task %p failed: %s", task, error->message);
}
--
2.28.0
From 671f79bd7d0668fb0c70cd17d09a77482b9f5fbe Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Wed, 22 Jul 2020 12:08:25 +0200
Subject: [PATCH] ui: improve homepage in about dialog
Switch the homepage URL to https, and synchronize the label with the
URL. Also, do not make the label translatable, as it is pointless (it is
only a URL).
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
---
src/resources/ui/virt-viewer-about.ui | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/resources/ui/virt-viewer-about.ui b/src/resources/ui/virt-viewer-about.ui
index 5f6ce70..681590f 100644
--- a/src/resources/ui/virt-viewer-about.ui
+++ b/src/resources/ui/virt-viewer-about.ui
@@ -16,8 +16,8 @@
<property name="copyright" translatable="yes">Copyright (C) 2007-2012 Daniel P. Berrange
Copyright (C) 2007-2014 Red Hat, Inc.</property>
<property name="comments" translatable="yes">A remote desktop client built with GTK-VNC, SPICE-GTK and libvirt</property>
- <property name="website">http://gitlab.com/virt-viewer/virt-viewer/</property>
- <property name="website_label" translatable="yes">gitlab.com/virt-viewer/virt-viewer</property>
+ <property name="website">https://gitlab.com/virt-viewer/virt-viewer</property>
+ <property name="website_label">https://gitlab.com/virt-viewer/virt-viewer</property>
<property name="license" translatable="yes">This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
--
2.28.0
From d880ce4a4097d4e7efa1ba1a7fe28147b2e439bc Mon Sep 17 00:00:00 2001
From: Uri Lublin <uril@redhat.com>
Date: Tue, 25 Aug 2020 20:10:59 +0300
Subject: [PATCH] about ui: year 2020 in Copyright
rhbz#1848267
Signed-off-by: Uri Lublin <uril@redhat.com>
---
src/resources/ui/virt-viewer-about.ui | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/resources/ui/virt-viewer-about.ui b/src/resources/ui/virt-viewer-about.ui
index 681590f..25b2165 100644
--- a/src/resources/ui/virt-viewer-about.ui
+++ b/src/resources/ui/virt-viewer-about.ui
@@ -15,7 +15,7 @@
<property name="skip_pager_hint">True</property>
<property name="program_name">Virtual Machine Viewer</property>
<property name="copyright" translatable="yes">Copyright (C) 2007-2012 Daniel P. Berrange
-Copyright (C) 2007-2014 Red Hat, Inc.</property>
+Copyright (C) 2007-2020 Red Hat, Inc.</property>
<property name="comments" translatable="yes">A remote desktop client built with GTK-VNC, SPICE-GTK and libvirt</property>
<property name="website">https://gitlab.com/virt-viewer/virt-viewer</property>
<property name="website_label">https://gitlab.com/virt-viewer/virt-viewer</property>
--
2.28.0
From b7a2f05266e82fbdf0642b27276099a55844dbae Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Fri, 11 Sep 2020 11:35:00 +0200
Subject: [PATCH] po: update pot file
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
---
po/virt-viewer.pot | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/po/virt-viewer.pot b/po/virt-viewer.pot
index a3e49ad..1853fcd 100644
--- a/po/virt-viewer.pot
+++ b/po/virt-viewer.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: virt-viewer 9.0\n"
"Report-Msgid-Bugs-To: https://gitlab.com/virt-viewer/virt-viewer/-/issues\n"
-"POT-Creation-Date: 2020-05-01 17:38+0100\n"
+"POT-Creation-Date: 2020-09-11 11:34+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -199,7 +199,7 @@ msgstr ""
#: src/resources/ui/virt-viewer-about.ui:16
msgid ""
"Copyright (C) 2007-2012 Daniel P. Berrange\n"
-"Copyright (C) 2007-2014 Red Hat, Inc."
+"Copyright (C) 2007-2020 Red Hat, Inc."
msgstr ""
#: src/resources/ui/virt-viewer-about.ui:18
--
2.28.0
From de5cd71013532d1a1240315c92fd0b5ca708fe01 Mon Sep 17 00:00:00 2001
From: Uri Lublin <uril@redhat.com>
Date: Tue, 27 Oct 2020 19:53:36 +0200
Subject: [PATCH] vnc: show an error dialog upon vnc-error
For example when connecting by accident to a spice server
Signed-off-by: Uri Lublin <uril@redhat.com>
---
src/virt-viewer-app.c | 20 +++++++++++++++++---
src/virt-viewer-session-vnc.c | 13 +++++++++++++
src/virt-viewer-session.c | 9 +++++++++
3 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index c0e0c9c..8cfdc2d 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -78,6 +78,9 @@ void virt_viewer_app_about_delete(GtkWidget *dialog, void *dummy, VirtViewerApp
/* Internal methods */
static void virt_viewer_app_connected(VirtViewerSession *session,
VirtViewerApp *self);
+static void virt_viewer_app_error(VirtViewerSession *session G_GNUC_UNUSED,
+ const gchar *msg,
+ VirtViewerApp *self);
static void virt_viewer_app_initialized(VirtViewerSession *session,
VirtViewerApp *self);
static void virt_viewer_app_disconnected(VirtViewerSession *session,
@@ -1292,6 +1295,8 @@ virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type, GError **
g_signal_connect(priv->session, "session-initialized",
G_CALLBACK(virt_viewer_app_initialized), self);
+ g_signal_connect(priv->session, "session-error",
+ G_CALLBACK(virt_viewer_app_error), self);
g_signal_connect(priv->session, "session-connected",
G_CALLBACK(virt_viewer_app_connected), self);
g_signal_connect(priv->session, "session-disconnected",
@@ -1654,8 +1659,6 @@ virt_viewer_app_connected(VirtViewerSession *session G_GNUC_UNUSED,
virt_viewer_app_show_status(self, _("Connected to graphic server"));
}
-
-
static void
virt_viewer_app_initialized(VirtViewerSession *session G_GNUC_UNUSED,
VirtViewerApp *self)
@@ -1690,6 +1693,18 @@ virt_viewer_app_disconnected(VirtViewerSession *session G_GNUC_UNUSED, const gch
virt_viewer_app_deactivate(self, connect_error);
}
+static void
+virt_viewer_app_error(VirtViewerSession *session G_GNUC_UNUSED,
+ const gchar *msg,
+ VirtViewerApp *self)
+{
+ VirtViewerAppPrivate *priv = self->priv;
+
+ priv->connected = FALSE; /* display error dialog */
+
+ virt_viewer_app_disconnected(session, msg, self);
+}
+
static void virt_viewer_app_cancelled(VirtViewerSession *session,
VirtViewerApp *self)
{
@@ -1698,7 +1713,6 @@ static void virt_viewer_app_cancelled(VirtViewerSession *session,
virt_viewer_app_disconnected(session, NULL, self);
}
-
static void virt_viewer_app_auth_refused(VirtViewerSession *session,
const char *msg,
VirtViewerApp *self)
diff --git a/src/virt-viewer-session-vnc.c b/src/virt-viewer-session-vnc.c
index 261d984..2598c70 100644
--- a/src/virt-viewer-session-vnc.c
+++ b/src/virt-viewer-session-vnc.c
@@ -128,6 +128,15 @@ virt_viewer_session_vnc_disconnected(VncDisplay *vnc G_GNUC_UNUSED,
VIRT_VIEWER_DISPLAY_SHOW_HINT_READY, FALSE);
}
+static void
+virt_viewer_session_vnc_error(VncDisplay *vnc G_GNUC_UNUSED,
+ const gchar* msg,
+ VirtViewerSessionVnc *session)
+{
+ g_warning("vnc-session: got vnc error %s", msg);
+ g_signal_emit_by_name(session, "session-error", msg);
+}
+
static void
virt_viewer_session_vnc_initialized(VncDisplay *vnc G_GNUC_UNUSED,
VirtViewerSessionVnc *session)
@@ -386,6 +395,8 @@ virt_viewer_session_vnc_close(VirtViewerSession* session)
G_CALLBACK(virt_viewer_session_vnc_initialized), session);
g_signal_connect(self->priv->vnc, "vnc-disconnected",
G_CALLBACK(virt_viewer_session_vnc_disconnected), session);
+ g_signal_connect(self->priv->vnc, "vnc-error",
+ G_CALLBACK(virt_viewer_session_vnc_error), session);
g_signal_connect(self->priv->vnc, "vnc-bell",
G_CALLBACK(virt_viewer_session_vnc_bell), session);
@@ -418,6 +429,8 @@ virt_viewer_session_vnc_new(VirtViewerApp *app, GtkWindow *main_window)
G_CALLBACK(virt_viewer_session_vnc_initialized), session);
g_signal_connect(session->priv->vnc, "vnc-disconnected",
G_CALLBACK(virt_viewer_session_vnc_disconnected), session);
+ g_signal_connect(session->priv->vnc, "vnc-error",