|
Packit Service |
ea0369 |
/*
|
|
Packit Service |
ea0369 |
* libvirt-gconfig-domain-graphics.c: libvirt domain graphics configuration
|
|
Packit Service |
ea0369 |
*
|
|
Packit Service |
ea0369 |
* Copyright (C) 2011 Red Hat, Inc.
|
|
Packit Service |
ea0369 |
*
|
|
Packit Service |
ea0369 |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
ea0369 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
ea0369 |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
ea0369 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
ea0369 |
*
|
|
Packit Service |
ea0369 |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
ea0369 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
ea0369 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
ea0369 |
* Lesser General Public License for more details.
|
|
Packit Service |
ea0369 |
*
|
|
Packit Service |
ea0369 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
ea0369 |
* License along with this library. If not, see
|
|
Packit Service |
ea0369 |
* <http://www.gnu.org/licenses/>.
|
|
Packit Service |
ea0369 |
*
|
|
Packit Service |
ea0369 |
* Author: Christophe Fergeau <cfergeau@gmail.com>
|
|
Packit Service |
ea0369 |
*/
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
#include <config.h>
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
#include "libvirt-gconfig/libvirt-gconfig.h"
|
|
Packit Service |
ea0369 |
#include "libvirt-gconfig/libvirt-gconfig-private.h"
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
#define GVIR_CONFIG_DOMAIN_GRAPHICS_GET_PRIVATE(obj) \
|
|
Packit Service |
ea0369 |
(G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS, GVirConfigDomainGraphicsPrivate))
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
struct _GVirConfigDomainGraphicsPrivate
|
|
Packit Service |
ea0369 |
{
|
|
Packit Service |
ea0369 |
gboolean unused;
|
|
Packit Service |
ea0369 |
};
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(GVirConfigDomainGraphics, gvir_config_domain_graphics, GVIR_CONFIG_TYPE_DOMAIN_DEVICE);
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
static void gvir_config_domain_graphics_class_init(GVirConfigDomainGraphicsClass *klass G_GNUC_UNUSED)
|
|
Packit Service |
ea0369 |
{
|
|
Packit Service |
ea0369 |
}
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
static void gvir_config_domain_graphics_init(GVirConfigDomainGraphics *graphics)
|
|
Packit Service |
ea0369 |
{
|
|
Packit Service |
ea0369 |
graphics->priv = GVIR_CONFIG_DOMAIN_GRAPHICS_GET_PRIVATE(graphics);
|
|
Packit Service |
ea0369 |
}
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
G_GNUC_INTERNAL GVirConfigDomainDevice *
|
|
Packit Service |
ea0369 |
gvir_config_domain_graphics_new_from_tree(GVirConfigXmlDoc *doc,
|
|
Packit Service |
ea0369 |
xmlNodePtr tree)
|
|
Packit Service |
ea0369 |
{
|
|
Packit Service |
ea0369 |
const char *type;
|
|
Packit Service |
ea0369 |
GType gtype;
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
type = gvir_config_xml_get_attribute_content(tree, "type");
|
|
Packit Service |
ea0369 |
if (type == NULL)
|
|
Packit Service |
ea0369 |
return NULL;
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
if (g_str_equal(type, "sdl")) {
|
|
Packit Service |
ea0369 |
gtype = GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_SDL;
|
|
Packit Service |
ea0369 |
} else if (g_str_equal(type, "vnc")) {
|
|
Packit Service |
ea0369 |
gtype = GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_VNC;
|
|
Packit Service |
ea0369 |
} else if (g_str_equal(type, "spice")) {
|
|
Packit Service |
ea0369 |
gtype = GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_SPICE;
|
|
Packit Service |
ea0369 |
} else if (g_str_equal(type, "rdp")) {
|
|
Packit Service |
ea0369 |
gtype = GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_RDP;
|
|
Packit Service |
ea0369 |
} else if (g_str_equal(type, "desktop")) {
|
|
Packit Service |
ea0369 |
gtype = GVIR_CONFIG_TYPE_DOMAIN_GRAPHICS_DESKTOP;
|
|
Packit Service |
ea0369 |
} else {
|
|
Packit Service |
ea0369 |
g_debug("Unknown graphics node: %s", type);
|
|
Packit Service |
ea0369 |
return NULL;
|
|
Packit Service |
ea0369 |
}
|
|
Packit Service |
ea0369 |
|
|
Packit Service |
ea0369 |
return GVIR_CONFIG_DOMAIN_DEVICE(gvir_config_object_new_from_tree(gtype, doc, NULL, tree));
|
|
Packit Service |
ea0369 |
}
|