Commit b8e9b1f1 authored by Mihai Moldovan's avatar Mihai Moldovan
Browse files

src/x2goclient-network.c: add connected boolean private instance variable and...

src/x2goclient-network.c: add connected boolean private instance variable and read-only getters and setters.
parent 9ac95818
......@@ -54,6 +54,7 @@ typedef struct X2GoClientNetworkPrivate_ {
GSocketAddress *socket;
X2GoClientNetworkOptions *options;
gchar *session_path; /* Will eventually be replaced with a session object, probably. */
gboolean connected;
} X2GoClientNetworkPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (X2GoClientNetwork, x2goclient_network, G_TYPE_OBJECT);
......@@ -71,6 +72,7 @@ enum {
X2GO_NET_PROP_SOCKET,
X2GO_NET_PROP_OPTIONS,
X2GO_NET_PROP_SESSION_PATH,
X2GO_NET_PROP_CONNECTED,
X2GO_NET_N_PROPERTIES
};
......@@ -121,6 +123,12 @@ static void x2goclient_network_class_init (X2GoClientNetworkClass * const klass)
g_boxed_free (G_TYPE_GSTRING, default_session_path);
default_session_path = NULL;
net_obj_properties[X2GO_NET_PROP_CONNECTED] = g_param_spec_boolean ("connected", _("Boolean for connected state"),
_("Boolean value denoting whether a connection has "
"been established or not."),
FALSE,
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE);
g_object_class_install_properties (object_class, X2GO_NET_N_PROPERTIES, net_obj_properties);
}
......@@ -130,6 +138,7 @@ static void x2goclient_network_init (X2GoClientNetwork * const self) {
priv->socket = NULL;
priv->options = NULL;
priv->session_path = NULL;
priv->connected = FALSE;
}
static void x2goclient_network_dispose (GObject * const object) {
......@@ -203,6 +212,9 @@ static void x2goclient_network_set_property (GObject * const object, guint prop_
g_clear_object (&(priv->options));
priv->options = g_value_dup_object (value);
break;
case (X2GO_NET_PROP_CONNECTED):
priv->connected = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, param_spec);
break;
......@@ -223,6 +235,9 @@ static void x2goclient_network_get_property (GObject * const object, const guint
case (X2GO_NET_PROP_SESSION_PATH):
g_value_set_string (value, priv->session_path);
break;
case (X2GO_NET_PROP_CONNECTED):
g_value_set_boolean (value, priv->connected);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, param_spec);
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment