[PATCH v4 2/5] Minor code cleanups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- Reuse #ifdef HAVE_SPICE_GTK block for include.
- Move declaration of vfunc together with others of the same class.
- Move variable declaration to the top of the function.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@xxxxxxxxxx>
---
 src/remote-viewer.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 8e4754f..e712d61 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -36,11 +36,9 @@
 
 #ifdef HAVE_SPICE_GTK
 #include <spice-controller.h>
-#endif
-
-#ifdef HAVE_SPICE_GTK
 #include "virt-viewer-session-spice.h"
 #endif
+
 #include "virt-viewer-app.h"
 #include "virt-viewer-auth.h"
 #include "virt-viewer-file.h"
@@ -195,10 +193,10 @@ remote_viewer_class_init (RemoteViewerClass *klass)
 
     object_class->get_property = remote_viewer_get_property;
     object_class->set_property = remote_viewer_set_property;
+    object_class->dispose = remote_viewer_dispose;
 
     app_class->start = remote_viewer_start;
     app_class->deactivated = remote_viewer_deactivated;
-    object_class->dispose = remote_viewer_dispose;
 #ifdef HAVE_SPICE_GTK
     app_class->activate = remote_viewer_activate;
     app_class->window_added = remote_viewer_window_added;
@@ -617,10 +615,13 @@ spice_ctrl_listen_async_cb(GObject *object,
 static gboolean
 remote_viewer_activate(VirtViewerApp *app, GError **error)
 {
-    g_return_val_if_fail(REMOTE_VIEWER_IS(app), FALSE);
-    RemoteViewer *self = REMOTE_VIEWER(app);
+    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);
-- 
2.5.0

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux