[libvirt-glib 4/4] config: Add a few GVirConfigDomainGraphicsSpice getters

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

 



---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c | 16 ++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h |  2 ++
 libvirt-gconfig/libvirt-gconfig.sym                     |  2 ++
 libvirt-gconfig/tests/test-domain-create.c              |  2 ++
 4 files changed, 22 insertions(+)

diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
index 3aef0aa..8426f4a 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c
@@ -94,6 +94,14 @@ void gvir_config_domain_graphics_spice_set_password(GVirConfigDomainGraphicsSpic
                                      NULL);
 }
 
+const char *gvir_config_domain_graphics_spice_get_listen(GVirConfigDomainGraphicsSpice *graphics)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics), NULL);
+
+    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(graphics),
+                                            NULL, "listen");
+}
+
 void gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice *graphics,
                                                   const char *listen_ip)
 {
@@ -104,6 +112,14 @@ void gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice
                                      NULL);
 }
 
+int gvir_config_domain_graphics_spice_get_port(GVirConfigDomainGraphicsSpice *graphics)
+{
+    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_SPICE(graphics), 0);
+
+    return gvir_config_object_get_attribute_uint64(GVIR_CONFIG_OBJECT(graphics),
+                                                   NULL, "port", 0);
+}
+
 void gvir_config_domain_graphics_spice_set_port(GVirConfigDomainGraphicsSpice *graphics,
                                                 int port)
 {
diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
index bcaf04e..2fec9d8 100644
--- a/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
+++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.h
@@ -68,9 +68,11 @@ void gvir_config_domain_graphics_spice_set_autoport(GVirConfigDomainGraphicsSpic
 void gvir_config_domain_graphics_spice_set_password(GVirConfigDomainGraphicsSpice *graphics,
                                                     const char *password);
 
+const char *gvir_config_domain_graphics_spice_get_listen(GVirConfigDomainGraphicsSpice *graphics);
 void gvir_config_domain_graphics_spice_set_listen(GVirConfigDomainGraphicsSpice *graphics,
                                                   const char *listen_ip);
 
+int gvir_config_domain_graphics_spice_get_port(GVirConfigDomainGraphicsSpice *graphics);
 void gvir_config_domain_graphics_spice_set_port(GVirConfigDomainGraphicsSpice *graphics,
                                                 int port);
 
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index b66b28e..5b2ebf4 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -465,7 +465,9 @@ LIBVIRT_GCONFIG_0.1.3 {
 	gvir_config_domain_get_current_memory;
 	gvir_config_domain_set_current_memory;
 
+	gvir_config_domain_graphics_spice_get_listen;
 	gvir_config_domain_graphics_spice_set_listen;
+	gvir_config_domain_graphics_spice_get_port;
 
 	gvir_config_domain_graphics_vnc_get_listen;
 	gvir_config_domain_graphics_vnc_set_listen;
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index 903281d..5b64459 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -287,7 +287,9 @@ int main(int argc, char **argv)
 
     graphics = gvir_config_domain_graphics_spice_new();
     gvir_config_domain_graphics_spice_set_port(graphics, 1234);
+    g_assert(gvir_config_domain_graphics_spice_get_port(graphics) == 1234);
     gvir_config_domain_graphics_spice_set_listen(graphics, "127.0.0.1");
+    g_str_const_check(gvir_config_domain_graphics_spice_get_listen(graphics), "127.0.0.1");
     devices = g_list_append(devices, GVIR_CONFIG_DOMAIN_DEVICE(graphics));
 
     /* video node */
-- 
1.7.11.4

--
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]