[virt-tools-list] [virt-viewer][PATCH 4/4 v2] Replace priv->withEvents usage for priv->domain_event

Fabiano Fidêncio fidencio at redhat.com
Wed Nov 19 15:05:47 UTC 2014


Once we have priv->domain_event, we don't need priv->withEvents anymore
---
 src/virt-viewer.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 2c19057..3c45728 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -55,7 +55,6 @@ struct _VirtViewerPrivate {
     virConnectPtr conn;
     virDomainPtr dom;
     char *domkey;
-    gboolean withEvents;
     gboolean waitvm;
     gboolean reconnect;
     gboolean auth_cancelled;
@@ -128,7 +127,7 @@ virt_viewer_deactivated(VirtViewerApp *app, gboolean connect_error)
     }
 
     if (priv->reconnect) {
-        if (!priv->withEvents) {
+        if (priv->domain_event < 0) {
             g_debug("No domain events, falling back to polling");
             virt_viewer_app_start_reconnect_poll(app);
         }
@@ -531,7 +530,7 @@ virt_viewer_dispose (GObject *object)
     VirtViewerPrivate *priv = self->priv;
 
     if (priv->conn) {
-        if (priv->withEvents) {
+        if (priv->domain_event >= 0) {
             virConnectDomainEventDeregisterAny(priv->conn,
                                                priv->domain_event);
             priv->domain_event = -1;
@@ -833,12 +832,7 @@ virt_viewer_connect(VirtViewerApp *app)
                                                           VIR_DOMAIN_EVENT_CALLBACK(virt_viewer_domain_event),
                                                           self,
                                                           NULL);
-    if (priv->domain_event < 0)
-        priv->withEvents = FALSE;
-    else
-        priv->withEvents = TRUE;
-
-    if (!priv->withEvents &&
+    if (priv->domain_event < 0 &&
         !virt_viewer_app_is_active(app)) {
         g_debug("No domain events, falling back to polling");
         virt_viewer_app_start_reconnect_poll(app);
-- 
2.1.0




More information about the virt-tools-list mailing list