Beispiel #1
0
/* dict GetProperties() */
GHashTable *network_get_properties(Network *self, GError **error)
{
	g_assert(NETWORK_IS(self));

	GHashTable *ret = NULL;
	dbus_g_proxy_call(self->priv->dbus_g_proxy, "GetProperties", error, G_TYPE_INVALID, DBUS_TYPE_G_STRING_VARIANT_HASHTABLE, &ret, G_TYPE_INVALID);

	return ret;
}
Beispiel #2
0
/* string Connect(string uuid) */
gchar *network_connect(Network *self, const gchar *uuid, GError **error)
{
	g_assert(NETWORK_IS(self));

	gchar *ret = NULL;
	dbus_g_proxy_call(self->priv->dbus_g_proxy, "Connect", error, G_TYPE_STRING, uuid, G_TYPE_INVALID, G_TYPE_STRING, &ret, G_TYPE_INVALID);

	return ret;
}
Beispiel #3
0
gboolean network_get_connected(Network *self, GError **error)
{
	g_assert(NETWORK_IS(self));
	g_assert(self->priv->properties != NULL);
	GVariant *prop = properties_get(self->priv->properties, NETWORK_DBUS_INTERFACE, "Connected", error);
	if(prop == NULL)
		return FALSE;
	gboolean ret = g_variant_get_boolean(prop);
	g_variant_unref(prop);
	return ret;
}
Beispiel #4
0
const gchar *network_get_uuid(Network *self, GError **error)
{
	g_assert(NETWORK_IS(self));
	g_assert(self->priv->properties != NULL);
	GVariant *prop = properties_get(self->priv->properties, NETWORK_DBUS_INTERFACE, "UUID", error);
	if(prop == NULL)
		return NULL;
	const gchar *ret = g_variant_get_string(prop, NULL);
	g_variant_unref(prop);
	return ret;
}
Beispiel #5
0
/* Private DBus proxy creation */
static void _network_create_gdbus_proxy(Network *self, const gchar *dbus_service_name, const gchar *dbus_object_path, GError **error)
{
	g_assert(NETWORK_IS(self));
	self->priv->proxy = g_dbus_proxy_new_sync(system_conn, G_DBUS_PROXY_FLAGS_NONE, NULL, dbus_service_name, dbus_object_path, NETWORK_DBUS_INTERFACE, NULL, error);

	if(self->priv->proxy == NULL)
		return;

	self->priv->properties = g_object_new(PROPERTIES_TYPE, "DBusType", "system", "DBusServiceName", dbus_service_name, "DBusObjectPath", dbus_object_path, NULL);
	g_assert(self->priv->properties != NULL);
}
Beispiel #6
0
/* string Connect(string uuid) */
const gchar *network_connect(Network *self, const gchar *uuid, GError **error)
{
	g_assert(NETWORK_IS(self));
	const gchar *ret = NULL;
	GVariant *proxy_ret = g_dbus_proxy_call_sync(self->priv->proxy, "Connect", g_variant_new ("(s)", uuid), G_DBUS_CALL_FLAGS_NONE, -1, NULL, error);
	if (proxy_ret != NULL)
		return NULL;
	proxy_ret = g_variant_get_child_value(proxy_ret, 0);
	ret = g_variant_get_string(proxy_ret, NULL);
	g_variant_unref(proxy_ret);
	return ret;
}
Beispiel #7
0
const gchar *network_get_uuid(Network *self)
{
	g_assert(NETWORK_IS(self));

	return self->priv->uuid;
}
Beispiel #8
0
const gchar *network_get_interface(Network *self)
{
	g_assert(NETWORK_IS(self));

	return self->priv->interface;
}
Beispiel #9
0
const gboolean network_get_connected(Network *self)
{
	g_assert(NETWORK_IS(self));

	return self->priv->connected;
}
Beispiel #10
0
/* Properties access methods */
const gchar *network_get_dbus_object_path(Network *self)
{
	g_assert(NETWORK_IS(self));

	return dbus_g_proxy_get_path(self->priv->dbus_g_proxy);
}
Beispiel #11
0
/* void Disconnect() */
void network_disconnect(Network *self, GError **error)
{
	g_assert(NETWORK_IS(self));

	dbus_g_proxy_call(self->priv->dbus_g_proxy, "Disconnect", error, G_TYPE_INVALID, G_TYPE_INVALID);
}
Beispiel #12
0
void network_set_property(Network *self, const gchar *name, const GVariant *value, GError **error)
{
	g_assert(NETWORK_IS(self));
	g_assert(self->priv->properties != NULL);
	properties_set(self->priv->properties, NETWORK_DBUS_INTERFACE, name, value, error);
}
Beispiel #13
0
/* Properties access methods */
GVariant *network_get_properties(Network *self, GError **error)
{
	g_assert(NETWORK_IS(self));
	g_assert(self->priv->properties != NULL);
	return properties_get_all(self->priv->properties, NETWORK_DBUS_INTERFACE, error);
}
Beispiel #14
0
/* void Disconnect() */
void network_disconnect(Network *self, GError **error)
{
	g_assert(NETWORK_IS(self));
	g_dbus_proxy_call_sync(self->priv->proxy, "Disconnect", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, error);
}