[virt-tools-list] [PATCH virt-viewer 1/2] file: add username support
Marc-André Lureau
marcandre.lureau at gmail.com
Thu Jan 17 11:53:33 UTC 2013
---
src/virt-viewer-file.c | 25 +++++++++++++++++++++++++
src/virt-viewer-file.h | 2 ++
2 files changed, 27 insertions(+)
diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c
index d98a0a2..caac50f 100644
--- a/src/virt-viewer-file.c
+++ b/src/virt-viewer-file.c
@@ -38,6 +38,7 @@
* - host: string
* - port: int
* - tls-port: int
+ * - username: string
* - password: string
* - disable-channels: string list
* - tls-ciphers: string
@@ -76,6 +77,7 @@ enum {
PROP_HOST,
PROP_PORT,
PROP_TLS_PORT,
+ PROP_USERNAME,
PROP_PASSWORD,
PROP_DISABLE_CHANNELS,
PROP_TLS_CIPHERS,
@@ -287,12 +289,25 @@ virt_viewer_file_set_tls_port(VirtViewerFile* self, gint value)
}
gchar*
+virt_viewer_file_get_username(VirtViewerFile* self)
+{
+ return virt_viewer_file_get_string(self, "username");
+}
+
+gchar*
virt_viewer_file_get_password(VirtViewerFile* self)
{
return virt_viewer_file_get_string(self, "password");
}
void
+virt_viewer_file_set_username(VirtViewerFile* self, const gchar* value)
+{
+ virt_viewer_file_set_string(self, "username", value);
+ g_object_notify(G_OBJECT(self), "username");
+}
+
+void
virt_viewer_file_set_password(VirtViewerFile* self, const gchar* value)
{
virt_viewer_file_set_string(self, "password", value);
@@ -568,6 +583,9 @@ virt_viewer_file_set_property(GObject* object, guint property_id,
case PROP_TLS_PORT:
virt_viewer_file_set_tls_port(self, g_value_get_int(value));
break;
+ case PROP_USERNAME:
+ virt_viewer_file_set_username(self, g_value_get_string(value));
+ break;
case PROP_PASSWORD:
virt_viewer_file_set_password(self, g_value_get_string(value));
break;
@@ -640,6 +658,9 @@ virt_viewer_file_get_property(GObject* object, guint property_id,
case PROP_TLS_PORT:
g_value_set_int(value, virt_viewer_file_get_tls_port(self));
break;
+ case PROP_USERNAME:
+ g_value_take_string(value, virt_viewer_file_get_username(self));
+ break;
case PROP_PASSWORD:
g_value_take_string(value, virt_viewer_file_get_password(self));
break;
@@ -736,6 +757,10 @@ virt_viewer_file_class_init(VirtViewerFileClass* klass)
g_param_spec_int("tls-port", "tls-port", "tls-port", -1, 65535, -1,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
+ g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_USERNAME,
+ g_param_spec_string("username", "username", "username", NULL,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
+
g_object_class_install_property(G_OBJECT_CLASS(klass), PROP_PASSWORD,
g_param_spec_string("password", "password", "password", NULL,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE));
diff --git a/src/virt-viewer-file.h b/src/virt-viewer-file.h
index e0fed2d..c0b2aa8 100644
--- a/src/virt-viewer-file.h
+++ b/src/virt-viewer-file.h
@@ -63,6 +63,8 @@ gint virt_viewer_file_get_port(VirtViewerFile* self);
void virt_viewer_file_set_port(VirtViewerFile* self, gint value);
gint virt_viewer_file_get_tls_port(VirtViewerFile* self);
void virt_viewer_file_set_tls_port(VirtViewerFile* self, gint value);
+gchar* virt_viewer_file_get_username(VirtViewerFile* self);
+void virt_viewer_file_set_username(VirtViewerFile* self, const gchar* value);
gchar* virt_viewer_file_get_password(VirtViewerFile* self);
void virt_viewer_file_set_password(VirtViewerFile* self, const gchar* value);
gchar** virt_viewer_file_get_disable_channels(VirtViewerFile* self, gsize* length);
--
1.8.1.rc1.17.g75ed918
More information about the virt-tools-list
mailing list