[X2Go-Commits] [libx2goclient] 01/02: src/x2goclient-network.{c, h}: implement some setter and getter code for socket and options.
git-admin at x2go.org
git-admin at x2go.org
Mon Jul 22 23:55:52 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 4e17b1ec352a777c45a75fe057d0b5001d25f356
Author: Mihai Moldovan <ionic at ionic.de>
Date: Mon Jul 22 23:55:07 2019 +0200
src/x2goclient-network.{c,h}: implement some setter and getter code for socket and options.
---
src/x2goclient-network.c | 56 ++++++++++++++++++++++++++++++++++++++++++++----
src/x2goclient-network.h | 8 +++++++
2 files changed, 60 insertions(+), 4 deletions(-)
diff --git a/src/x2goclient-network.c b/src/x2goclient-network.c
index 2c46092..5cd1381 100644
--- a/src/x2goclient-network.c
+++ b/src/x2goclient-network.c
@@ -49,13 +49,13 @@ static void x2goclient_network_options_init (X2GoClientNetworkOptions *self) {
}
-/*
typedef struct X2GoClientNetworkPrivate_ {
+ GSocketAddress *socket;
+ X2GoClientNetworkOptions *options;
} X2GoClientNetworkPrivate;
-*/
-/* G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (X2GoClientNetwork, x2goclient_network, G_TYPE_OBJECT); */
-G_DEFINE_ABSTRACT_TYPE (X2GoClientNetwork, x2goclient_network, G_TYPE_OBJECT);
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (X2GoClientNetwork, x2goclient_network, G_TYPE_OBJECT);
+/* G_DEFINE_ABSTRACT_TYPE (X2GoClientNetwork, x2goclient_network, G_TYPE_OBJECT); */
/*
* Caution: NEVER abbreviate names in public (API) space.
@@ -72,9 +72,56 @@ enum {
static GParamSpec *net_obj_properties[X2GO_NET_N_PROPERTIES] = { NULL, };
+static GSocketAddress* x2goclient_network_parse_sockspec (X2GoClientNetwork *self, const GString *sockspec) {
+ return X2GOCLIENT_NETWORK_GET_CLASS (self)->parse_sockspec (self, sockspec);
+}
+
+static void x2goclient_network_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *param_spec) {
+ X2GoClientNetwork *self = X2GOCLIENT_NETWORK (object);
+ 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_OPTIONS):
+ g_free (priv->options);
+ priv->options = x2goclient_network_options_new ();
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, param_spec);
+ break;
+ }
+}
+
+static void x2goclient_network_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *param_spec) {
+ X2GoClientNetwork *self = X2GOCLIENT_NETWORK (object);
+ X2GoClientNetworkPrivate *priv = x2goclient_network_get_instance_private (self);
+
+ switch (prop_id) {
+ case (X2GO_NET_PROP_SOCKET):
+ g_value_set_object (value, priv->socket);
+ break;
+ case (X2GO_NET_PROP_OPTIONS):
+ g_value_set_object (value, priv->options);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, param_spec);
+ break;
+ }
+}
+
static void x2goclient_network_class_init (X2GoClientNetworkClass *klass) {
GObjectClass *object_class = G_OBJECT_CLASS (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.",
@@ -90,4 +137,5 @@ static void x2goclient_network_class_init (X2GoClientNetworkClass *klass) {
}
static void x2goclient_network_init (X2GoClientNetwork *self) {
+ X2GoClientNetworkPrivate *priv = x2goclient_network_get_instance_private (self);
}
diff --git a/src/x2goclient-network.h b/src/x2goclient-network.h
index 998221a..910bb66 100644
--- a/src/x2goclient-network.h
+++ b/src/x2goclient-network.h
@@ -41,6 +41,14 @@ G_DECLARE_DERIVABLE_TYPE (X2GoClientNetwork, x2goclient_network, X2GOCLIENT, NET
struct _X2GoClientNetworkClass {
GObjectClass parent_class;
+
+ gboolean (*connect) (void);
+
+ /*< private >*/
+ GSocketAddress* (*parse_sockspec) (X2GoClientNetwork *self, const GString *sockspec);
+
+ /* We might need a lot more functions... */
+ gpointer padding[50];
};
G_END_DECLS
--
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