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

[libvirt] [libvirt-glib 3/4] config: Add GVirConfigDomainGraphicsDesktop class



---
 libvirt-gconfig/Makefile.am                        |  2 +
 .../libvirt-gconfig-domain-graphics-desktop.c      | 98 ++++++++++++++++++++++
 .../libvirt-gconfig-domain-graphics-desktop.h      | 71 ++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h                  |  1 +
 libvirt-gconfig/libvirt-gconfig.sym                |  6 ++
 5 files changed, 178 insertions(+)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index acd5289..68ba39d 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -39,6 +39,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-domain-disk.h \
 			libvirt-gconfig-domain-filesys.h \
 			libvirt-gconfig-domain-graphics.h \
+			libvirt-gconfig-domain-graphics-desktop.h \
 			libvirt-gconfig-domain-graphics-rdp.h \
 			libvirt-gconfig-domain-graphics-sdl.h \
 			libvirt-gconfig-domain-graphics-spice.h \
@@ -117,6 +118,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-domain-disk.c \
 			libvirt-gconfig-domain-filesys.c \
 			libvirt-gconfig-domain-graphics.c \
+			libvirt-gconfig-domain-graphics-desktop.c \
 			libvirt-gconfig-domain-graphics-rdp.c \
 			libvirt-gconfig-domain-graphics-sdl.c \
 			libvirt-gconfig-domain-graphics-spice.c \
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c
new file mode 100644
index 0000000..41b1112
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c
@@ -0,0 +1,98 @@
+/*
+ * libvirt-gconfig-domain-graphics-desktop.c: libvirt domain desktop configuration
+ *
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * 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, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Daniel P. Berrange <berrange redhat com>
+ */
+
+#include <config.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+#include "libvirt-gconfig/libvirt-gconfig-private.h"
+
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP, GVirConfigDomainGraphicsDesktopPrivate))
+
+struct _GVirConfigDomainGraphicsDesktopPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigDomainGraphicsDesktop, gvir_config_domain_graphics_desktop, GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS);
+
+
+static void gvir_config_domain_graphics_desktop_class_init(GVirConfigDomainGraphicsDesktopClass *klass)
+{
+    g_type_class_add_private(klass, sizeof(GVirConfigDomainGraphicsDesktopPrivate));
+}
+
+
+static void gvir_config_domain_graphics_desktop_init(GVirConfigDomainGraphicsDesktop *graphics_desktop)
+{
+    g_debug("Init GVirConfigDomainGraphicsDesktop=%p", graphics_desktop);
+
+    graphics_desktop->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP_GET_PRIVATE(graphics_desktop);
+}
+
+
+GVirConfigDomainGraphicsDesktop *gvir_config_domain_graphics_desktop_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP,
+                                    "graphics", NULL);
+    gvir_config_object_set_attribute(object, "type", "desktop", NULL);
+    return GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP(object);
+}
+
+GVirConfigDomainGraphicsDesktop *
+gvir_config_domain_graphics_desktop_new_from_xml(const gchar *xml,
+                                             GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP,
+                                             "graphics", NULL, xml, error);
+    if (g_strcmp0(gvir_config_object_get_attribute(object, NULL, "type"), "desktop") != 0) {
+        g_object_unref(G_OBJECT(object));
+        return NULL;
+    }
+    return GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP(object);
+}
+
+void gvir_config_domain_graphics_desktop_set_display(GVirConfigDomainGraphicsDesktop *graphics,
+                                                 const gchar *disp)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_DESKTOP(graphics));
+
+    gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(graphics),
+                                     "display", disp,
+                                     NULL);
+}
+
+void gvir_config_domain_graphics_desktop_set_fullscreen(GVirConfigDomainGraphicsDesktop *graphics,
+                                                        gboolean fullscreen)
+{
+    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_DESKTOP(graphics));
+
+    gvir_config_object_set_attribute_with_type(GVIR_CONFIG_OBJECT(graphics),
+                                               "fullscreen",
+                                               G_TYPE_BOOLEAN,
+                                               fullscreen,
+                                               NULL);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h
new file mode 100644
index 0000000..d16e3d8
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h
@@ -0,0 +1,71 @@
+/*
+ * libvirt-gconfig-domain-graphics-desktop.h: libvirt domain desktop configuration
+ *
+ * Copyright (C) 2011 Red Hat, Inc.
+ *
+ * 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, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Daniel P. Berrange <berrange redhat com>
+ */
+
+#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_DESKTOP_H__
+#define __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_DESKTOP_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP            (gvir_config_domain_graphics_desktop_get_type ())
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP, GVirConfigDomainGraphicsDesktop))
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP, GVirConfigDomainGraphicsDesktopClass))
+#define GVIR_CONFIG_IS_DOMAIN_GRAPHICS_DESKTOP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP))
+#define GVIR_CONFIG_IS_DOMAIN_GRAPHICS_DESKTOP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP))
+#define GVIR_CONFIG_DOMAIN_GRAPHICS_DESKTOP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP, GVirConfigDomainGraphicsDesktopClass))
+
+typedef struct _GVirConfigDomainGraphicsDesktop GVirConfigDomainGraphicsDesktop;
+typedef struct _GVirConfigDomainGraphicsDesktopPrivate GVirConfigDomainGraphicsDesktopPrivate;
+typedef struct _GVirConfigDomainGraphicsDesktopClass GVirConfigDomainGraphicsDesktopClass;
+
+struct _GVirConfigDomainGraphicsDesktop
+{
+    GVirConfigDomainGraphics parent;
+
+    GVirConfigDomainGraphicsDesktopPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigDomainGraphicsDesktopClass
+{
+    GVirConfigDomainGraphicsClass parent_class;
+
+    gpointer padding[20];
+};
+
+GType gvir_config_domain_graphics_desktop_get_type(void);
+
+GVirConfigDomainGraphicsDesktop *gvir_config_domain_graphics_desktop_new(void);
+GVirConfigDomainGraphicsDesktop *gvir_config_domain_graphics_desktop_new_from_xml(const gchar *xml,
+                                                                                  GError **error);
+void gvir_config_domain_graphics_desktop_set_display(GVirConfigDomainGraphicsDesktop *graphics,
+                                                     const gchar *disp);
+void gvir_config_domain_graphics_desktop_set_fullscreen(GVirConfigDomainGraphicsDesktop *graphics,
+                                                        gboolean fullscreen);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_DOMAIN_GRAPHICS_DESKTOP_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 678389a..b000747 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -56,6 +56,7 @@
 #include <libvirt-gconfig/libvirt-gconfig-domain-disk.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-filesys.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-graphics.h>
+#include <libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h>
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index d06408f..886da2f 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -514,6 +514,12 @@ LIBVIRT_GCONFIG_0.1.6 {
 
 LIBVIRT_GCONFIG_0.1.7 {
   global:
+	gvir_config_domain_graphics_desktop_get_type;
+	gvir_config_domain_graphics_desktop_new;
+	gvir_config_domain_graphics_desktop_new_from_xml;
+	gvir_config_domain_graphics_desktop_set_display;
+	gvir_config_domain_graphics_desktop_set_fullscreen;
+
 	gvir_config_domain_graphics_sdl_set_fullscreen;
 
 	gvir_config_domain_graphics_rdp_get_type;
-- 
1.8.1.4


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