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

[virt-tools-list] [PATCH 2/2] VirtViewerDisplaySpice: use enum type for auto_resize



Instead of storing the auto_resize member as an integer, use the enum, it makes
it slightly easier for debugging. Also, explicitly initialize the value.
---
 src/virt-viewer-display-spice.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index 48f07e3..54c1672 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -35,16 +35,16 @@
 
 G_DEFINE_TYPE (VirtViewerDisplaySpice, virt_viewer_display_spice, VIRT_VIEWER_TYPE_DISPLAY)
 
-struct _VirtViewerDisplaySpicePrivate {
-    SpiceChannel *channel; /* weak reference */
-    SpiceDisplay *display;
-    int auto_resize;
-};
-
-enum {
+typedef enum {
     AUTO_RESIZE_ALWAYS,
     AUTO_RESIZE_FULLSCREEN,
     AUTO_RESIZE_NEVER,
+} AutoResizeState;
+
+struct _VirtViewerDisplaySpicePrivate {
+    SpiceChannel *channel; /* weak reference */
+    SpiceDisplay *display;
+    AutoResizeState auto_resize;
 };
 
 #define VIRT_VIEWER_DISPLAY_SPICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), VIRT_VIEWER_TYPE_DISPLAY_SPICE, VirtViewerDisplaySpicePrivate))
@@ -117,6 +117,7 @@ static void
 virt_viewer_display_spice_init(VirtViewerDisplaySpice *self G_GNUC_UNUSED)
 {
     self->priv = VIRT_VIEWER_DISPLAY_SPICE_GET_PRIVATE(self);
+    self->priv->auto_resize = AUTO_RESIZE_ALWAYS;
 
     g_signal_connect(self, "notify::show-hint", G_CALLBACK(show_hint_changed), NULL);
 }
-- 
1.8.3.1


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