[libvirt-glib PATCHv3 24/27] Add GObject boilerplate for GVirConfigDomainGraphics

[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, ...)

--
v3: rename to GVirConfigDomainGraphics
---
 libvirt-gconfig/Makefile.am                       |    2 +
 libvirt-gconfig/libvirt-gconfig-domain-graphics.c |   61 ++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain-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-domain-graphics.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 52721ad..2ed140f 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -15,6 +15,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-domain-clock.h \
 			libvirt-gconfig-domain-device.h \
 			libvirt-gconfig-domain-disk.h \
+			libvirt-gconfig-domain-graphics.h \
 			libvirt-gconfig-domain-input.h \
 			libvirt-gconfig-domain-interface.h \
 			libvirt-gconfig-domain-interface-network.h \
@@ -39,6 +40,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-domain-clock.c \
 			libvirt-gconfig-domain-device.c \
 			libvirt-gconfig-domain-disk.c \
+			libvirt-gconfig-domain-graphics.c \
 			libvirt-gconfig-domain-input.c \
 			libvirt-gconfig-domain-interface.c \
 			libvirt-gconfig-domain-interface-network.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
new file mode 100644
index 0000000..6e48b72
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics.c
@@ -0,0 +1,61 @@
+/*
+ * libvirt-gobject-config-domain-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_DOMAIN_GRAPHICS_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS, GVirConfigDomainGraphicsPrivate))
+
+struct _GVirConfigDomainGraphicsPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_ABSTRACT_TYPE(GVirConfigDomainGraphics, gvir_config_domain_graphics, GVIR_TYPE_CONFIG_DOMAIN_DEVICE);
+
+
+static void gvir_config_domain_graphics_class_init(GVirConfigDomainGraphicsClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsPrivate));
+}
+
+
+static void gvir_config_domain_graphics_init(GVirConfigDomainGraphics *graphics)
+{
+    GVirConfigDomainGraphicsPrivate *priv;
+
+    DEBUG("Init GVirConfigDomainGraphics=%p", graphics);
+
+    priv = graphics->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_GET_PRIVATE(graphics);
+
+    memset(priv, 0, sizeof(*priv));
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics.h
new file mode 100644
index 0000000..572d4d9
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics.h
@@ -0,0 +1,64 @@
+/*
+ * libvirt-gobject-domain-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_DOMAIN_GRAPHICS_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS            (gvir_config_domain_graphics_get_type ())
+#define GVIR_CONFIG_DOMAIN_GRAPHICS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS, GVirConfigDomainGraphics))
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS, GVirConfigDomainGraphicsClass))
+#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS))
+#define GVIR_IS_CONFIG_DOMAIN_GRAPHICS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS))
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_DOMAIN_GRAPHICS, GVirConfigDomainGraphicsClass))
+
+typedef struct _GVirConfigDomainGraphics GVirConfigDomainGraphics;
+typedef struct _GVirConfigDomainGraphicsPrivate GVirConfigDomainGraphicsPrivate;
+typedef struct _GVirConfigDomainGraphicsClass GVirConfigDomainGraphicsClass;
+
+struct _GVirConfigDomainGraphics
+{
+    GVirConfigDomainDevice parent;
+
+    GVirConfigDomainGraphicsPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainGraphicsClass
+{
+    GVirConfigDomainDeviceClass parent_class;
+
+    gpointer padding[20];
+};
+
+
+GType gvir_config_domain_graphics_get_type(void);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index f6bd45d..b3fb0f1 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -32,6 +32,7 @@
 #include <libvirt-gconfig/libvirt-gconfig-domain-clock.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-device.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-graphics.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-input.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-interface.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-interface-network.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index b0a5ae1..e3ba263 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -44,6 +44,8 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_domain_disk_set_target_dev;
 	gvir_config_domain_disk_set_type;
 
+	gvir_config_domain_graphics_get_type;
+
 	gvir_config_domain_input_get_type;
 	gvir_config_domain_input_device_type_get_type;
 	gvir_config_domain_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]