virt-viewer/0001-spice-controller-interface-is-being-removed-from-spi.patch
Fabiano Fidêncio d5eb294833 Add missing patch for spice-controller so being removed
Resolves: rhbz#1596215 - Rebuild virt-viewer with latest spice-glib

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2018-06-29 10:16:26 +02:00

677 lines
24 KiB
Diff

From 30c34a6cb642ed3d232db1ea8b14bfbb112c6f76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@fedoraproject.org>
Date: Thu, 28 Jun 2018 20:34:40 +0200
Subject: [PATCH] spice controller interface is being removed from spice-gtk.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Victor Toso <victortoso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@fedoraprojet.org>
---
configure.ac | 3 +-
data/Makefile.am | 1 -
data/spice-xpi-client-remote-viewer | 6 -
data/virt-viewer.wxs.in | 11 -
man/remote-viewer.pod | 6 -
src/Makefile.am | 2 -
src/remote-viewer.c | 448 +---------------------------
7 files changed, 5 insertions(+), 472 deletions(-)
delete mode 100644 data/spice-xpi-client-remote-viewer
diff --git a/configure.ac b/configure.ac
index d5eb258..4f5e3df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,13 +159,12 @@ AC_ARG_WITH([spice-gtk],
AS_IF([test "x$with_spice_gtk" != "xno" && test "x$with_spice_gtk" != "xyes"],
[PKG_CHECK_EXISTS([spice-client-gtk-3.0 >= $SPICE_GTK_REQUIRED
spice-client-glib-2.0 >= $SPICE_GTK_REQUIRED
- spice-controller spice-protocol >= $SPICE_PROTOCOL_REQUIRED],
+ spice-protocol >= $SPICE_PROTOCOL_REQUIRED],
[with_spice_gtk=yes], [with_spice_gtk=no])])
AS_IF([test "x$with_spice_gtk" = "xyes"],
[PKG_CHECK_MODULES(SPICE_GTK, [spice-client-gtk-3.0 >= $SPICE_GTK_REQUIRED
spice-client-glib-2.0 >= $SPICE_GTK_REQUIRED])]
- [PKG_CHECK_MODULES(SPICE_CONTROLLER, [spice-controller])]
[PKG_CHECK_MODULES(SPICE_PROTOCOL, [spice-protocol >= $SPICE_PROTOCOL_REQUIRED])]
[AC_DEFINE([HAVE_SPICE_GTK], 1, [Have spice-gtk?])]
)
diff --git a/data/Makefile.am b/data/Makefile.am
index 55718d9..54be2b1 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -3,7 +3,6 @@ CLEANFILES =
MANUFACTURER = Virt Manager Project
EXTRA_DIST = \
- spice-xpi-client-remote-viewer \
virt-viewer.wxs.in \
$(NULL)
diff --git a/data/spice-xpi-client-remote-viewer b/data/spice-xpi-client-remote-viewer
deleted file mode 100644
index 3109c66..0000000
--- a/data/spice-xpi-client-remote-viewer
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-logger -t spice "starting remote-viewer --spice-controller $@..."
-env | logger -t spice
-exec remote-viewer --spice-controller "$@" 2>&1 | logger -t spice
-logger -t spice "remote-viewer execution failed"
diff --git a/data/virt-viewer.wxs.in b/data/virt-viewer.wxs.in
index 9838265..2047720 100644
--- a/data/virt-viewer.wxs.in
+++ b/data/virt-viewer.wxs.in
@@ -55,16 +55,6 @@
<Condition Message="VirtViewer is already installed.">NOT NEWERVERSIONDETECTED</Condition>
<DirectoryRef Id="TARGETDIR">
- <Component Id="CRegistryEntries" Guid="*">
- <RegistryKey Root='HKLM' Key='Software\Microsoft\Internet Explorer\Low Rights\ElevationPolicy\{96190E9D-6FBB-64DB-9095-29F6FDE0B897}'>
- <RegistryValue Type='string' Name='AppPath' Value='[INSTALLDIR]\bin'/>
- <RegistryValue Type='string' Name='AppName' Value='remote-viewer.exe'/>
- <RegistryValue Type='integer' Name='Policy' Value='3'/>
- </RegistryKey>
- <RegistryKey Root='HKLM' Key='Software\spice-space.org\spicex'>
- <RegistryValue Type='string' Name='client' Value='[INSTALLDIR]\bin\remote-viewer.exe --spice-controller'/>
- </RegistryKey>
- </Component>
<Component Id="CProgIds" Guid="89D6F46D-9C5E-4D65-8456-58FC361E553E">
<ProgId Id='VirtViewer.vvfile' Description='VirtViewer connection file'>
<Extension Id='vv' ContentType='application/x-virt-viewer'>
@@ -129,7 +119,6 @@
<ComponentGroupRef Id="CG.virt-viewer"/>
<ComponentRef Id="CDepsFile"/>
<ComponentRef Id="CShortcut"/>
- <ComponentRef Id="CRegistryEntries"/>
<ComponentRef Id="CProgIds"/>
<ComponentRef Id="CHwdataUSB"/>
</Feature>
diff --git a/man/remote-viewer.pod b/man/remote-viewer.pod
index 60ea3a6..a050f4c 100644
--- a/man/remote-viewer.pod
+++ b/man/remote-viewer.pod
@@ -55,12 +55,6 @@ CONFIGURATION section below.
Set the window title to B<TITLE>
-=item --spice-controller
-
-Use the SPICE controller to initialize the connection with the SPICE
-server. This option is used by the SPICE browser addons to allow web
-page to start a client.
-
=item --debug
Print debugging information
diff --git a/src/Makefile.am b/src/Makefile.am
index e87bcc7..d17f4c1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -178,11 +178,9 @@ remote_viewer_SOURCES = \
$(NULL)
remote_viewer_LDFLAGS = \
$(COMMON_LIBS) \
- $(SPICE_CONTROLLER_LIBS) \
$(NULL)
remote_viewer_CFLAGS = \
$(COMMON_CFLAGS) \
- $(SPICE_CONTROLLER_CFLAGS) \
$(NULL)
remote_viewer_LDADD = \
libvirt-viewer-util.la \
diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index b132214..e25208d 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -36,7 +36,6 @@
#endif
#ifdef HAVE_SPICE_GTK
-#include <spice-controller.h>
#include "virt-viewer-session-spice.h"
#endif
@@ -49,10 +48,6 @@
#include "remote-viewer-connect.h"
struct _RemoteViewerPrivate {
-#ifdef HAVE_SPICE_GTK
- SpiceCtrlController *controller;
- SpiceCtrlForeignMenu *ctrl_foreign_menu;
-#endif
#ifdef HAVE_OVIRT
OvirtForeignMenu *ovirt_foreign_menu;
#endif
@@ -78,33 +73,15 @@ static OvirtVm * choose_vm(GtkWindow *main_window,
#endif
static gboolean remote_viewer_start(VirtViewerApp *self, GError **error);
-#ifdef HAVE_SPICE_GTK
-static gboolean remote_viewer_activate(VirtViewerApp *self, GError **error);
-static void remote_viewer_window_added(GtkApplication *app, GtkWindow *w);
-static void spice_foreign_menu_updated(RemoteViewer *self);
-static void foreign_menu_title_changed(SpiceCtrlForeignMenu *menu, GParamSpec *pspec, RemoteViewer *self);
-#endif
static void
remote_viewer_dispose (GObject *object)
{
-#if defined(HAVE_SPICE_GTK) || defined(HAVE_OVIRT)
+#if defined(HAVE_OVIRT)
RemoteViewer *self = REMOTE_VIEWER(object);
RemoteViewerPrivate *priv = self->priv;
#endif
-#ifdef HAVE_SPICE_GTK
- if (priv->controller) {
- g_object_unref(priv->controller);
- priv->controller = NULL;
- }
-
- if (priv->ctrl_foreign_menu) {
- g_object_unref(priv->ctrl_foreign_menu);
- priv->ctrl_foreign_menu = NULL;
- }
-#endif
-
#ifdef HAVE_OVIRT
if (priv->ovirt_foreign_menu) {
g_object_unref(priv->ovirt_foreign_menu);
@@ -132,7 +109,6 @@ remote_viewer_deactivated(VirtViewerApp *app, gboolean connect_error)
static gchar **opt_args = NULL;
static char *opt_title = NULL;
-static gboolean opt_controller = FALSE;
static void
remote_viewer_add_option_entries(VirtViewerApp *self, GOptionContext *context, GOptionGroup *group)
@@ -140,10 +116,6 @@ remote_viewer_add_option_entries(VirtViewerApp *self, GOptionContext *context, G
static const GOptionEntry options[] = {
{ "title", 't', 0, G_OPTION_ARG_STRING, &opt_title,
N_("Set window title"), NULL },
-#ifdef HAVE_SPICE_GTK
- { "spice-controller", '\0', 0, G_OPTION_ARG_NONE, &opt_controller,
- N_("Open connection using Spice controller communication"), NULL },
-#endif
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &opt_args,
NULL, "URI|VV-FILE" },
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
@@ -184,27 +156,7 @@ remote_viewer_local_command_line (GApplication *gapp,
g_object_set(app, "guri", opt_args[0], NULL);
}
-#ifdef HAVE_SPICE_GTK
- if (opt_controller) {
- if (opt_args) {
- g_printerr(_("\nError: extra arguments given while using Spice controller\n\n"));
- ret = TRUE;
- *status = 1;
- goto end;
- }
-
- self->priv->controller = spice_ctrl_controller_new();
- self->priv->ctrl_foreign_menu = spice_ctrl_foreign_menu_new();
-
- g_object_set(self, "guest-name", "defined by Spice controller", NULL);
-
- g_signal_connect(self->priv->ctrl_foreign_menu, "notify::title",
- G_CALLBACK(foreign_menu_title_changed),
- self);
- }
-#endif
-
- if (opt_title && !opt_controller)
+ if (opt_title)
g_object_set(app, "title", opt_title, NULL);
end:
@@ -241,7 +193,6 @@ static void
remote_viewer_class_init (RemoteViewerClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkApplicationClass *gtk_app_class = GTK_APPLICATION_CLASS(klass);
VirtViewerAppClass *app_class = VIRT_VIEWER_APP_CLASS (klass);
GApplicationClass *g_app_class = G_APPLICATION_CLASS(klass);
@@ -255,12 +206,6 @@ remote_viewer_class_init (RemoteViewerClass *klass)
app_class->start = remote_viewer_start;
app_class->deactivated = remote_viewer_deactivated;
app_class->add_option_entries = remote_viewer_add_option_entries;
-#ifdef HAVE_SPICE_GTK
- app_class->activate = remote_viewer_activate;
- gtk_app_class->window_added = remote_viewer_window_added;
-#else
- (void) gtk_app_class;
-#endif
#ifdef HAVE_OVIRT
g_object_class_install_property(object_class,
@@ -288,217 +233,7 @@ remote_viewer_new(void)
NULL);
}
-#ifdef HAVE_SPICE_GTK
-static void
-foreign_menu_title_changed(SpiceCtrlForeignMenu *menu G_GNUC_UNUSED,
- GParamSpec *pspec G_GNUC_UNUSED,
- RemoteViewer *self)
-{
- gboolean has_focus;
-
- g_object_get(G_OBJECT(self), "has-focus", &has_focus, NULL);
- /* FIXME: use a proper "new client connected" event
- ** a foreign menu client set the title when connecting,
- ** inform of focus state at that time.
- */
- spice_ctrl_foreign_menu_app_activated_msg(self->priv->ctrl_foreign_menu, has_focus);
-
- /* update menu title */
- spice_foreign_menu_updated(self);
-}
-
-static void
-spice_ctrl_do_connect(SpiceCtrlController *ctrl G_GNUC_UNUSED,
- VirtViewerApp *self)
-{
- GError *error = NULL;
-
- if (!virt_viewer_app_initial_connect(self, &error)) {
- const gchar *msg = error ? error->message :
- _("Failed to initiate connection");
- virt_viewer_app_simple_message_dialog(self, msg);
- g_clear_error(&error);
- }
-}
-
-static void
-spice_ctrl_show(SpiceCtrlController *ctrl G_GNUC_UNUSED, RemoteViewer *self)
-{
- virt_viewer_app_show_display(VIRT_VIEWER_APP(self));
-}
-
-static void
-spice_ctrl_hide(SpiceCtrlController *ctrl G_GNUC_UNUSED, RemoteViewer *self)
-{
- virt_viewer_app_show_status(VIRT_VIEWER_APP(self), _("Display disabled by controller"));
-}
-
-static void
-spice_menuitem_activate_cb(GtkMenuItem *mi, GObject *ctrl)
-{
- SpiceCtrlMenuItem *menuitem = g_object_get_data(G_OBJECT(mi), "spice-menuitem");
-
- g_return_if_fail(menuitem != NULL);
- if (gtk_menu_item_get_submenu(mi))
- return;
-
- if (SPICE_CTRL_IS_CONTROLLER(ctrl))
- spice_ctrl_controller_menu_item_click_msg(SPICE_CTRL_CONTROLLER(ctrl), menuitem->id);
- else if (SPICE_CTRL_IS_FOREIGN_MENU(ctrl))
- spice_ctrl_foreign_menu_menu_item_click_msg(SPICE_CTRL_FOREIGN_MENU(ctrl), menuitem->id);
-}
-
-static GtkWidget *
-ctrlmenu_to_gtkmenu (RemoteViewer *self, SpiceCtrlMenu *ctrlmenu, GObject *ctrl)
-{
- GList *l;
- GtkWidget *menu = gtk_menu_new();
- guint n = 0;
-
- for (l = ctrlmenu->items; l != NULL; l = l->next) {
- SpiceCtrlMenuItem *menuitem = l->data;
- GtkWidget *item;
- char *s;
- if (menuitem->text == NULL) {
- g_warn_if_reached();
- continue;
- }
-
- for (s = menuitem->text; *s; s++)
- if (*s == '&')
- *s = '_';
-
- if (g_str_equal(menuitem->text, "-")) {
- item = gtk_separator_menu_item_new();
- } else if (menuitem->flags & CONTROLLER_MENU_FLAGS_CHECKED) {
- item = gtk_check_menu_item_new_with_mnemonic(menuitem->text);
- g_object_set(item, "active", TRUE, NULL);
- } else {
- item = gtk_menu_item_new_with_mnemonic(menuitem->text);
- }
-
- if (menuitem->flags & (CONTROLLER_MENU_FLAGS_GRAYED | CONTROLLER_MENU_FLAGS_DISABLED))
- gtk_widget_set_sensitive(item, FALSE);
-
- g_object_set_data_full(G_OBJECT(item), "spice-menuitem",
- g_object_ref(menuitem), g_object_unref);
- g_signal_connect(item, "activate", G_CALLBACK(spice_menuitem_activate_cb), ctrl);
- gtk_menu_attach(GTK_MENU (menu), item, 0, 1, n, n + 1);
- n += 1;
-
- if (menuitem->submenu) {
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(item),
- ctrlmenu_to_gtkmenu(self, menuitem->submenu, ctrl));
- }
- }
-
- if (n == 0) {
- g_object_ref_sink(menu);
- g_object_unref(menu);
- menu = NULL;
- }
-
- gtk_widget_show_all(menu);
- return menu;
-}
-
-static void
-spice_menu_update(RemoteViewer *self, VirtViewerWindow *win)
-{
- GtkWidget *menuitem = g_object_get_data(G_OBJECT(win), "spice-menu");
- SpiceCtrlMenu *menu;
-
- if (self->priv->controller == NULL)
- return;
-
- if (menuitem != NULL)
- gtk_widget_destroy(menuitem);
-
- {
- GtkMenuShell *shell = GTK_MENU_SHELL(gtk_builder_get_object(virt_viewer_window_get_builder(win), "top-menu"));
- menuitem = gtk_menu_item_new_with_label("Spice");
- gtk_menu_shell_append(shell, menuitem);
- g_object_set_data(G_OBJECT(win), "spice-menu", menuitem);
- }
-
- g_object_get(self->priv->controller, "menu", &menu, NULL);
- if (menu == NULL || g_list_length(menu->items) == 0) {
- gtk_widget_set_visible(menuitem, FALSE);
- } else {
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem),
- ctrlmenu_to_gtkmenu(self, menu, G_OBJECT(self->priv->controller)));
- gtk_widget_set_visible(menuitem, TRUE);
- }
-
- if (menu != NULL)
- g_object_unref(menu);
-}
-
-static void
-spice_menu_update_each(gpointer value,
- gpointer user_data)
-{
- spice_menu_update(REMOTE_VIEWER(user_data), VIRT_VIEWER_WINDOW(value));
-}
-
-static void
-spice_ctrl_menu_updated(RemoteViewer *self)
-{
- GList *windows = virt_viewer_app_get_windows(VIRT_VIEWER_APP(self));
-
- g_debug("Spice controller menu updated");
-
- g_list_foreach(windows, spice_menu_update_each, self);
-}
-
-static void
-spice_foreign_menu_update(RemoteViewer *self, VirtViewerWindow *win)
-{
- GtkWidget *menuitem = g_object_get_data(G_OBJECT(win), "foreign-menu");
- SpiceCtrlMenu *menu;
-
- if (self->priv->ctrl_foreign_menu == NULL)
- return;
-
- if (menuitem != NULL)
- gtk_widget_destroy(menuitem);
-
- {
- GtkMenuShell *shell = GTK_MENU_SHELL(gtk_builder_get_object(virt_viewer_window_get_builder(win), "top-menu"));
- const gchar *title = spice_ctrl_foreign_menu_get_title(self->priv->ctrl_foreign_menu);
- menuitem = gtk_menu_item_new_with_label(title);
- gtk_menu_shell_append(shell, menuitem);
- g_object_set_data(G_OBJECT(win), "foreign-menu", menuitem);
- }
-
- g_object_get(self->priv->ctrl_foreign_menu, "menu", &menu, NULL);
- if (menu == NULL || g_list_length(menu->items) == 0) {
- gtk_widget_set_visible(menuitem, FALSE);
- } else {
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem),
- ctrlmenu_to_gtkmenu(self, menu, G_OBJECT(self->priv->ctrl_foreign_menu)));
- gtk_widget_set_visible(menuitem, TRUE);
- }
- g_object_unref(menu);
-}
-
-static void
-spice_foreign_menu_update_each(gpointer value,
- gpointer user_data)
-{
- spice_foreign_menu_update(REMOTE_VIEWER(user_data), VIRT_VIEWER_WINDOW(value));
-}
-
-static void
-spice_foreign_menu_updated(RemoteViewer *self)
-{
- GList *windows = virt_viewer_app_get_windows(VIRT_VIEWER_APP(self));
-
- g_debug("Spice foreign menu updated");
-
- g_list_foreach(windows, spice_foreign_menu_update_each, self);
-}
-
+#if defined(HAVE_SPICE_GTK) && defined(HAVE_OVIRT)
static SpiceSession *
remote_viewer_get_spice_session(RemoteViewer *self)
{
@@ -514,158 +249,6 @@ remote_viewer_get_spice_session(RemoteViewer *self)
return session;
}
-
-static void
-app_notified(VirtViewerApp *app,
- GParamSpec *pspec,
- RemoteViewer *self)
-{
- GValue value = G_VALUE_INIT;
-
- g_value_init(&value, pspec->value_type);
- g_object_get_property(G_OBJECT(app), pspec->name, &value);
-
- if (g_str_equal(pspec->name, "has-focus")) {
- if (self->priv->ctrl_foreign_menu)
- spice_ctrl_foreign_menu_app_activated_msg(self->priv->ctrl_foreign_menu, g_value_get_boolean(&value));
- }
-
- g_value_unset(&value);
-}
-
-static void
-spice_ctrl_notified(SpiceCtrlController *ctrl,
- GParamSpec *pspec,
- RemoteViewer *self)
-{
- SpiceSession *session = remote_viewer_get_spice_session(self);
- GValue value = G_VALUE_INIT;
- VirtViewerApp *app = VIRT_VIEWER_APP(self);
-
- g_return_if_fail(session != NULL);
-
- g_value_init(&value, pspec->value_type);
- g_object_get_property(G_OBJECT(ctrl), pspec->name, &value);
-
- if (g_str_equal(pspec->name, "host") ||
- g_str_equal(pspec->name, "port") ||
- g_str_equal(pspec->name, "password") ||
- g_str_equal(pspec->name, "ca-file") ||
- g_str_equal(pspec->name, "enable-smartcard") ||
- g_str_equal(pspec->name, "color-depth") ||
- g_str_equal(pspec->name, "disable-effects") ||
- g_str_equal(pspec->name, "enable-usbredir") ||
- g_str_equal(pspec->name, "secure-channels") ||
- g_str_equal(pspec->name, "proxy")) {
- g_object_set_property(G_OBJECT(session), pspec->name, &value);
- } else if (g_str_equal(pspec->name, "sport")) {
- g_object_set_property(G_OBJECT(session), "tls-port", &value);
- } else if (g_str_equal(pspec->name, "tls-ciphers")) {
- g_object_set_property(G_OBJECT(session), "ciphers", &value);
- } else if (g_str_equal(pspec->name, "host-subject")) {
- g_object_set_property(G_OBJECT(session), "cert-subject", &value);
- } else if (g_str_equal(pspec->name, "enable-usb-autoshare")) {
- VirtViewerSession *vsession = NULL;
-
- g_object_get(self, "session", &vsession, NULL);
- g_object_set_property(G_OBJECT(vsession), "auto-usbredir", &value);
- g_object_unref(G_OBJECT(vsession));
- } else if (g_str_equal(pspec->name, "usb-filter")) {
- SpiceUsbDeviceManager *manager;
- manager = spice_usb_device_manager_get(session, NULL);
- if (manager != NULL) {
- g_object_set_property(G_OBJECT(manager),
- "auto-connect-filter",
- &value);
- }
- } else if (g_str_equal(pspec->name, "title")) {
- g_object_set(app, "title", g_value_get_string(&value), NULL);
- } else if (g_str_equal(pspec->name, "display-flags")) {
- guint flags = g_value_get_uint(&value);
- gboolean fullscreen = !!(flags & CONTROLLER_SET_FULL_SCREEN);
- g_object_set(G_OBJECT(self), "fullscreen", fullscreen, NULL);
- } else if (g_str_equal(pspec->name, "menu")) {
- spice_ctrl_menu_updated(self);
- } else if (g_str_equal(pspec->name, "hotkeys")) {
- virt_viewer_app_set_hotkeys(app, g_value_get_string(&value));
- } else {
- gchar *content = g_strdup_value_contents(&value);
-
- g_debug("unimplemented property: %s=%s", pspec->name, content);
- g_free(content);
- }
-
- g_object_unref(session);
- g_value_unset(&value);
-}
-
-static void
-spice_ctrl_foreign_menu_notified(SpiceCtrlForeignMenu *ctrl_foreign_menu G_GNUC_UNUSED,
- GParamSpec *pspec,
- RemoteViewer *self)
-{
- if (g_str_equal(pspec->name, "menu")) {
- spice_foreign_menu_updated(self);
- }
-}
-
-static void
-spice_ctrl_listen_async_cb(GObject *object,
- GAsyncResult *res,
- gpointer user_data)
-{
- GError *error = NULL;
- VirtViewerApp *app = VIRT_VIEWER_APP(user_data);
-
- if (SPICE_CTRL_IS_CONTROLLER(object))
- spice_ctrl_controller_listen_finish(SPICE_CTRL_CONTROLLER(object), res, &error);
- else if (SPICE_CTRL_IS_FOREIGN_MENU(object)) {
- spice_ctrl_foreign_menu_listen_finish(SPICE_CTRL_FOREIGN_MENU(object), res, &error);
- } else
- g_warn_if_reached();
-
- if (error != NULL) {
- virt_viewer_app_simple_message_dialog(app,
- _("Controller connection failed: %s"),
- error->message);
- g_clear_error(&error);
- exit(EXIT_FAILURE); /* TODO: make start async? */
- }
-}
-
-
-static gboolean
-remote_viewer_activate(VirtViewerApp *app, GError **error)
-{
- RemoteViewer *self;
- gboolean ret = FALSE;
-
- g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
-
- self = REMOTE_VIEWER(app);
-
- if (self->priv->controller) {
- SpiceSession *session = remote_viewer_get_spice_session(self);
- ret = spice_session_connect(session);
- g_object_unref(session);
- } else {
- ret = VIRT_VIEWER_APP_CLASS(remote_viewer_parent_class)->activate(app, error);
- }
-
- return ret;
-}
-
-static void
-remote_viewer_window_added(GtkApplication *app,
- GtkWindow *w)
-{
- VirtViewerWindow *win = VIRT_VIEWER_WINDOW(
- g_object_get_data(G_OBJECT(w), "virt-viewer-window"));
- spice_menu_update(REMOTE_VIEWER(app), win);
- spice_foreign_menu_update(REMOTE_VIEWER(app), win);
-
- GTK_APPLICATION_CLASS(remote_viewer_parent_class)->window_added(app, w);
-}
#endif
#ifdef HAVE_OVIRT
@@ -1094,29 +677,8 @@ remote_viewer_start(VirtViewerApp *app, GError **err)
gchar *type = NULL;
GError *error = NULL;
-#ifdef HAVE_SPICE_GTK
- g_signal_connect(app, "notify", G_CALLBACK(app_notified), self);
-
- if (priv->controller) {
- if (!virt_viewer_app_create_session(app, "spice", &error)) {
- g_debug("Couldn't create a Spice session");
- goto cleanup;
- }
-
- g_signal_connect(priv->controller, "notify", G_CALLBACK(spice_ctrl_notified), self);
- g_signal_connect(priv->controller, "do_connect", G_CALLBACK(spice_ctrl_do_connect), self);
- g_signal_connect(priv->controller, "show", G_CALLBACK(spice_ctrl_show), self);
- g_signal_connect(priv->controller, "hide", G_CALLBACK(spice_ctrl_hide), self);
-
- spice_ctrl_controller_listen(priv->controller, NULL, spice_ctrl_listen_async_cb, self);
-
- g_signal_connect(priv->ctrl_foreign_menu, "notify", G_CALLBACK(spice_ctrl_foreign_menu_notified), self);
- spice_ctrl_foreign_menu_listen(priv->ctrl_foreign_menu, NULL, spice_ctrl_listen_async_cb, self);
-
- virt_viewer_app_show_status(VIRT_VIEWER_APP(self), _("Setting up Spice session..."));
- } else {
-#endif
retry_dialog:
+ {
if (priv->open_recent_dialog) {
VirtViewerWindow *main_window = virt_viewer_app_get_main_window(app);
if (!remote_viewer_connect_dialog(virt_viewer_window_get_window(main_window), &guri)) {
@@ -1186,9 +748,7 @@ retry_dialog:
}
goto cleanup;
}
-#ifdef HAVE_SPICE_GTK
}
-#endif
ret = VIRT_VIEWER_APP_CLASS(remote_viewer_parent_class)->start(app, &error);
--
2.17.1