[libvirt-gconfig PATCHv2 30/32] Add GObject boilerplate for GVirConfigDeviceGraphics

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

 



This is an abstract type which will be used as a base class for the
various type of <graphics> devices (spice, vnc, ...)
---
 libvirt-gconfig/Makefile.am                       |    2 +
 libvirt-gconfig/libvirt-gconfig-device-graphics.c |   61 ++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-device-graphics.h |   64 +++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h                 |    1 +
 libvirt-gconfig/libvirt-gconfig.sym               |    2 +
 5 files changed, 130 insertions(+), 0 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-device-graphics.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-device-graphics.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 76861a1..8aaa827 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -14,6 +14,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-clock.h \
 			libvirt-gconfig-device.h \
 			libvirt-gconfig-device-disk.h \
+			libvirt-gconfig-device-graphics.h \
 			libvirt-gconfig-device-input.h \
 			libvirt-gconfig-domain.h \
 			libvirt-gconfig-domain-snapshot.h \
@@ -37,6 +38,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-clock.c \
 			libvirt-gconfig-device.c \
 			libvirt-gconfig-device-disk.c \
+			libvirt-gconfig-device-graphics.c \
 			libvirt-gconfig-device-input.c \
 			libvirt-gconfig-domain.c \
 			libvirt-gconfig-domain-snapshot.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-device-graphics.c b/libvirt-gconfig/libvirt-gconfig-device-graphics.c
new file mode 100644
index 0000000..b659d08
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-device-graphics.c
@@ -0,0 +1,61 @@
+/*
+ * libvirt-gobject-config-device-graphics.c: libvirt glib integration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau@xxxxxxxxx>
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <libxml/tree.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+
+extern gboolean debugFlag;
+
+#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
+
+#define GVIR_CONFIG_DEVICE_GRAPHICS_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DEVICE_GRAPHICS, GVirConfigDeviceGraphicsPrivate))
+
+struct _GVirConfigDeviceGraphicsPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_ABSTRACT_TYPE(GVirConfigDeviceGraphics, gvir_config_device_graphics, GVIR_TYPE_CONFIG_DEVICE);
+
+
+static void gvir_config_device_graphics_class_init(GVirConfigDeviceGraphicsClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDeviceGraphicsPrivate));
+}
+
+
+static void gvir_config_device_graphics_init(GVirConfigDeviceGraphics *device_graphics)
+{
+    GVirConfigDeviceGraphicsPrivate *priv;
+
+    DEBUG("Init GVirConfigDeviceGraphics=%p", device_graphics);
+
+    priv = device_graphics->priv = GVIR_CONFIG_DEVICE_GRAPHICS_GET_PRIVATE(device_graphics);
+
+    memset(priv, 0, sizeof(*priv));
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-device-graphics.h b/libvirt-gconfig/libvirt-gconfig-device-graphics.h
new file mode 100644
index 0000000..12f1d5b
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-device-graphics.h
@@ -0,0 +1,64 @@
+/*
+ * libvirt-gobject-device-graphics.c: libvirt gobject integration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau@xxxxxxxxx>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_DEVICE_GRAPHICS_H__
+#define __LIBVIRT_GCONFIG_DEVICE_GRAPHICS_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_DEVICE_GRAPHICS            (gvir_config_device_graphics_get_type ())
+#define GVIR_CONFIG_DEVICE_GRAPHICS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DEVICE_GRAPHICS, GVirConfigDeviceGraphics))
+#define GVIR_CONFIG_DEVICE_GRAPHICS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DEVICE_GRAPHICS, GVirConfigDeviceGraphicsClass))
+#define GVIR_IS_CONFIG_DEVICE_GRAPHICS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DEVICE_GRAPHICS))
+#define GVIR_IS_CONFIG_DEVICE_GRAPHICS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DEVICE_GRAPHICS))
+#define GVIR_CONFIG_DEVICE_GRAPHICS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DEVICE_GRAPHICS, GVirConfigDeviceGraphicsClass))
+
+typedef struct _GVirConfigDeviceGraphics GVirConfigDeviceGraphics;
+typedef struct _GVirConfigDeviceGraphicsPrivate GVirConfigDeviceGraphicsPrivate;
+typedef struct _GVirConfigDeviceGraphicsClass GVirConfigDeviceGraphicsClass;
+
+struct _GVirConfigDeviceGraphics
+{
+    GVirConfigDevice parent;
+
+    GVirConfigDeviceGraphicsPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDeviceGraphicsClass
+{
+    GVirConfigDeviceClass parent_class;
+
+    gpointer padding[20];
+};
+
+
+GType gvir_config_device_graphics_get_type(void);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DEVICE_GRAPHICS_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 0f0abb7..8b56655 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -31,6 +31,7 @@
 #include <libvirt-gconfig/libvirt-gconfig-clock.h>
 #include <libvirt-gconfig/libvirt-gconfig-device.h>
 #include <libvirt-gconfig/libvirt-gconfig-device-disk.h>
+#include <libvirt-gconfig/libvirt-gconfig-device-graphics.h>
 #include <libvirt-gconfig/libvirt-gconfig-device-input.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h>
 #include <libvirt-gconfig/libvirt-gconfig-enum-types.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 326a421..484ae39 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -29,6 +29,8 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_device_disk_set_target_dev;
 	gvir_config_device_disk_set_type;
 
+	gvir_config_device_graphics_get_type;
+
 	gvir_config_device_input_get_type;
 	gvir_config_device_input_device_type_get_type;
 	gvir_config_device_input_new;
-- 
1.7.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]