[virt-tools-list] [PATCH virt-viewer 3/6] app: add dbus-ctrl property

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Fri Jun 23 15:30:55 UTC 2017


From: Marc-André Lureau <marcandre.lureau at redhat.com>

If the dbus-ctrl property is set, we should call open_uri() without
guri set.

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 src/virt-viewer-app.c | 12 ++++++++++++
 src/virt-viewer-app.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 2a88882..c770cc0 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -130,6 +130,7 @@ struct _VirtViewerAppPrivate {
     gboolean active;
     gboolean connected;
     gboolean cancelled;
+    gboolean dbus_ctrl;
     char *unixsock;
     char *guri; /* prefered over ghost:gport */
     char *ghost;
@@ -1225,6 +1226,9 @@ virt_viewer_app_default_activate(VirtViewerApp *self, GError **error)
 
     if (fd >= 0) {
         return virt_viewer_session_open_fd(VIRT_VIEWER_SESSION(priv->session), fd);
+    } else if (priv->dbus_ctrl) {
+        /* open_uri handles session set with vv file */
+        return virt_viewer_session_open_uri(VIRT_VIEWER_SESSION(priv->session), NULL, error);
     } else if (priv->guri) {
         virt_viewer_app_trace(self, "Opening connection to display at %s", priv->guri);
         return virt_viewer_session_open_uri(VIRT_VIEWER_SESSION(priv->session), priv->guri, error);
@@ -2036,6 +2040,14 @@ virt_viewer_app_class_init (VirtViewerAppClass *klass)
                                                         G_PARAM_STATIC_STRINGS));
 }
 
+void
+virt_viewer_app_set_dbus_ctrl(VirtViewerApp *self, gboolean dbus_ctrl)
+{
+    g_return_if_fail(VIRT_VIEWER_IS_APP(self));
+
+    self->priv->dbus_ctrl = dbus_ctrl;
+}
+
 void
 virt_viewer_app_set_direct(VirtViewerApp *self, gboolean direct)
 {
diff --git a/src/virt-viewer-app.h b/src/virt-viewer-app.h
index 16b1c8c..6f6d9c8 100644
--- a/src/virt-viewer-app.h
+++ b/src/virt-viewer-app.h
@@ -98,6 +98,7 @@ void virt_viewer_app_set_enable_accel(VirtViewerApp *app, gboolean enable);
 void virt_viewer_app_show_preferences(VirtViewerApp *app, GtkWidget *parent);
 void virt_viewer_app_set_menus_sensitive(VirtViewerApp *self, gboolean sensitive);
 gboolean virt_viewer_app_get_session_cancelled(VirtViewerApp *self);
+void virt_viewer_app_set_dbus_ctrl(VirtViewerApp *self, gboolean dbus_ctrl);
 
 G_END_DECLS
 
-- 
2.13.1.395.gf7b71de06




More information about the virt-tools-list mailing list