[X2Go-Commits] [libx2goclient] 06/09: src/x2goclient-network.c: fix properties.
git-admin at x2go.org
git-admin at x2go.org
Thu Aug 15 17:40:10 CEST 2019
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository libx2goclient.
commit 3ca13250c4f2dc6f7fa36f54e2b2759568a9dcd3
Author: Mihai Moldovan <ionic at ionic.de>
Date: Thu Aug 15 17:32:16 2019 +0200
src/x2goclient-network.c: fix properties.
We now have both a socket property, typed GSocketAddress, that is
read-only and contains the actual "parsed" result, and a socket-spec
property, typed GString, that is write-only and will be used for parsing
the actual specification.
---
src/x2goclient-network.c | 38 ++++++++++++++++++++++----------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/src/x2goclient-network.c b/src/x2goclient-network.c
index 3af4f12..2461bee 100644
--- a/src/x2goclient-network.c
+++ b/src/x2goclient-network.c
@@ -50,6 +50,7 @@ static void x2goclient_network_options_init (X2GoClientNetworkOptions *self) {
typedef struct X2GoClientNetworkPrivate_ {
+ GString *socket_spec;
GSocketAddress *socket;
X2GoClientNetworkOptions *options;
} X2GoClientNetworkPrivate;
@@ -65,7 +66,8 @@ G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (X2GoClientNetwork, x2goclient_network, G_TY
* is actually exported, we can go bonkers with abbreviations.
*/
enum {
- X2GO_NET_PROP_SOCKET = 1,
+ X2GO_NET_PROP_SOCKET_SPEC = 1,
+ X2GO_NET_PROP_SOCKET,
X2GO_NET_PROP_OPTIONS,
X2GO_NET_N_PROPERTIES
};
@@ -95,16 +97,14 @@ static void x2goclient_network_set_property (GObject *object, guint prop_id, con
X2GoClientNetworkPrivate *priv = x2goclient_network_get_instance_private (self);
switch (prop_id) {
- case (X2GO_NET_PROP_SOCKET):
- g_free (priv->socket);
- /*
- * We'll actually expect a GString here, not a GSocketAddress.
- * How do we document that correctly, though?
- */
- priv->socket = x2goclient_network_parse_sockspec (self, g_value_get_object (value));
- break;
+ case (X2GO_NET_PROP_SOCKET_SPEC):
+ g_free (priv->socket_spec);
+ g_clear_object (&(priv->socket));
+ priv->socket_spec = g_value_dup_boxed (value);
+ priv->socket = x2goclient_network_parse_sockspec (self, priv->socket_spec);
+ break;
case (X2GO_NET_PROP_OPTIONS):
- g_free (priv->options);
+ g_clear_object (&(priv->options));
priv->options = g_value_dup_object (value);
break;
default:
@@ -136,14 +136,20 @@ static void x2goclient_network_class_init (X2GoClientNetworkClass *klass) {
object_class->set_property = x2goclient_network_set_property;
object_class->get_property = x2goclient_network_get_property;
- net_obj_properties[X2GO_NET_PROP_SOCKET] = g_param_spec_object ("socket", "Low-level socket",
- "Low-level socket for the network connection, the local "
- "part will be used for local binding if specified.",
+ net_obj_properties[X2GO_NET_PROP_SOCKET_SPEC] = g_param_spec_boxed ("socket-spec", _("Low-level socket string specification"),
+ _("String specification for the low-level socket network "
+ "connection. Updates the \"socket\" property."),
+ G_TYPE_GSTRING,
+ G_PARAM_WRITABLE);
+
+ net_obj_properties[X2GO_NET_PROP_SOCKET] = g_param_spec_object ("socket", _("Low-level socket"),
+ _("Low-level socket for the network connection, the local "
+ "part will be used for local binding if specified."),
G_TYPE_SOCKET_ADDRESS,
- G_PARAM_READWRITE);
+ G_PARAM_READABLE);
- net_obj_properties[X2GO_NET_PROP_OPTIONS] = g_param_spec_object ("options", "Socket options",
- "Specific socket options.",
+ net_obj_properties[X2GO_NET_PROP_OPTIONS] = g_param_spec_object ("options", _("Socket options"),
+ _("Specific socket options."),
X2GOCLIENT_TYPE_NETWORK_OPTIONS,
G_PARAM_READWRITE);
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git
More information about the x2go-commits
mailing list