/**
 * nm_device_wifi_get_access_points:
 * @device: a #NMDeviceWifi
 *
 * Gets all the scanned access points of the #NMDeviceWifi.
 *
 * Returns: a #GPtrArray containing all the scanned #NMAccessPoint<!-- -->s.
 * The returned array is owned by the client and should not be modified.
 **/
const GPtrArray *
nm_device_wifi_get_access_points (NMDeviceWifi *device)
{
	NMDeviceWifiPrivate *priv;
	DBusGConnection *connection;
	GValue value = { 0, };
	GError *error = NULL;
	GPtrArray *temp;

	g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL);

	priv = NM_DEVICE_WIFI_GET_PRIVATE (device);
	if (priv->aps)
		return handle_ptr_array_return (priv->aps);

	if (!org_freedesktop_NetworkManager_Device_Wireless_get_access_points (priv->proxy, &temp, &error)) {
		g_warning ("%s: error getting access points: %s", __func__, error->message);
		g_error_free (error);
		return NULL;
	}

	g_value_init (&value, DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH);
	g_value_take_boxed (&value, temp);
	connection = nm_object_get_connection (NM_OBJECT (device));
	_nm_object_array_demarshal (&value, &priv->aps, connection, nm_access_point_new);
	g_value_unset (&value);

	return handle_ptr_array_return (priv->aps);
}
Exemplo n.º 2
0
/**
 * bm_client_get_devices:
 * @client: a #BMClient
 *
 * Gets all the detected devices.
 *
 * Returns: a #GPtrArray containing all the #BMDevice<!-- -->s.
 * The returned array is owned by the client and should not be modified.
 **/
const GPtrArray *
bm_client_get_devices (BMClient *client)
{
	BMClientPrivate *priv;
	DBusGConnection *connection;
	GValue value = { 0, };
	GError *error = NULL;
	GPtrArray *temp;

	g_return_val_if_fail (BM_IS_CLIENT (client), NULL);

	priv = BM_CLIENT_GET_PRIVATE (client);
	if (priv->devices)
		return handle_ptr_array_return (priv->devices);

	if (!org_freedesktop_BarcodeManager_get_devices (priv->client_proxy, &temp, &error)) {
		g_warning ("%s: error getting devices: %s\n", __func__, error->message);
		g_error_free (error);
		return NULL;
	}

	g_value_init (&value, DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH);
	g_value_take_boxed (&value, temp);
	connection = bm_object_get_connection (BM_OBJECT (client));
	_bm_object_array_demarshal (&value, &priv->devices, connection, bm_device_new);
	g_value_unset (&value);

	return handle_ptr_array_return (priv->devices);
}
Exemplo n.º 3
0
/**
 * bm_client_get_active_connections:
 * @client: a #BMClient
 *
 * Gets the active connections.
 *
 * Returns: a #GPtrArray containing all the active #BMActiveConnection<!-- -->s.
 * The returned array is owned by the client and should not be modified.
 **/
const GPtrArray * 
bm_client_get_active_connections (BMClient *client)
{
	BMClientPrivate *priv;
	GValue value = { 0, };

	g_return_val_if_fail (BM_IS_CLIENT (client), NULL);

	priv = BM_CLIENT_GET_PRIVATE (client);
	if (priv->active_connections)
		return handle_ptr_array_return (priv->active_connections);

	if (!priv->manager_running)
		return NULL;

	if (!_bm_object_get_property (BM_OBJECT (client),
	                             "org.freedesktop.BarcodeManager",
	                             "ActiveConnections",
	                             &value)) {
		return NULL;
	}

	demarshal_active_connections (BM_OBJECT (client), NULL, &value, &priv->active_connections);	
	g_value_unset (&value);

	return handle_ptr_array_return (priv->active_connections);
}
Exemplo n.º 4
0
/**
 * nm_ip4_config_get_domains:
 * @config: a #NMIP4Config
 *
 * Gets the domain names.
 *
 * Returns: (element-type utf8): the #GPtrArray containing domains as strings. This is the 
 * internal copy used by the configuration, and must not be modified.
 **/
const GPtrArray *
nm_ip4_config_get_domains (NMIP4Config *config)
{
	NMIP4ConfigPrivate *priv;
	GValue value = {0,};

	g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);

	priv = NM_IP4_CONFIG_GET_PRIVATE (config);
	if (priv->domains)
		return handle_ptr_array_return (priv->domains);

	if (_nm_object_get_property (NM_OBJECT (config),
	                             NM_DBUS_INTERFACE_IP4_CONFIG,
	                             "Domains",
	                             &value,
	                             NULL)) {
		char **array = NULL, **p;

		array = (char **) g_value_get_boxed (&value);
		if (array && g_strv_length (array)) {
			priv->domains = g_ptr_array_sized_new (g_strv_length (array));
			for (p = array; *p; p++)
				g_ptr_array_add (priv->domains, g_strdup (*p));
		}
		g_value_unset (&value);
	}

	return handle_ptr_array_return (priv->domains);
}
Exemplo n.º 5
0
/**
 * nm_ip6_config_get_domains:
 * @config: a #NMIP6Config
 *
 * Gets the domain names.
 *
 * Returns: (element-type utf8): the #GPtrArray containing domains as strings.
 * This is the internal copy used by the configuration, and must not be modified.
 **/
const GPtrArray *
nm_ip6_config_get_domains (NMIP6Config *config)
{
	NMIP6ConfigPrivate *priv;
	GValue value = {0,};

	g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);

	priv = NM_IP6_CONFIG_GET_PRIVATE (config);
	if (priv->domains)
		return handle_ptr_array_return (priv->domains);

	if (!_nm_object_get_property (NM_OBJECT (config),
	                              NM_DBUS_INTERFACE_IP6_CONFIG,
	                              "Domains",
	                              &value,
	                              NULL)) {
		return NULL;
	}

	demarshal_domains (NM_OBJECT (config), NULL, &value, &priv->domains);
	g_value_unset (&value);

	return handle_ptr_array_return (priv->domains);
}
Exemplo n.º 6
0
/**
 * nm_device_bond_get_slaves:
 * @device: a #NMDeviceBond
 *
 * Gets the devices currently slaved to @device.
 *
 * Returns: (element-type NMClient.Device): the #GPtrArray containing
 * #NMDevices that are slaves of @device. This is the internal
 * copy used by the device, and must not be modified.
 *
 * Since: 0.9.6.4
 **/
const GPtrArray *
nm_device_bond_get_slaves (NMDeviceBond *device)
{
	g_return_val_if_fail (NM_IS_DEVICE_BOND (device), FALSE);

	_nm_object_ensure_inited (NM_OBJECT (device));
	return handle_ptr_array_return (NM_DEVICE_BOND_GET_PRIVATE (device)->slaves);
}
Exemplo n.º 7
0
/**
 * nm_ip6_config_get_searches:
 * @config: a #NMIP6Config
 *
 * Gets the dns searches.
 *
 * Returns: (element-type utf8): the #GPtrArray containing dns searches as strings.
 * This is the internal copy used by the configuration, and must not be modified.
 *
 * Since: 0.9.10
 **/
const GPtrArray *
nm_ip6_config_get_searches (NMIP6Config *config)
{
	g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);

	_nm_object_ensure_inited (NM_OBJECT (config));
	return handle_ptr_array_return (NM_IP6_CONFIG_GET_PRIVATE (config)->searches);
}
/**
 * nm_device_wifi_get_access_points:
 * @device: a #NMDeviceWifi
 *
 * Gets all the scanned access points of the #NMDeviceWifi.
 *
 * Returns: (element-type NMClient.AccessPoint): a #GPtrArray containing all the
 * scanned #NMAccessPoint<!-- -->s.
 * The returned array is owned by the client and should not be modified.
 **/
const GPtrArray *
nm_device_wifi_get_access_points (NMDeviceWifi *device)
{
	g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL);

	_nm_object_ensure_inited (NM_OBJECT (device));
	return handle_ptr_array_return (NM_DEVICE_WIFI_GET_PRIVATE (device)->aps);
}
Exemplo n.º 9
0
/**
 * nm_ip4_config_get_domains:
 * @config: a #NMIP4Config
 *
 * Gets the domain names.
 *
 * Returns: (element-type utf8): the #GPtrArray containing domains as strings. This is the 
 * internal copy used by the configuration, and must not be modified.
 **/
const GPtrArray *
nm_ip4_config_get_domains (NMIP4Config *config)
{
	g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);

	_nm_object_ensure_inited (NM_OBJECT (config));
	return handle_ptr_array_return (NM_IP4_CONFIG_GET_PRIVATE (config)->domains);
}
Exemplo n.º 10
0
/**
 * nm_device_wimax_get_nsps:
 * @wimax: a #NMDeviceWimax
 *
 * Gets all the scanned NSPs of the #NMDeviceWimax.
 *
 * Returns: (element-type NMWimaxNsp): a #GPtrArray containing
 *          all the scanned #NMWimaxNsps.
 * The returned array is owned by the client and should not be modified.
 *
 * Deprecated: 1.2: WiMAX is no longer supported.
 **/
const GPtrArray *
nm_device_wimax_get_nsps (NMDeviceWimax *wimax)
{
	g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL);

	_nm_object_ensure_inited (NM_OBJECT (wimax));
	return handle_ptr_array_return (NM_DEVICE_WIMAX_GET_PRIVATE (wimax)->nsps);
}
/**
 * nm_active_connection_get_devices:
 * @connection: a #NMActiveConnection
 *
 * Gets the #NMDevice<!-- -->s used for the active connections.
 *
 * Returns: the #GPtrArray containing #NMDevice<!-- -->s.
 * This is the internal copy used by the connection, and must not be modified.
 **/
const GPtrArray *
nm_active_connection_get_devices (NMActiveConnection *connection)
{
	NMActiveConnectionPrivate *priv;
	GValue value = { 0, };

	g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);

	priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (connection);
	if (priv->devices)
		return handle_ptr_array_return (priv->devices);

	if (!_nm_object_get_property (NM_OBJECT (connection),
	                             NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
	                             DBUS_PROP_DEVICES,
	                             &value)) {
		return NULL;
	}

	demarshal_devices (NM_OBJECT (connection), NULL, &value, &priv->devices);
	g_value_unset (&value);

	return handle_ptr_array_return (priv->devices);
}