Пример #1
0
NMListItem *
nm_bt_item_new (NMClient *client,
                NMDeviceBt *device,
                NMSettingsConnectionInterface *connection)
{
    g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
    g_return_val_if_fail (NM_IS_DEVICE_BT (device), NULL);
    g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION_INTERFACE (connection), NULL);

    return (NMListItem *) g_object_new (NM_TYPE_BT_ITEM,
                                        NM_LIST_ITEM_TYPE_NAME, _("bluetooth"),
                                        NM_CONNECTION_ITEM_CLIENT, client,
                                        NM_CONNECTION_ITEM_CONNECTION, connection,
                                        NM_DEVICE_ITEM_DEVICE, device,
                                        NULL);
}
NMListItem *
nm_ethernet_item_new (NMClient *client,
                      NMDeviceEthernet *device,
                      NMSettingsConnectionInterface *connection)
{
    g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
    g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), NULL);
    g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION_INTERFACE (connection), NULL);

    return (NMListItem *) g_object_new (NM_TYPE_ETHERNET_ITEM,
                                        NM_LIST_ITEM_TYPE_NAME, _("wired"),
                                        NM_CONNECTION_ITEM_DELETE_ALLOWED, FALSE,
                                        NM_CONNECTION_ITEM_CLIENT, client,
                                        NM_CONNECTION_ITEM_CONNECTION, connection,
                                        NM_DEVICE_ITEM_DEVICE, device,
                                        NULL);
}
void
nm_settings_service_export_connection (NMSettingsService *self,
                                       NMSettingsConnectionInterface *connection)
{
	NMSettingsServicePrivate *priv = NM_SETTINGS_SERVICE_GET_PRIVATE (self);
	static guint32 ec_counter = 0;
	char *path;

	g_return_if_fail (connection != NULL);
	g_return_if_fail (NM_IS_SETTINGS_CONNECTION_INTERFACE (connection));
	g_return_if_fail (priv->bus != NULL);

	/* Don't allow exporting twice */
	g_return_if_fail (nm_connection_get_path (NM_CONNECTION (connection)) == NULL);

	path = g_strdup_printf ("%s/%u", NM_DBUS_PATH_SETTINGS, ec_counter++);
	nm_connection_set_path (NM_CONNECTION (connection), path);
	nm_connection_set_scope (NM_CONNECTION (connection), priv->scope);

	dbus_g_connection_register_g_object (priv->bus, path, G_OBJECT (connection));
	g_free (path);
}